2019-11-19 05:18:28 +03:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
2020-02-08 00:55:53 +03:00
|
|
|
set +x
|
2019-11-19 05:18:28 +03:00
|
|
|
|
2019-11-20 03:08:27 +03:00
|
|
|
trap "cd $(pwd -P)" EXIT
|
2021-08-07 15:32:18 +03:00
|
|
|
cd "$(dirname "$0")"
|
2020-12-07 20:21:36 +03:00
|
|
|
SCRIPT_FOLDER="$(pwd -P)"
|
2021-07-14 04:12:53 +03:00
|
|
|
source "${SCRIPT_FOLDER}/../utils.sh"
|
2019-11-19 05:18:28 +03:00
|
|
|
|
2022-07-09 02:27:53 +03:00
|
|
|
# On Linux, Universal build uses Flatpak rather then JHBuild
|
|
|
|
# and packs into a universal binary that can run on any linux
|
|
|
|
# distribution.
|
|
|
|
IS_UNIVERSAL_BUILD=""
|
|
|
|
|
2020-02-08 00:55:53 +03:00
|
|
|
build_gtk() {
|
2022-07-09 02:27:53 +03:00
|
|
|
if [[ -z "${IS_UNIVERSAL_BUILD}" && ! -d "./WebKitBuild/GTK/DependenciesGTK" ]]; then
|
|
|
|
yes | WEBKIT_JHBUILD=1 \
|
|
|
|
WEBKIT_JHBUILD_MODULESET=minimal \
|
|
|
|
WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/GTK \
|
|
|
|
DEBIAN_FRONTEND=noninteractive \
|
|
|
|
./Tools/Scripts/update-webkitgtk-libs
|
2020-02-08 00:55:53 +03:00
|
|
|
fi
|
2022-04-14 21:16:26 +03:00
|
|
|
local CMAKE_ARGS=(
|
|
|
|
--cmakeargs=-DENABLE_INTROSPECTION=OFF
|
|
|
|
--cmakeargs=-DUSE_GSTREAMER_WEBRTC=FALSE
|
|
|
|
)
|
2020-08-07 02:33:34 +03:00
|
|
|
if [[ -n "${EXPORT_COMPILE_COMMANDS}" ]]; then
|
2022-04-14 21:16:26 +03:00
|
|
|
CMAKE_ARGS+=("--cmakeargs=-DCMAKE_EXPORT_COMPILE_COMMANDS=1")
|
2020-08-07 02:33:34 +03:00
|
|
|
fi
|
2022-07-09 02:27:53 +03:00
|
|
|
if [[ -n "${IS_UNIVERSAL_BUILD}" ]]; then
|
|
|
|
./Tools/Scripts/build-webkit --gtk --release "${CMAKE_ARGS}" --touch-events --orientation-events --no-bubblewrap-sandbox "${CMAKE_ARGS[@]}" MiniBrowser
|
|
|
|
else
|
|
|
|
WEBKIT_JHBUILD=1 \
|
|
|
|
WEBKIT_JHBUILD_MODULESET=minimal \
|
|
|
|
WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/GTK \
|
|
|
|
./Tools/Scripts/build-webkit --gtk --release "${CMAKE_ARGS}" --touch-events --orientation-events --no-bubblewrap-sandbox "${CMAKE_ARGS[@]}" MiniBrowser
|
|
|
|
fi
|
2020-02-08 00:55:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
build_wpe() {
|
2022-07-09 02:27:53 +03:00
|
|
|
if [[ -z "${IS_UNIVERSAL_BUILD}" && ! -d "./WebKitBuild/WPE/DependenciesWPE" ]]; then
|
|
|
|
yes | WEBKIT_JHBUILD=1 \
|
|
|
|
WEBKIT_JHBUILD_MODULESET=minimal \
|
|
|
|
WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/WPE \
|
|
|
|
DEBIAN_FRONTEND=noninteractive \
|
|
|
|
./Tools/Scripts/update-webkitwpe-libs
|
2020-02-08 00:55:53 +03:00
|
|
|
fi
|
2022-04-14 21:16:26 +03:00
|
|
|
local CMAKE_ARGS=(
|
|
|
|
--cmakeargs=-DENABLE_COG=OFF
|
|
|
|
--cmakeargs=-DENABLE_INTROSPECTION=OFF
|
|
|
|
--cmakeargs=-DENABLE_WEBXR=OFF
|
|
|
|
--cmakeargs=-DUSE_GSTREAMER_WEBRTC=FALSE
|
|
|
|
)
|
2020-08-07 02:33:34 +03:00
|
|
|
if [[ -n "${EXPORT_COMPILE_COMMANDS}" ]]; then
|
2022-04-14 21:16:26 +03:00
|
|
|
CMAKE_ARGS+=("--cmakeargs=-DCMAKE_EXPORT_COMPILE_COMMANDS=1")
|
2020-08-07 02:33:34 +03:00
|
|
|
fi
|
2022-07-09 02:27:53 +03:00
|
|
|
|
|
|
|
if [[ -n "${IS_UNIVERSAL_BUILD}" ]]; then
|
|
|
|
./Tools/Scripts/build-webkit --wpe --release "${CMAKE_ARGS}" --touch-events --orientation-events --no-bubblewrap-sandbox "${CMAKE_ARGS[@]}" MiniBrowser
|
|
|
|
else
|
|
|
|
WEBKIT_JHBUILD=1 \
|
|
|
|
WEBKIT_JHBUILD_MODULESET=minimal \
|
|
|
|
WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/WPE \
|
|
|
|
./Tools/Scripts/build-webkit --wpe --release "${CMAKE_ARGS}" --touch-events --orientation-events --no-bubblewrap-sandbox "${CMAKE_ARGS[@]}" MiniBrowser
|
|
|
|
fi
|
2020-02-08 00:55:53 +03:00
|
|
|
}
|
|
|
|
|
2020-10-27 07:53:27 +03:00
|
|
|
ensure_linux_deps() {
|
2022-07-09 02:27:53 +03:00
|
|
|
|
|
|
|
if [[ -n "${IS_UNIVERSAL_BUILD}" ]]; then
|
2022-07-12 14:15:27 +03:00
|
|
|
SUDO="" ; [ $UID -ne 0 ] && SUDO="sudo"
|
|
|
|
# - flatpak drives the build
|
|
|
|
# - symlinks and rdfind are needed to de-duplicate files on the GTK+WPE bundle to reduce its size.
|
|
|
|
DEBIAN_FRONTEND=noninteractive ${SUDO} apt-get install -y flatpak symlinks rdfind
|
2022-07-09 02:27:53 +03:00
|
|
|
fi
|
|
|
|
|
2020-10-27 07:53:27 +03:00
|
|
|
yes | DEBIAN_FRONTEND=noninteractive ./Tools/gtk/install-dependencies
|
|
|
|
yes | DEBIAN_FRONTEND=noninteractive ./Tools/wpe/install-dependencies
|
2022-07-09 02:27:53 +03:00
|
|
|
if [[ -z "${IS_UNIVERSAL_BUILD}" ]]; then
|
|
|
|
# In non-universal build install JHBuild deps.
|
|
|
|
yes | DEBIAN_FRONTEND=noninteractive WEBKIT_JHBUILD=1 WEBKIT_JHBUILD_MODULESET=minimal WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/WPE ./Tools/Scripts/update-webkitwpe-libs
|
|
|
|
yes | DEBIAN_FRONTEND=noninteractive WEBKIT_JHBUILD=1 WEBKIT_JHBUILD_MODULESET=minimal WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/GTK ./Tools/Scripts/update-webkitgtk-libs
|
|
|
|
else
|
|
|
|
yes | ./Tools/Scripts/update-webkitwpe-libs
|
|
|
|
yes | ./Tools/Scripts/update-webkitgtk-libs
|
|
|
|
fi
|
2020-10-27 07:53:27 +03:00
|
|
|
}
|
|
|
|
|
2020-12-07 19:42:20 +03:00
|
|
|
if [[ ! -z "${WK_CHECKOUT_PATH}" ]]; then
|
|
|
|
cd "${WK_CHECKOUT_PATH}"
|
|
|
|
echo "WARNING: checkout path from WK_CHECKOUT_PATH env: ${WK_CHECKOUT_PATH}"
|
|
|
|
else
|
2021-10-14 20:20:06 +03:00
|
|
|
cd "$HOME/webkit"
|
2020-12-07 19:42:20 +03:00
|
|
|
fi
|
|
|
|
|
2022-04-22 22:35:35 +03:00
|
|
|
if is_mac; then
|
2022-04-25 16:35:26 +03:00
|
|
|
selectXcodeVersionOrDie $(node "$SCRIPT_FOLDER/../get_xcode_version.js" webkit)
|
2022-06-28 22:30:01 +03:00
|
|
|
./Tools/Scripts/build-webkit --release --touch-events --orientation-events
|
2022-04-22 22:35:35 +03:00
|
|
|
elif is_linux; then
|
2022-07-09 02:27:53 +03:00
|
|
|
args=("$@")
|
|
|
|
IS_FULL=""
|
|
|
|
BUILD_GTK=""
|
|
|
|
BUILD_WPE=""
|
|
|
|
for ((i="${#args[@]}"-1; i >= 0; --i)); do
|
|
|
|
case ${args[i]} in
|
|
|
|
--full) IS_FULL="1"; unset args[i]; ;;
|
|
|
|
--gtk) BUILD_GTK="1"; unset args[i]; ;;
|
|
|
|
--wpe) BUILD_WPE="1"; unset args[i]; ;;
|
|
|
|
--universal) IS_UNIVERSAL_BUILD="1"; unset args[i]; ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
# if neither gtk nor wpe is requested then build both.
|
|
|
|
if [[ -z "${BUILD_GTK}" && -z "${BUILD_WPE}" ]]; then
|
|
|
|
BUILD_GTK="1"
|
|
|
|
BUILD_WPE="1"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "== BUILD CONFIGURATION =="
|
|
|
|
if [[ -n "${IS_UNIVERSAL_BUILD}" ]]; then
|
|
|
|
echo "- universal build: YES"
|
|
|
|
else
|
|
|
|
echo "- universal build: NO"
|
|
|
|
fi
|
|
|
|
if [[ -n "${IS_FULL}" ]]; then
|
|
|
|
echo "- install dependencies: YES"
|
|
|
|
else
|
|
|
|
echo "- install dependencies: NO"
|
|
|
|
fi
|
|
|
|
if [[ -n "${BUILD_GTK}" ]]; then
|
|
|
|
echo "- build GTK: YES"
|
|
|
|
else
|
|
|
|
echo "- build GTK: NO"
|
|
|
|
fi
|
|
|
|
if [[ -n "${BUILD_WPE}" ]]; then
|
|
|
|
echo "- build WPE: YES"
|
|
|
|
else
|
|
|
|
echo "- build WPE: NO"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -n "${IS_FULL}" ]]; then
|
2020-10-27 07:53:27 +03:00
|
|
|
ensure_linux_deps
|
2022-07-09 02:27:53 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -n "${BUILD_WPE}" ]]; then
|
2020-10-27 07:53:27 +03:00
|
|
|
build_wpe
|
2022-07-09 02:27:53 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -n "${BUILD_GTK}" ]]; then
|
2020-10-27 07:53:27 +03:00
|
|
|
build_gtk
|
2019-11-23 09:24:14 +03:00
|
|
|
fi
|
2022-04-22 22:35:35 +03:00
|
|
|
elif is_win; then
|
2021-08-07 15:32:18 +03:00
|
|
|
/c/Windows/System32/cmd.exe "/c $(cygpath -w "${SCRIPT_FOLDER}"/buildwin.bat)"
|
2019-11-19 05:18:28 +03:00
|
|
|
else
|
|
|
|
echo "ERROR: cannot upload on this platform!" 1>&2
|
|
|
|
exit 1;
|
|
|
|
fi
|