put the linux packaging logic in the makefile

use 'make package' to create 4coder_alpha.zip and 4coder_super.zip
This commit is contained in:
insofaras 2016-06-28 23:58:45 +01:00
parent 07e3e089ab
commit ffa26b5940
2 changed files with 38 additions and 146 deletions

View File

@ -4,6 +4,8 @@ WARNINGS := -Wno-write-strings
PLAT_LINKS := -L/usr/local/lib -lX11 -lpthread -lm -lrt -lGL -ldl -lXfixes -lfreetype -lfontconfig PLAT_LINKS := -L/usr/local/lib -lX11 -lpthread -lm -lrt -lGL -ldl -lXfixes -lfreetype -lfontconfig
FLAGS := -fPIC -fno-threadsafe-statics -pthread -I../foreign $(shell pkg-config --cflags freetype2) FLAGS := -fPIC -fno-threadsafe-statics -pthread -I../foreign $(shell pkg-config --cflags freetype2)
# main stuff
debug: FLAGS += -DFRED_INTERNAL=1 -DFRED_SUPER=1 -g -O0 debug: FLAGS += -DFRED_INTERNAL=1 -DFRED_SUPER=1 -g -O0
debug: ../4ed_app.so ../4ed debug: ../4ed_app.so ../4ed
@ -14,22 +16,44 @@ debug: ../4ed_app.so ../4ed
g++ $(WARNINGS) $(FLAGS) linux_4ed.cpp -iquoteforeign $(PLAT_LINKS) -o $@ g++ $(WARNINGS) $(FLAGS) linux_4ed.cpp -iquoteforeign $(PLAT_LINKS) -o $@
clean: clean:
$(RM) -f ../4ed_app.so ../4ed $(RM) ../4ed_app.so ../4ed
release: FLAGS += -U_FORTIFY_SOURCE -fno-stack-protector -Wl,--wrap=memcpy linux_release_compat.c -Wl,-s # releases
release: ../4ed_app.so ../4ed
alpha: FLAGS += -U_FORTIFY_SOURCE -fno-stack-protector -Wl,--wrap=memcpy linux_release_compat.c -Wl,-s
alpha: ../4ed_app.so ../4ed
strip -R .comment $^ strip -R .comment $^
release32: FLAGS += -U_FORTIFY_SOURCE -fno-stack-protector -Wl,-s -m32 alpha32: FLAGS += -U_FORTIFY_SOURCE -fno-stack-protector -Wl,-s -m32
release32: ../4ed_app.so ../4ed alpha32: ../4ed_app.so ../4ed
strip -R .comment $^ strip -R .comment $^
release_super: FLAGS += -D FRED_SUPER super: FLAGS += -DFRED_SUPER=1
release_super: release super: alpha
release32_super: FLAGS += -D FRED_SUPER super32: FLAGS += -DFRED_SUPER=1
release32_super: release32 super32: alpha32
.PHONY: debug clean release release32 release_super release32_super # packaging
PACKAGE_FILES := ../4ed ../4ed_app.so README.txt TODO.txt
../4coder_super.zip: PACKAGE_FILES += 4coder_*.h 4coder_*.cpp buildsuper.sh SUPERREADME.txt
../4coder_super32.zip: PACKAGE_FILES += 4coder_*.h 4coder_*.cpp buildsuper.sh SUPERREADME.txt
../4coder_%.zip: %
zip -j $@ $(PACKAGE_FILES)
(cd ../release_template && zip -g -r $@ .)
$(MAKE) clean
package: clean
@echo -e "\e[1;32m ==== Creating Alpha package ==== \e[0m"
$(MAKE) ../4coder_alpha.zip
@echo -e "\e[1;32m ==== Creating Super package ==== \e[0m"
$(MAKE) ../4coder_super.zip
# $(MAKE) ../4coder_alpha32.zip
# $(MAKE) ../4coder_super32.zip
.PHONY: debug alpha alpha32 super super32 package clean

View File

