From ffa26b5940b579cde447bf4e883986edfc6d8a36 Mon Sep 17 00:00:00 2001 From: insofaras Date: Tue, 28 Jun 2016 23:58:45 +0100 Subject: [PATCH] put the linux packaging logic in the makefile use 'make package' to create 4coder_alpha.zip and 4coder_super.zip --- Makefile | 52 +++++++++++++++------ package.sh | 132 ----------------------------------------------------- 2 files changed, 38 insertions(+), 146 deletions(-) delete mode 100755 package.sh diff --git a/Makefile b/Makefile index 9d356f35..5d5680f6 100755 --- a/Makefile +++ b/Makefile @@ -1,8 +1,10 @@ -CPP_FILES := $(wildcard *.cpp) $(wildcard **/*.cpp) -H_FILES := $(wildcard *.h) $(wildcard **/*.h) -WARNINGS := -Wno-write-strings +CPP_FILES := $(wildcard *.cpp) $(wildcard **/*.cpp) +H_FILES := $(wildcard *.h) $(wildcard **/*.h) +WARNINGS := -Wno-write-strings 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: ../4ed_app.so ../4ed @@ -14,22 +16,44 @@ debug: ../4ed_app.so ../4ed g++ $(WARNINGS) $(FLAGS) linux_4ed.cpp -iquoteforeign $(PLAT_LINKS) -o $@ 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 -release: ../4ed_app.so ../4ed +# releases + +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 $^ -release32: FLAGS += -U_FORTIFY_SOURCE -fno-stack-protector -Wl,-s -m32 -release32: ../4ed_app.so ../4ed +alpha32: FLAGS += -U_FORTIFY_SOURCE -fno-stack-protector -Wl,-s -m32 +alpha32: ../4ed_app.so ../4ed strip -R .comment $^ -release_super: FLAGS += -D FRED_SUPER -release_super: release +super: FLAGS += -DFRED_SUPER=1 +super: alpha -release32_super: FLAGS += -D FRED_SUPER -release32_super: release32 +super32: FLAGS += -DFRED_SUPER=1 +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 diff --git a/package.sh b/package.sh deleted file mode 100755 index 48718b1f..00000000 --- a/package.sh +++ /dev/null @@ -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 -