-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This was definitely done first try in one commit
- Loading branch information
1 parent
97566f7
commit 87d3cdd
Showing
6 changed files
with
77 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,55 @@ | ||
#!/bin/bash | ||
set -e | ||
set -ex | ||
|
||
# nested so the next step can zip up name-needed/name-needed non-recursively and end up with a nice name-needed/$FILES structure | ||
DIR=name-needed/name-needed | ||
mkdir -p $DIR | ||
SUFFIX="$1" | ||
PLATFORM="$2" | ||
|
||
# ensure suffix is passed if needed e.g. ".exe" | ||
cargo build --release --bin main | ||
mv -v "target/release/main$1" $DIR/name-needed$1 | ||
# TODO declare sdl version somewhere else | ||
SDL_VERSION="2.0.14" | ||
|
||
# make it executable | ||
if [ -x "$(command -v chmod)" ]; then | ||
chmod +x $DIR/name-needed$1 | ||
# declare output first via stdout to actions | ||
if [[ "$PLATFORM" == "linux" ]]; then | ||
TARGET=nn-linux.tar.gz | ||
elif [[ "$PLATFORM" == "windows" ]]; then | ||
TARGET=nn-windows.zip | ||
else | ||
exit 1 | ||
fi | ||
echo $TARGET | ||
|
||
if [[ "$PLATFORM" == "linux" ]]; then | ||
SDL_FILE="SDL2-$SDL_VERSION" | ||
wget "https://www.libsdl.org/release/$SDL_FILE.zip" | ||
unzip $SDL_FILE.zip | ||
|
||
pushd $SDL_FILE | ||
./configure | ||
make -j$(nproc) | ||
sudo make install | ||
popd | ||
elif [[ "$PLATFORM" == "windows" ]]; then | ||
SDL_ZIP="SDL2-devel-$SDL_VERSION-VC.zip" | ||
python .build/download-and-unzip.py "https://www.libsdl.org/release/$SDL_ZIP" | ||
|
||
SDL_LIBS="SDL2-$SDL_VERSION/lib/x64" | ||
find $SDL_LIBS -iname '*.lib' -exec cp -v {} "/c/Users/$USERNAME/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/x86_64-pc-windows-msvc/lib" \; | ||
find $SDL_LIBS -iname '*.dll' -exec cp -v {} ./renderer/engine/ \; | ||
fi | ||
|
||
DIR=name-needed | ||
mkdir -p $DIR | ||
|
||
cargo build --release --bin main | ||
mv -v "target/release/main$SUFFIX" $DIR/name-needed$SUFFIX | ||
|
||
mv -v README.md LICENSE resources $DIR | ||
rm -f $DIR/resources/ci_test.ron | ||
rm -f $DIR/resources/ci_test.ron | ||
|
||
# package up | ||
if [[ "$PLATFORM" == "linux" ]]; then | ||
tar czf $TARGET name-needed | ||
elif [[ "$PLATFORM" == "windows" ]]; then | ||
find ./renderer/engine -iname '*.dll' -exec cp -v {} name-needed \; | ||
|
||
7z a $TARGET name-needed | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import urllib.request, zipfile, sys | ||
resp = urllib.request.urlopen(sys.argv[1]) | ||
with open("sdl-devel.zip", "wb") as f: | ||
f.write(resp.read()) | ||
with zipfile.ZipFile("sdl-devel.zip") as z: | ||
z.extractall(path=".") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters