master hovercats/oakiss / repo / webkit2gtk / build
 1#!/bin/sh -e
 2
 3export DESTDIR="$1"
 4export PKG_CONFIG_PATH=/usr/lib/pkgconfig
 5export CCACHE_SLOPPINESS=time_macros,include_file_mtime
 6
 7# Silence loud warnings. Source: Chimera linux
 8export CFLAGS="$CFLAGS -DNDEBUG"
 9export CXXFLAGS="$CXXFLAGS -DNDEBUG -Wno-deprecated-declarations -Wno-deprecated-copy"
10
11# Use clang if installed, decreases compilation time by 25%.
12if command -v clang; then
13	export CC=clang 
14	export CXX=clang++
15fi
16
17# fix unsupported -n or -h flag for sbase ln
18sed 's/ln -sfh/ln -sf/g' Source/WebCore/Scripts/generate-derived-sources.sh > _
19mv -f _ Source/WebCore/Scripts/generate-derived-sources.sh
20chmod 755 Source/WebCore/Scripts/generate-derived-sources.sh
21
22sed 's/ln -n -s -f/ln -sf/g' Source/JavaScriptCore/GLib.cmake > _
23mv -f _ Source/JavaScriptCore/GLib.cmake
24
25sed 's/ln -n -s -f/ln -sf/g' Source/WebKit/PlatformGTK.cmake > _
26mv -f _ Source/WebKit/PlatformGTK.cmake
27
28sed 's/ln -n -s -f/ln -sf/g' Source/WebKit/PlatformWPEDeprecated.cmake > _
29mv -f _ Source/WebKit/PlatformWPEDeprecated.cmake
30
31sed 's/ln -n -s -f/ln -sf/g' Source/WebKit/PlatformGTKDeprecated.cmake  > _
32mv -f _ Source/WebKit/PlatformGTKDeprecated.cmake
33 
34# Remove gettext requirement.
35sed 's/ngettext/printf/g' Tools/MiniBrowser/gtk/BrowserDownloadsBar.c > _
36mv -f _ Tools/MiniBrowser/gtk/BrowserDownloadsBar.c
37sed '/po_files \*\.po/d' Source/WebCore/platform/gtk/po/CMakeLists.txt > _
38mv -f _ Source/WebCore/platform/gtk/po/CMakeLists.txt
39sed '/if.*GETTEXT_FOUND/,/^endif/d' Source/WebCore/platform/gtk/po/CMakeLists.txt > _
40mv -f _ Source/WebCore/platform/gtk/po/CMakeLists.txt
41sed '/^GETTEXT_C/d' Source/WebCore/platform/gtk/po/CMakeLists.txt > _
42mv -f _ Source/WebCore/platform/gtk/po/CMakeLists.txt
43
44# Fix clang build.
45sed -e '/LC_ALL/d' -e '/WTFLogAlways/d' Source/JavaScriptCore/jsc.cpp > _
46mv -f _ Source/JavaScriptCore/jsc.cpp
47
48# Webkit's CMake configuration forces color output using clang-specific flags
49# when using Ninja as the CMAKE_GENERATOR. We should disable them.
50sed -e "s/-fcolor-diagnostics//"  \
51	-e "s/-fdiagnostics-color=always/-fdiagnostics-color=never/" \
52	Source/cmake/WebKitCompilerFlags.cmake > _
53mv -f _ Source/cmake/WebKitCompilerFlags.cmake
54
55# Reduce memory usage.
56export LDFLAGS="$LDFLAGS -Wl,--no-keep-memory"
57
58cmake -G Ninja -B build \
59    -DCMAKE_BUILD_TYPE=Release \
60    -DCMAKE_INSTALL_PREFIX=/usr \
61    -DCMAKE_INSTALL_LIBEXECDIR=/usr/lib \
62    -DLIB_INSTALL_DIR=/usr/lib \
63    -DPORT=GTK \
64    -DCMAKE_SKIP_RPATH=ON \
65    -DENABLE_API_TESTS=OFF \
66    -DENABLE_BUBBLEWRAP_SANDBOX=OFF \
67    -DENABLE_C_LOOP=OFF \
68    -DENABLE_DOCUMENTATION=OFF \
69    -DENABLE_GAMEPAD=OFF \
70    -DENABLE_GEOLOCATION=OFF \
71    -DENABLE_INTROSPECTION=OFF \
72    -DENABLE_JIT=OFF \
73    -DENABLE_JOURNALD_LOG=OFF \
74    -DENABLE_MINIBROWSER=OFF \
75    -DENABLE_PDFJS=OFF \
76    -DENABLE_SAMPLING_PROFILER=OFF \
77    -DENABLE_SPELLCHECK=OFF \
78    -DENABLE_WAYLAND_TARGET=ON \
79    -DENABLE_X11_TARGET=OFF \
80    -DUSE_AVIF=OFF \
81    -DUSE_GSTREAMER_GL=OFF \
82    -DUSE_GTK4=OFF \
83    -DUSE_JPEGXL=OFF \
84    -DUSE_LCMS=OFF \
85    -DUSE_LIBBACKTRACE=OFF \
86    -DUSE_LIBHYPHEN=OFF \
87    -DUSE_LIBSECRET=OFF \
88    -DUSE_SOUP2=OFF \
89    -DUSE_WOFF2=OFF \
90    -DUSE_SYSTEM_SYSPROF_CAPTURE=NO \
91    -DUSE_SKIA=NO \
92    -DUSE_FLITE=OFF \
93    -DENABLE_SPEECH_SYNTHESIS=NO \
94    -DUSE_SPIEL=OFF \
95    -Wno-dev
96
97samu -C build
98samu -C build install