@ -1,132 +0,0 @@
#!/bin/bash
#!/bin/sh
# Linux packaging script by insofaras
#
# Usage:
#
# * Put all the .txt, .ttf, etc stuff in TEMPLATE_DIR and it'll get copied over
# (including the 3rd party folder)
#
# * Put the makefile (included at the end of this file) in the dir above 4coder/code
#
# * Change the other dir variables as appropriate
#
TEMPLATE_DIR="$HOME/Desktop/4coder/release_template/"
CODE_DIR="$HOME/Desktop/4coder"
TMP_DIR="/tmp/4coder"
OUT_ZIP="$HOME/Desktop/4coder-linux-64.zip"
OUT_ZIP_32="$HOME/Desktop/4coder-linux-32.zip"
OUT_ZIP_SUPER="$HOME/Desktop/4coder-linux-super-64.zip"
OUT_ZIP_SUPER_32="$HOME/Desktop/4coder-linux-super-32.zip"
echo "template: $TEMPLATE_DIR"
echo "base: $CODE_DIR"
echo "temp: $TMP_DIR"
echo "out: $OUT_ZIP"
rm -rf "$OUT_ZIP"
rm -rf "$OUT_ZIP_SUPER"
rm -rf "$OUT_ZIP_32"
rm -rf "$OUT_ZIP_SUPER_32"
mkdir -p "$TMP_DIR"
pushd "$CODE_DIR"
echo "Alpha User"
# ALPHA-32
pushd "$CODE_DIR/code"
make clean
make release32
popd
cp -r "${TEMPLATE_DIR}" "$TMP_DIR/alpha"
cp ./4ed ./4ed_app.so "$TMP_DIR/alpha/"
cp ./code/README.txt ./code/TODO.txt "$TMP_DIR/alpha/"
echo " "
pushd "$TMP_DIR"
zip -r "$OUT_ZIP_32" "$(basename alpha)"
popd
rm -rf "$TMP_DIR/alpha"
echo " "
# ALPHA-64
pushd "$CODE_DIR/code"
make clean
make release
popd
cp -r "${TEMPLATE_DIR}" "$TMP_DIR/alpha"
cp ./4ed ./4ed_app.so "$TMP_DIR/alpha/"
cp ./code/README.txt ./code/TODO.txt "$TMP_DIR/alpha/"
echo " "
pushd "$TMP_DIR"
zip -r "$OUT_ZIP" "$(basename alpha)"
popd
rm -rf "$TMP_DIR/alpha"
echo " "
echo "Super User"
# SUPER-32
pushd "$CODE_DIR/code"
make clean
make release32_super
popd
cp ./4ed ./4ed_app.so ./code/4coder_*.h ./code/4coder_*.cpp "$TMP_DIR/super/"
cp ./code/buildsuper.sh "$TMP_DIR/super/"
cp ./code/README.txt ./code/SUPERREADME.txt ./code/TODO.txt "$TMP_DIR/super/"
cp ./code/*.html "$TMP_DIR/super/"
echo " "
pushd "$TMP_DIR"
zip -r "$OUT_ZIP_SUPER_32" "$(basename super)"
popd
rm -rf "$TMP_DIR/super"
echo " "
# SUPER-64
pushd "$CODE_DIR/code"
make clean
make release_super
popd
cp -r "${TEMPLATE_DIR}" "$TMP_DIR/super/"
cp ./4ed ./4ed_app.so ./code/4coder_*.h ./code/4coder_*.cpp "$TMP_DIR/super/"
cp ./code/buildsuper.sh "$TMP_DIR/super/"
cp ./code/README.txt ./code/SUPERREADME.txt ./code/TODO.txt "$TMP_DIR/super/"
cp ./code/*.html "$TMP_DIR/super/"
echo " "
pushd "$TMP_DIR"
zip -r "$OUT_ZIP_SUPER" "$(basename super)"
popd
rm -rf "$TMP_DIR/super"
echo " "
make clean
rm -rf "$TMP_DIR"
popd
echo "Created linux 4coder packages"
exit