Skip to content

Commit

Permalink
Properly quote unix launch scripts (#199)
Browse files Browse the repository at this point in the history
* Properly quote linux scripts

linux scripts

* Properly quote osx scripts

Properly quote osx fetch_chromium

Properly quote osx build_blink

* Revert line deletion
  • Loading branch information
BlueDrink9 authored Aug 21, 2024
1 parent 056642f commit 956bfb3
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 15 deletions.
2 changes: 1 addition & 1 deletion repos/linux_scripts/build_kaleido
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export KALEIDO_ARCH=$1
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

# cd to the top-level project directory
cd $DIR/../..
cd "$DIR/../.."

# Update version based on git tags
python ./repos/version/build_pep440_version.py
Expand Down
6 changes: 3 additions & 3 deletions repos/linux_scripts/fetch_chromium
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

# cd to the top-level project directory
cd $DIR/../..
cd "$DIR/../.."
echo `pwd`

# Download chromium
docker run -it -v `pwd`/repos/:/repos jonmmease/chromium-builder:0.9 /repos/linux_scripts/fetch_chromium_docker
docker run -it -v "`pwd`/repos/:/repos" jonmmease/chromium-builder:0.9 /repos/linux_scripts/fetch_chromium_docker

# Checkout revision
docker run -it -v `pwd`/repos/:/repos jonmmease/chromium-builder:0.9 /repos/linux_scripts/checkout_revision_docker
docker run -it -v "`pwd`/repos/:/repos" jonmmease/chromium-builder:0.9 /repos/linux_scripts/checkout_revision_docker
10 changes: 5 additions & 5 deletions repos/linux_scripts/launch_script
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

export LD_LIBRARY_PATH=$DIR/lib:$LD_LIBRARY_PATH
export FONTCONFIG_PATH=$DIR/etc/fonts
export XDG_DATA_HOME=$DIR/xdg
export LD_LIBRARY_PATH="$DIR/lib:$LD_LIBRARY_PATH"
export FONTCONFIG_PATH="$DIR/etc/fonts"
export XDG_DATA_HOME="$DIR/xdg"
unset LD_PRELOAD

cd $DIR
./bin/kaleido $@
cd "$DIR"
./bin/kaleido "$@"
4 changes: 2 additions & 2 deletions repos/linux_scripts/minimal_launch_script
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
unset LD_PRELOAD

cd $DIR
./bin/kaleido --no-sandbox --allow-file-access-from-files --disable-breakpad $@
cd "$DIR"
./bin/kaleido --no-sandbox --allow-file-access-from-files --disable-breakpad "$@"
12 changes: 11 additions & 1 deletion repos/mac_scripts/build_blink
Original file line number Diff line number Diff line change
@@ -1,33 +1,43 @@
#!/bin/bash


if [ $# -eq 0 ]; then
echo "No architecture provided"
exit 1
fi


export KALEIDO_ARCH=$1


# Don't autoupdate depottools version
export DEPOT_TOOLS_UPDATE=0


# full path to mac_scripts/ directory
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"


# cd to repos directory
cd $DIR/..
cd "$DIR/.."


# Add depot_tools directory to PATH
export PATH="$PATH:`pwd`/depot_tools"


# Make output directory
mkdir -p ./src/out/Kaleido_mac_$KALEIDO_ARCH/


# Write out/Kaleido_mac_$KALEIDO_ARCH/args.gn
cp ./mac_scripts/args_$KALEIDO_ARCH.gn ./src/out/Kaleido_mac_$KALEIDO_ARCH/args.gn


# cd to repos/src
cd src


# 4) Perform build, result will be out/Kaleido_mac_$KALEIDO_ARCH/kaleido
gn gen out/Kaleido_mac_$KALEIDO_ARCH
ninja -C out/Kaleido_mac_$KALEIDO_ARCH -j 8 gl_blink
20 changes: 18 additions & 2 deletions repos/mac_scripts/build_kaleido
Original file line number Diff line number Diff line change
@@ -1,63 +1,80 @@
#!/bin/bash


if [ $# -eq 0 ]; then
echo "No architecture provided"
exit 1
fi


export KALEIDO_ARCH=$1


# Don't autoupdate depottools version
export DEPOT_TOOLS_UPDATE=0


# full path to mac_scripts/ directory
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"


# cd to repos directory
cd $DIR/..
cd "$DIR/.."


# Update version based on git tag
python3 ./version/build_pep440_version.py


# Copy README and LICENSE to kaleido (For consistency with Linux docker build process)
cp ../README.md ./kaleido/
cp ../LICENSE.txt ./kaleido/
cp ./CREDITS.html ./kaleido/


# Add depot_tools directory to PATH
export PATH="$PATH:`pwd`/depot_tools"


# Make output directory
mkdir -p ./src/out/Kaleido_mac_$KALEIDO_ARCH/


# Write out/Kaleido_mac_$KALEIDO_ARCH/args.gn
cp ./mac_scripts/args_$KALEIDO_ARCH.gn ./src/out/Kaleido_mac_$KALEIDO_ARCH/args.gn


# cd to repos/src
cd src


# 1) Reset headless/BUILD.gn
git checkout HEAD -- headless/BUILD.gn


# 2) Append kaleido section to headless build file (src/headless/BUILD.gn)
echo "
executable(\"kaleido\") {
sources = [ \"app/kaleido.cc\" ]
deps = [
\":headless_shell_lib\",
\"//skia\", # we need this to override font render hinting in headless build
]
}" >> headless/BUILD.gn


# 3) Copy kaleido/kaleido.cc to src/headless/app/kaleido.cc
rm -rf headless/app/plugins
cp -r ../kaleido/cc/* headless/app/


# 4) Perform build, result will be out/Kaleido_mac_$KALEIDO_ARCH/kaleido
gn gen out/Kaleido_mac_$KALEIDO_ARCH
ninja -C out/Kaleido_mac_$KALEIDO_ARCH -j 8 kaleido


if [ ! -f "out/Kaleido_mac_$KALEIDO_ARCH/kaleido" ]
then
echo "Error: Kaleido executable was not built";
Expand Down Expand Up @@ -86,7 +103,6 @@ cp ./out/Kaleido_mac_$KALEIDO_ARCH/libEGL*.dylib ../build/kaleido/bin
# launch script
echo "#!/bin/bash
DIR=\"\$( cd \"\$( dirname \"\${BASH_SOURCE[0]}\" )\" >/dev/null 2>&1 && pwd )\"
cd \$DIR
./bin/kaleido \$@
" > ../build/kaleido/kaleido
Expand Down
11 changes: 10 additions & 1 deletion repos/mac_scripts/fetch_chromium
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
#!/bin/bash


# Commits
DEPOT_TOOLS_COMMIT="" # Can't set a version for Windows, maybe we can for make depending on TODO below, probably won't
CHROMIUM_TAG="124.0.6367.60"
export DEPOT_TOOLS_UPDATE=0 # TODO: Don't know if this will work on Mac


# full path to mac_scripts/ directory
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"


# cd to repos directory
cd $DIR/..
cd "$DIR/.."


# Get depot_tools
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
cd depot_tools


# Add cloned depot_tools directory to PATH
export PATH="$PATH:`pwd`"


# Reset to proper commit
git reset --hard $DEPOT_TOOLS_COMMIT
git clean -ffd


# Move back to repos directory
cd ../src


gclient sync -D --force --reset --no-history --jobs=3 --revision=$CHROMIUM_TAG


# Write out credits file
cd ..
python ./src/tools/licenses.py credits > ./CREDITS.html

0 comments on commit 956bfb3

Please sign in to comment.