blob: 165a2d72c834d993d058bb405a804cbdbf63199f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
# Maintainer: Ali Mohammad Pur <totally@fakegmail.ch>
# Contributor: Tim Schumacher <timschumi@gmx.de>
# Contributor: Alexander F. Rødseth <xyproto@archlinux.org>
# Contributor: Brian <brain@derelict.garden>
pkgname=ladybird-git
pkgver=r92495.ddd3c0ca887
pkgrel=1
pkgdesc='Truly independent web browser'
arch=(x86_64)
url='https://github.com/LadybirdBrowser/ladybird'
license=(BSD-2-Clause)
conflicts=(ladybird)
provides=(ladybird)
depends=(
curl
fast_float
ffmpeg
harfbuzz
icu
libavif
libedit
libgl
libjpeg-turbo
libtiff
libtommath
libwebp
qt6-base
qt6-multimedia
qt6-tools
qt6-positioning
qt6-wayland
sdl3
simdjson
simdutf
sqlite
ttf-liberation
wayland
woff2
mimalloc
xcb-util-wm
angle # AUR
cpptrace # AUR
libpng-apng # AUR, extra/libpng doesn't provide APNG.
vulkan-memory-allocator # AUR
wuffs-lib # AUR
)
makedepends=(autoconf-archive automake rustup cmake git nasm ninja patchelf skia-static tar unzip zip
zmij # AUR
)
options=('!lto' '!debug' '!buildflags' '!staticlibs' '!emptydirs')
# For AK/Math.h until upstream figures that out.
_llvm_commit=e54169423e7ee5d8b41c2f1b6f7a59000c901ee0
source=(
"git+$url"
"llvm-project-${_llvm_commit}.tar.gz::https://github.com/llvm/llvm-project/archive/${_llvm_commit}.tar.gz"
)
noextract=("llvm-project-${_llvm_commit}.tar.gz")
sha256sums=(
'SKIP'
'db3ee51752d716118e3ff1109c7920a32dfc29bd414112e8d18ff6280e608c1c'
)
pkgver() {
cd ladybird
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
prepare() {
rm -rf llvm-libc
bsdtar -xf "llvm-project-${_llvm_commit}.tar.gz" "llvm-project-${_llvm_commit}/libc"
(cd "llvm-project-${_llvm_commit}/libc" && find hdr include shared src/__support src/string/memory_utils -name '*.h' \
-exec install -Dm644 {} "${srcdir}/llvm-libc/include/llvm-libc/{}" \;)
rm -rf "llvm-project-${_llvm_commit}"
sed -e '/march=/d' -e '/-Ctarget-cpu=native/d' -i ladybird/Meta/CMake/compile_options.cmake
sed -e 's/78\.3 EXACT/78.3/' -i ladybird/Meta/CMake/check_for_dependencies.cmake
sed -e 's#wuffs/wuffs#wuffs#' -i ladybird/Meta/CMake/check_for_dependencies.cmake
sed -e 's#wuffs/wuffs#wuffs#' -i ladybird/Libraries/LibGfx/ImageFormats/GIFLoader.cpp
sed -e 's/mi_heap_get_default/mi_heap_main/' -i ladybird/AK/kmalloc.cpp
sed -e 's/\(lib[a-z]*\)-ladybird)/\1)/' -i ladybird/Meta/CMake/check_for_dependencies.cmake
sed -e '/^add_cxx_compile_options(-Werror)$/i add_cxx_compile_options(-Wno-restrict)' -i ladybird/Meta/CMake/compile_options.cmake
}
build() {
cd "${srcdir}"
export PKG_CONFIG_PATH="$(realpath .)"
unset CARGO_TARGET_DIR
export RUSTUP_TOOLCHAIN="$(sed -n 's/^channel = "\(.*\)"/\1/p' ladybird/rust-toolchain.toml)"
cmake \
-B build \
-S ladybird \
-DENABLE_RUST=YES \
-DBUILD_SHARED_LIBS=OFF \
-DLADYBIRD_CACHE_DIR="${srcdir}/build/Build/caches" \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_LTO_FOR_RELEASE=OFF \
-DCMAKE_INSTALL_PREFIX='/opt/ladybird/usr' \
-DENABLE_INSTALL_HEADERS=OFF \
-DLLVM_LIBC_INCLUDE_DIR="${srcdir}/llvm-libc/include" \
-DCMAKE_INSTALL_LIBEXECDIR="lib/${pkgname%-git}" \
-GNinja \
-Wno-dev
cmake --build build
}
package() {
cd "${srcdir}"
DESTDIR="${pkgdir}" cmake --install build
find "$pkgdir" -name '*.a' -delete
find "$pkgdir" -name '*.cmake' -delete
find "$pkgdir" -type f -executable -exec sh -c '
for exe; do
r=$(patchelf --print-rpath "$exe" 2>/dev/null)
[ "${r%%/opt/angle/lib*}" = "$r" ] && patchelf --set-rpath "/opt/angle/lib${r:+:$r}" "$exe"
done
' sh {} +
# Make the desktop file point to the file in /opt
RELATIVE_DESKTOP_FILE_PATH='usr/share/applications/org.ladybird.Ladybird.desktop'
sed -i -e 's#Exec=Ladybird #Exec=/opt/ladybird/usr/bin/Ladybird #' "${pkgdir}/opt/ladybird/${RELATIVE_DESKTOP_FILE_PATH}"
install -Dm644 ladybird/LICENSE -t "${pkgdir}/opt/ladybird/usr/share/licenses/${pkgname}/"
install -Dm644 "${pkgdir}/opt/ladybird/${RELATIVE_DESKTOP_FILE_PATH}" "${pkgdir}/${RELATIVE_DESKTOP_FILE_PATH}"
# Links
mkdir -p "${pkgdir}/usr/bin" "${pkgdir}/usr/share/licenses" "${pkgdir}/usr/share/metainfo" "${pkgdir}/usr/share/icons/hicolor/scalable/apps" "${pkgdir}/usr/share/icons/hicolor/128x128/apps" "${pkgdir}/usr/share/icons/hicolor/48x48/apps"
ln -s /opt/ladybird/usr/bin/Ladybird "${pkgdir}/usr/bin/Ladybird"
ln -s /opt/ladybird/usr/share/licenses/ladybird-git "${pkgdir}/usr/share/licenses/ladybird-git"
ln -s /opt/ladybird/usr/share/metainfo/org.ladybird.Ladybird.metainfo.xml "${pkgdir}/usr/share/metainfo/org.ladybird.Ladybird.metainfo.xml"
ln -s /opt/ladybird/usr/share/icons/hicolor/scalable/apps/org.ladybird.Ladybird.svg "${pkgdir}/usr/share/icons/hicolor/scalable/apps/org.ladybird.Ladybird.svg"
ln -s /opt/ladybird/usr/share/Lagom/icons/128x128/app-browser.png "${pkgdir}/usr/share/icons/hicolor/128x128/apps/org.ladybird.Ladybird.png"
ln -s /opt/ladybird/usr/share/Lagom/icons/48x48/app-browser.png "${pkgdir}/usr/share/icons/hicolor/48x48/apps/org.ladybird.Ladybird.png"
}
|