|
3 | 3 | set +x
|
4 | 4 |
|
5 | 5 | if [[ ("$1" == "-h") || ("$1" == "--help") ]]; then
|
6 |
| - echo "usage: $(basename $0) [output-absolute-path] [--wpe|--gtk]" |
| 6 | + echo "usage: $(basename $0) [output-absolute-path]" |
7 | 7 | echo
|
8 | 8 | echo "Generate distributable .zip archive from ./checkout folder that was previously built."
|
9 | 9 | echo
|
10 | 10 | exit 0
|
11 | 11 | fi
|
12 | 12 |
|
13 | 13 | ZIP_PATH=$1
|
14 |
| -LINUX_FLAVOR=$2 |
15 | 14 | if [[ $ZIP_PATH != /* ]]; then
|
16 | 15 | echo "ERROR: path $ZIP_PATH is not absolute"
|
17 | 16 | exit 1
|
@@ -45,80 +44,101 @@ main() {
|
45 | 44 | fi
|
46 | 45 | }
|
47 | 46 |
|
| 47 | +copyLibrariesForWPE() { |
| 48 | + # Expect target directory to be passed in as first argument. |
| 49 | + local tmpdir=$1 |
| 50 | + |
| 51 | + # copy runner |
| 52 | + cp -t $tmpdir $SCRIPTS_DIR/pw_run.sh |
| 53 | + |
| 54 | + # copy all relevant binaries |
| 55 | + cp -t $tmpdir ./WebKitBuild/WPE/Release/bin/MiniBrowser ./WebKitBuild/WPE/Release/bin/WPE*Process |
| 56 | + # copy all relevant shared objects |
| 57 | + # - exclude gstreamer plugins |
| 58 | + LD_LIBRARY_PATH="$PWD/WebKitBuild/WPE/DependenciesWPE/Root/lib" ldd WebKitBuild/WPE/Release/bin/MiniBrowser \ |
| 59 | + | grep -o '[^ ]*WebKitBuild/WPE/[^ ]*' \ |
| 60 | + | grep -v '/libgst.*so' \ |
| 61 | + | xargs cp -t $tmpdir |
| 62 | + LD_LIBRARY_PATH="$PWD/WebKitBuild/WPE/DependenciesWPE/Root/lib" ldd WebKitBuild/WPE/Release/bin/WPENetworkProcess \ |
| 63 | + | grep -o '[^ ]*WebKitBuild/WPE/[^ ]*' \ |
| 64 | + | grep -v '/libgst.*so' \ |
| 65 | + | xargs cp -t $tmpdir |
| 66 | + LD_LIBRARY_PATH="$PWD/WebKitBuild/WPE/DependenciesWPE/Root/lib" ldd WebKitBuild/WPE/Release/bin/WPEWebProcess \ |
| 67 | + | grep -o '[^ ]*WebKitBuild/WPE/[^ ]*' \ |
| 68 | + | grep -v '/libgst.*so' \ |
| 69 | + | xargs cp -t $tmpdir |
| 70 | + # Copy some wayland libraries required for Web Process |
| 71 | + if ls WebKitBuild/WPE/DependenciesWPE/Root/lib/libva\-* 2>&1 >/dev/null; then |
| 72 | + cp -d -t $tmpdir WebKitBuild/WPE/DependenciesWPE/Root/lib/libva\-* |
| 73 | + fi |
| 74 | + # Injected bundle is loaded dynamicly via dlopen => not bt listed by ldd. |
| 75 | + cp -t $tmpdir WebKitBuild/WPE/Release/lib/libWPEInjectedBundle.so |
| 76 | + if test -d $PWD/WebKitBuild/WPE/DependenciesWPE/Root/lib/gio/modules/; then |
| 77 | + mkdir -p $tmpdir/gio/modules |
| 78 | + cp -t $tmpdir/gio/modules $PWD/WebKitBuild/WPE/DependenciesWPE/Root/lib/gio/modules/* |
| 79 | + fi |
| 80 | + |
| 81 | + cd $tmpdir |
| 82 | + ln -s libWPEBackend-fdo-1.0.so.1 libWPEBackend-fdo-1.0.so |
| 83 | + cd - |
| 84 | + |
| 85 | + # Strip copied binaries. |
| 86 | + cd $tmpdir |
| 87 | + strip --strip-unneeded * || true |
| 88 | + cd - |
| 89 | +} |
| 90 | + |
| 91 | +copyLibrariesForGTK() { |
| 92 | + # Expect target directory to be passed in as first argument. |
| 93 | + local tmpdir=$1 |
| 94 | + |
| 95 | + # copy runner |
| 96 | + cp -t $tmpdir $SCRIPTS_DIR/pw_run.sh |
| 97 | + |
| 98 | + # copy all relevant binaries |
| 99 | + cp -t $tmpdir ./WebKitBuild/GTK/Release/bin/MiniBrowser ./WebKitBuild/GTK/Release/bin/WebKit*Process |
| 100 | + # copy all relevant shared objects |
| 101 | + # - exclude gstreamer plugins |
| 102 | + # - exclude libdrm |
| 103 | + LD_LIBRARY_PATH="$PWD/WebKitBuild/GTK/DependenciesGTK/Root/lib" ldd WebKitBuild/GTK/Release/bin/MiniBrowser \ |
| 104 | + | grep -o '[^ ]*WebKitBuild/GTK/[^ ]*' \ |
| 105 | + | grep -v '/libgst.*so' \ |
| 106 | + | grep -v '/libdrm.so' \ |
| 107 | + | xargs cp -t $tmpdir |
| 108 | + |
| 109 | + # Injected bundle is loaded dynamicly via dlopen => not bt listed by ldd. |
| 110 | + cp -t $tmpdir WebKitBuild/GTK/Release/lib/libwebkit2gtkinjectedbundle.so |
| 111 | + if test -d $PWD/WebKitBuild/GTK/DependenciesGTK/Root/lib/gio/modules; then |
| 112 | + mkdir -p $tmpdir/gio/modules |
| 113 | + cp -t $tmpdir/gio/modules $PWD/WebKitBuild/GTK/DependenciesGTK/Root/lib/gio/modules/* |
| 114 | + fi |
| 115 | + |
| 116 | + # we failed to nicely build libgdk_pixbuf - expect it in the env |
| 117 | + rm -f $tmpdir/libgdk_pixbuf* |
| 118 | + |
| 119 | + # tar resulting directory and cleanup TMP. |
| 120 | + cd $tmpdir |
| 121 | + strip --strip-unneeded * || true |
| 122 | + cd - |
| 123 | +} |
| 124 | + |
48 | 125 | createZipForLinux() {
|
49 | 126 | # create a TMP directory to copy all necessary files
|
50 | 127 | local tmpdir=$(mktemp -d -t webkit-deploy-XXXXXXXXXX)
|
51 | 128 | mkdir -p $tmpdir
|
| 129 | + mkdir -p $tmpdir/minibrowser-gtk |
| 130 | + mkdir -p $tmpdir/minibrowser-wpe |
52 | 131 |
|
53 | 132 | # copy runner
|
54 | 133 | cp -t $tmpdir $SCRIPTS_DIR/pw_run.sh
|
55 | 134 | # copy protocol
|
56 | 135 | node $SCRIPTS_DIR/concat_protocol.js > $tmpdir/protocol.json
|
57 | 136 |
|
58 |
| - if [[ "$LINUX_FLAVOR" == "--wpe" ]]; then |
59 |
| - # copy all relevant binaries |
60 |
| - cp -t $tmpdir ./WebKitBuild/WPE/Release/bin/MiniBrowser ./WebKitBuild/WPE/Release/bin/WPE*Process |
61 |
| - # copy all relevant shared objects |
62 |
| - # - exclude gstreamer plugins |
63 |
| - LD_LIBRARY_PATH="$PWD/WebKitBuild/WPE/DependenciesWPE/Root/lib" ldd WebKitBuild/WPE/Release/bin/MiniBrowser \ |
64 |
| - | grep -o '[^ ]*WebKitBuild/WPE/[^ ]*' \ |
65 |
| - | grep -v '/libgst.*so' \ |
66 |
| - | xargs cp -t $tmpdir |
67 |
| - LD_LIBRARY_PATH="$PWD/WebKitBuild/WPE/DependenciesWPE/Root/lib" ldd WebKitBuild/WPE/Release/bin/WPENetworkProcess \ |
68 |
| - | grep -o '[^ ]*WebKitBuild/WPE/[^ ]*' \ |
69 |
| - | grep -v '/libgst.*so' \ |
70 |
| - | xargs cp -t $tmpdir |
71 |
| - LD_LIBRARY_PATH="$PWD/WebKitBuild/WPE/DependenciesWPE/Root/lib" ldd WebKitBuild/WPE/Release/bin/WPEWebProcess \ |
72 |
| - | grep -o '[^ ]*WebKitBuild/WPE/[^ ]*' \ |
73 |
| - | grep -v '/libgst.*so' \ |
74 |
| - | xargs cp -t $tmpdir |
75 |
| - # Copy libvpx.so.5 as Ubuntu 20.04 comes with libvpx.so.6 |
76 |
| - ldd WebKitBuild/WPE/Release/bin/MiniBrowser | grep -o '[^ ]*\/libvpx.so.5[^ ]*' | xargs cp -t $tmpdir |
77 |
| - # Copy some wayland libraries required for Web Process t |
78 |
| - if ls WebKitBuild/WPE/DependenciesWPE/Root/lib/libva\-* 2>&1 >/dev/null; then |
79 |
| - cp -d -t $tmpdir WebKitBuild/WPE/DependenciesWPE/Root/lib/libva\-* |
80 |
| - fi |
81 |
| - # Injected bundle is loaded dynamicly via dlopen => not bt listed by ldd. |
82 |
| - cp -t $tmpdir WebKitBuild/WPE/Release/lib/libWPEInjectedBundle.so |
83 |
| - if test -d $PWD/WebKitBuild/WPE/DependenciesWPE/Root/lib/gio/modules/; then |
84 |
| - mkdir -p $tmpdir/gio/modules |
85 |
| - cp -t $tmpdir/gio/modules $PWD/WebKitBuild/WPE/DependenciesWPE/Root/lib/gio/modules/* |
86 |
| - fi |
87 |
| - |
88 |
| - cd $tmpdir |
89 |
| - ln -s libWPEBackend-fdo-1.0.so.1 libWPEBackend-fdo-1.0.so |
90 |
| - cd - |
91 |
| - elif [[ "$LINUX_FLAVOR" == "--gtk" ]]; then |
92 |
| - # copy all relevant binaries |
93 |
| - cp -t $tmpdir ./WebKitBuild/GTK/Release/bin/MiniBrowser ./WebKitBuild/GTK/Release/bin/WebKit*Process |
94 |
| - # copy all relevant shared objects |
95 |
| - # - exclude gstreamer plugins |
96 |
| - # - exclude libdrm |
97 |
| - LD_LIBRARY_PATH="$PWD/WebKitBuild/GTK/DependenciesGTK/Root/lib" ldd WebKitBuild/GTK/Release/bin/MiniBrowser \ |
98 |
| - | grep -o '[^ ]*WebKitBuild/GTK/[^ ]*' \ |
99 |
| - | grep -v '/libgst.*so' \ |
100 |
| - | grep -v '/libdrm.so' \ |
101 |
| - | xargs cp -t $tmpdir |
102 |
| - |
103 |
| - # Injected bundle is loaded dynamicly via dlopen => not bt listed by ldd. |
104 |
| - cp -t $tmpdir WebKitBuild/GTK/Release/lib/libwebkit2gtkinjectedbundle.so |
105 |
| - # Copy libvpx.so.5 as Ubuntu 20.04 comes with libvpx.so.6 |
106 |
| - ldd WebKitBuild/GTK/Release/bin/MiniBrowser | grep -o '[^ ]*\/libvpx.so.5[^ ]*' | xargs cp -t $tmpdir |
107 |
| - if test -d $PWD/WebKitBuild/GTK/DependenciesGTK/Root/lib/gio/modules; then |
108 |
| - mkdir -p $tmpdir/gio/modules |
109 |
| - cp -t $tmpdir/gio/modules $PWD/WebKitBuild/GTK/DependenciesGTK/Root/lib/gio/modules/* |
110 |
| - fi |
111 |
| - |
112 |
| - # we failed to nicely build libgdk_pixbuf - expect it in the env |
113 |
| - rm -f $tmpdir/libgdk_pixbuf* |
114 |
| - else |
115 |
| - echo "ERROR: must specify --gtk or --wpe" |
116 |
| - exit 1 |
117 |
| - fi |
| 137 | + copyLibrariesForWPE $tmpdir/minibrowser-wpe |
| 138 | + copyLibrariesForGTK $tmpdir/minibrowser-gtk |
118 | 139 |
|
119 | 140 | # tar resulting directory and cleanup TMP.
|
120 | 141 | cd $tmpdir
|
121 |
| - strip --strip-unneeded * || true |
122 | 142 | zip --symlinks -r $ZIP_PATH ./
|
123 | 143 | cd -
|
124 | 144 | rm -rf $tmpdir
|
|
0 commit comments