2019-11-19 05:18:28 +03:00
|
|
|
#!/bin/bash
|
2019-11-21 05:01:07 +03:00
|
|
|
set -e
|
|
|
|
set +x
|
2019-11-19 05:18:28 +03:00
|
|
|
|
|
|
|
if [[ ("$1" == "-h") || ("$1" == "--help") ]]; then
|
2020-02-08 00:55:53 +03:00
|
|
|
echo "usage: $(basename $0) [output-absolute-path] [--wpe|--gtk]"
|
2019-11-19 05:18:28 +03:00
|
|
|
echo
|
|
|
|
echo "Generate distributable .zip archive from ./checkout folder that was previously built."
|
|
|
|
echo
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2019-11-21 05:01:07 +03:00
|
|
|
ZIP_PATH=$1
|
2020-02-08 00:55:53 +03:00
|
|
|
LINUX_FLAVOR=$2
|
2019-11-21 05:01:07 +03:00
|
|
|
if [[ $ZIP_PATH != /* ]]; then
|
|
|
|
echo "ERROR: path $ZIP_PATH is not absolute"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [[ $ZIP_PATH != *.zip ]]; then
|
|
|
|
echo "ERROR: path $ZIP_PATH must have .zip extension"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [[ -f $ZIP_PATH ]]; then
|
|
|
|
echo "ERROR: path $ZIP_PATH exists; can't do anything."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if ! [[ -d $(dirname $ZIP_PATH) ]]; then
|
|
|
|
echo "ERROR: folder for path $($ZIP_PATH) does not exist."
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-11-19 05:18:28 +03:00
|
|
|
|
|
|
|
main() {
|
|
|
|
cd checkout
|
|
|
|
|
2019-11-21 05:01:07 +03:00
|
|
|
set -x
|
2019-11-19 05:18:28 +03:00
|
|
|
if [[ "$(uname)" == "Darwin" ]]; then
|
|
|
|
createZipForMac
|
|
|
|
elif [[ "$(uname)" == "Linux" ]]; then
|
|
|
|
createZipForLinux
|
2020-01-17 02:32:50 +03:00
|
|
|
elif [[ "$(uname)" == MINGW* ]]; then
|
|
|
|
createZipForWindows
|
2019-11-19 05:18:28 +03:00
|
|
|
else
|
|
|
|
echo "ERROR: cannot upload on this platform!" 1>&2
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
createZipForLinux() {
|
|
|
|
# create a TMP directory to copy all necessary files
|
|
|
|
local tmpdir=$(mktemp -d -t webkit-deploy-XXXXXXXXXX)
|
|
|
|
mkdir -p $tmpdir
|
|
|
|
|
|
|
|
# copy runner
|
|
|
|
cp -t $tmpdir ../pw_run.sh
|
|
|
|
# copy protocol
|
|
|
|
node ../concat_protocol.js > $tmpdir/protocol.json
|
|
|
|
|
2020-02-08 00:55:53 +03:00
|
|
|
if [[ "$LINUX_FLAVOR" == "--wpe" ]]; then
|
2020-01-11 06:14:55 +03:00
|
|
|
# copy all relevant binaries
|
2020-01-24 22:54:50 +03:00
|
|
|
cp -t $tmpdir ./WebKitBuild/WPE/Release/bin/MiniBrowser ./WebKitBuild/WPE/Release/bin/WPE*Process
|
2020-01-11 06:14:55 +03:00
|
|
|
# copy all relevant shared objects
|
2020-01-24 22:54:50 +03:00
|
|
|
LD_LIBRARY_PATH="$PWD/WebKitBuild/WPE/DependenciesWPE/Root/lib" ldd WebKitBuild/WPE/Release/bin/MiniBrowser | grep -o '[^ ]*WebKitBuild/WPE/[^ ]*' | xargs cp -t $tmpdir
|
|
|
|
LD_LIBRARY_PATH="$PWD/WebKitBuild/WPE/DependenciesWPE/Root/lib" ldd WebKitBuild/WPE/Release/bin/WPENetworkProcess | grep -o '[^ ]*WebKitBuild/WPE/[^ ]*' | xargs cp -t $tmpdir
|
|
|
|
LD_LIBRARY_PATH="$PWD/WebKitBuild/WPE/DependenciesWPE/Root/lib" ldd WebKitBuild/WPE/Release/bin/WPEWebProcess | grep -o '[^ ]*WebKitBuild/WPE/[^ ]*' | xargs cp -t $tmpdir
|
2020-01-18 08:36:53 +03:00
|
|
|
mkdir -p $tmpdir/gio/modules
|
2020-01-24 22:54:50 +03:00
|
|
|
cp -t $tmpdir/gio/modules $PWD/WebKitBuild/WPE/DependenciesWPE/Root/lib/gio/modules/*
|
2020-01-18 08:36:53 +03:00
|
|
|
|
2020-01-11 06:14:55 +03:00
|
|
|
cd $tmpdir
|
|
|
|
ln -s libWPEBackend-fdo-1.0.so.1 libWPEBackend-fdo-1.0.so
|
|
|
|
cd -
|
2020-02-08 00:55:53 +03:00
|
|
|
elif [[ "$LINUX_FLAVOR" == "--gtk" ]]; then
|
2020-01-11 06:14:55 +03:00
|
|
|
# copy all relevant binaries
|
2020-01-24 22:54:50 +03:00
|
|
|
cp -t $tmpdir ./WebKitBuild/GTK/Release/bin/MiniBrowser ./WebKitBuild/GTK/Release/bin/WebKit*Process
|
2020-01-11 06:14:55 +03:00
|
|
|
# copy all relevant shared objects
|
2020-01-24 22:54:50 +03:00
|
|
|
LD_LIBRARY_PATH="$PWD/WebKitBuild/GTK/DependenciesGTK/Root/lib" ldd WebKitBuild/GTK/Release/bin/MiniBrowser | grep -o '[^ ]*WebKitBuild/GTK/[^ ]*' | xargs cp -t $tmpdir
|
2020-01-18 08:36:53 +03:00
|
|
|
mkdir -p $tmpdir/gio/modules
|
2020-01-24 22:54:50 +03:00
|
|
|
cp -t $tmpdir/gio/modules $PWD/WebKitBuild/GTK/DependenciesGTK/Root/lib/gio/modules/*
|
2020-01-11 06:14:55 +03:00
|
|
|
|
|
|
|
# we failed to nicely build libgdk_pixbuf - expect it in the env
|
|
|
|
rm $tmpdir/libgdk_pixbuf*
|
2020-02-08 00:55:53 +03:00
|
|
|
else
|
|
|
|
echo "ERROR: must specify --gtk or --wpe"
|
|
|
|
exit 1
|
2020-01-11 06:14:55 +03:00
|
|
|
fi
|
2019-11-19 05:18:28 +03:00
|
|
|
|
|
|
|
# tar resulting directory and cleanup TMP.
|
2020-01-11 06:14:55 +03:00
|
|
|
cd $tmpdir
|
2020-01-31 06:10:05 +03:00
|
|
|
strip --strip-unneeded * || true
|
2020-01-11 06:14:55 +03:00
|
|
|
zip --symlinks -r $ZIP_PATH ./
|
|
|
|
cd -
|
2019-11-19 05:18:28 +03:00
|
|
|
rm -rf $tmpdir
|
|
|
|
}
|
|
|
|
|
2020-01-17 02:32:50 +03:00
|
|
|
createZipForWindows() {
|
|
|
|
# create a TMP directory to copy all necessary files
|
|
|
|
local tmpdir="/tmp/webkit-deploy-$(date +%s)"
|
|
|
|
mkdir -p $tmpdir
|
|
|
|
|
|
|
|
cp -t $tmpdir ./WebKitLibraries/win/bin64/*.dll
|
|
|
|
cd WebKitBuild/Release/bin64
|
|
|
|
cp -r -t $tmpdir WebKit.resources
|
2020-04-11 03:01:32 +03:00
|
|
|
cp -t $tmpdir JavaScriptCore.dll PlaywrightLib.dll WTF.dll WebKit2.dll libEGL.dll libGLESv2.dll
|
|
|
|
cp -t $tmpdir Playwright.exe WebKitNetworkProcess.exe WebKitWebProcess.exe
|
2020-01-17 02:32:50 +03:00
|
|
|
cd -
|
2020-01-17 22:59:41 +03:00
|
|
|
cd /c/WEBKIT_WIN64_LIBS
|
2020-03-09 21:43:11 +03:00
|
|
|
cp -t $tmpdir msvcp140.dll vcruntime140.dll vcruntime140_1.dll msvcp140_2.dll
|
2020-01-17 20:24:45 +03:00
|
|
|
cd -
|
2020-01-17 02:32:50 +03:00
|
|
|
|
|
|
|
# copy protocol
|
|
|
|
node ../concat_protocol.js > $tmpdir/protocol.json
|
|
|
|
# tar resulting directory and cleanup TMP.
|
|
|
|
cd $tmpdir
|
|
|
|
zip -r $ZIP_PATH ./
|
|
|
|
cd -
|
|
|
|
rm -rf $tmpdir
|
|
|
|
}
|
|
|
|
|
2019-11-19 05:18:28 +03:00
|
|
|
createZipForMac() {
|
|
|
|
# create a TMP directory to copy all necessary files
|
|
|
|
local tmpdir=$(mktemp -d)
|
|
|
|
|
|
|
|
# copy all relevant files
|
|
|
|
ditto {./WebKitBuild/Release,$tmpdir}/com.apple.WebKit.Networking.xpc
|
|
|
|
ditto {./WebKitBuild/Release,$tmpdir}/com.apple.WebKit.Plugin.64.xpc
|
|
|
|
ditto {./WebKitBuild/Release,$tmpdir}/com.apple.WebKit.WebContent.xpc
|
|
|
|
ditto {./WebKitBuild/Release,$tmpdir}/JavaScriptCore.framework
|
|
|
|
ditto {./WebKitBuild/Release,$tmpdir}/libwebrtc.dylib
|
2020-01-18 09:13:55 +03:00
|
|
|
ditto {./WebKitBuild/Release,$tmpdir}/Playwright.app
|
2019-11-19 05:18:28 +03:00
|
|
|
ditto {./WebKitBuild/Release,$tmpdir}/PluginProcessShim.dylib
|
|
|
|
ditto {./WebKitBuild/Release,$tmpdir}/SecItemShim.dylib
|
|
|
|
ditto {./WebKitBuild/Release,$tmpdir}/WebCore.framework
|
|
|
|
ditto {./WebKitBuild/Release,$tmpdir}/WebInspectorUI.framework
|
|
|
|
ditto {./WebKitBuild/Release,$tmpdir}/WebKit.framework
|
|
|
|
ditto {./WebKitBuild/Release,$tmpdir}/WebKitLegacy.framework
|
|
|
|
ditto {..,$tmpdir}/pw_run.sh
|
|
|
|
# copy protocol
|
|
|
|
node ../concat_protocol.js > $tmpdir/protocol.json
|
|
|
|
|
|
|
|
# zip resulting directory and cleanup TMP.
|
2019-11-21 05:01:07 +03:00
|
|
|
ditto -c -k $tmpdir $ZIP_PATH
|
2019-11-19 05:18:28 +03:00
|
|
|
rm -rf $tmpdir
|
|
|
|
}
|
|
|
|
|
2019-11-20 03:08:27 +03:00
|
|
|
trap "cd $(pwd -P)" EXIT
|
2019-11-19 05:18:28 +03:00
|
|
|
cd "$(dirname "$0")"
|
2019-11-20 03:08:27 +03:00
|
|
|
|
2019-11-19 05:18:28 +03:00
|
|
|
main "$@"
|