2020-05-08 06:48:49 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
main() {
|
|
|
|
cd "$(dirname "${0}")/../.."
|
2020-05-16 17:55:46 +03:00
|
|
|
source ./ci/lib.sh
|
2020-05-08 06:48:49 +03:00
|
|
|
|
2020-05-27 22:56:18 +03:00
|
|
|
rsync "$RELEASE_PATH/" "$RELEASE_PATH-binary"
|
|
|
|
RELEASE_PATH+=-binary
|
2020-05-08 06:48:49 +03:00
|
|
|
|
|
|
|
# We cannot find the path to node from $PATH because yarn shims a script to ensure
|
|
|
|
# we use the same version it's using so we instead run a script with yarn that
|
|
|
|
# will print the path to node.
|
|
|
|
local node_path
|
|
|
|
node_path="$(yarn -s node <<< 'console.info(process.execPath)')"
|
|
|
|
|
|
|
|
mkdir -p "$RELEASE_PATH/bin"
|
|
|
|
rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server"
|
2020-05-22 02:18:50 +03:00
|
|
|
rsync "$node_path" "$RELEASE_PATH/lib/node"
|
|
|
|
if [[ $OS == "linux" ]]; then
|
|
|
|
bundle_dynamic_lib libstdc++
|
|
|
|
bundle_dynamic_lib libgcc_s
|
2020-05-22 04:57:35 +03:00
|
|
|
elif [[ $OS == "macos" ]]; then
|
|
|
|
bundle_dynamic_lib libicui18n
|
|
|
|
bundle_dynamic_lib libicuuc
|
|
|
|
bundle_dynamic_lib libicudata
|
2020-05-22 02:18:50 +03:00
|
|
|
fi
|
2020-05-08 06:48:49 +03:00
|
|
|
|
2020-05-20 16:38:01 +03:00
|
|
|
ln -s "./bin/code-server" "$RELEASE_PATH/code-server"
|
|
|
|
ln -s "./lib/node" "$RELEASE_PATH/node"
|
|
|
|
|
2020-05-08 06:48:49 +03:00
|
|
|
cd "$RELEASE_PATH"
|
2020-05-15 04:47:33 +03:00
|
|
|
yarn --production --frozen-lockfile
|
2020-05-08 06:48:49 +03:00
|
|
|
}
|
|
|
|
|
2020-05-22 02:18:50 +03:00
|
|
|
bundle_dynamic_lib() {
|
2020-05-22 22:38:03 +03:00
|
|
|
local lib_name="$1"
|
|
|
|
local lib_path
|
2020-05-22 02:18:50 +03:00
|
|
|
|
2020-05-22 04:57:35 +03:00
|
|
|
if [[ $OS == "linux" ]]; then
|
|
|
|
lib_path="$(ldd "$RELEASE_PATH/lib/node" | grep "$lib_name" | awk '{print $3 }')"
|
|
|
|
elif [[ $OS == "macos" ]]; then
|
|
|
|
lib_path="$(otool -L "$RELEASE_PATH/lib/node" | grep "$lib_name" | awk '{print $1 }')"
|
|
|
|
fi
|
|
|
|
|
|
|
|
cp "$lib_path" "$RELEASE_PATH/lib"
|
2020-05-22 02:18:50 +03:00
|
|
|
}
|
|
|
|
|
2020-05-08 06:48:49 +03:00
|
|
|
main "$@"
|