Skip to content

Commit e142711

Browse files
authored
build/AddOns, appimage fix, version backport, manifest output (#553)
* Add AddOns to debug builds of AppImage Make Addons in build/AddOns instead of project root Updated NSIS to look in build/AddOns Version fixes backported from prod Output manifest if packageinfo passed in Linux
1 parent 55a7caf commit e142711

File tree

16 files changed

+234
-153
lines changed

16 files changed

+234
-153
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ obj.spk
2828
obj.win.spk
2929
obj.spk.dbg
3030
obj.win.spk.dbg
31-
AddOns/
3231
tools/icosmesh/obj
3332
doxygen/
3433
libobjc2/

GNUmakefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,9 @@ endif
104104

105105
# add specific flags if building modern
106106
ifeq ($(modern),yes)
107-
ADDITIONAL_CFLAGS += -DOOLITE_MODERN_BUILD=1
108-
ADDITIONAL_OBJCFLAGS += -DOOLITE_MODERN_BUILD=1
107+
VER_FULL := $(shell ./ShellScripts/common/get_version.sh)
108+
ADDITIONAL_CFLAGS += -DOOLITE_MODERN_BUILD=1 -DOO_VERSION_FULL=\"$(VER_FULL)\"
109+
ADDITIONAL_OBJCFLAGS += -DOOLITE_MODERN_BUILD=1 -DOO_VERSION_FULL=\"$(VER_FULL)\"
109110
# link time optimizations
110111
ifeq ($(lto),yes)
111112
ADDITIONAL_CFLAGS += -flto

GNUmakefile.postamble

Lines changed: 16 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,24 @@
1-
# Oolite-linux
21
# GNUmakefile.postamble: Runs after-compilation scripts.
3-
# These copy all the base data files into where oolite expects them
4-
# to live (Contents/Resources)
2+
# These copy all the base data files to where Oolite expects them
53
#
6-
CP_FLAGS = -rf
74

8-
ifeq ($(debug),yes)
9-
EXT =.dbg
10-
endif
11-
12-
ifeq ($(findstring -gnu,$(GNUSTEP_HOST_OS)),-gnu)
13-
CP_FLAGS += -u
14-
endif
15-
16-
ifeq ($(GNUSTEP_HOST_OS),mingw32)
17-
OS_EXT = .exe
18-
CP_FLAGS += -u
19-
endif
20-
21-
SRC_BIN = $(OBJC_PROGRAM_NAME)$(OS_EXT)
22-
DEST_BIN = $(OBJC_PROGRAM_NAME)$(EXT)$(OS_EXT)
23-
24-
MKMANIFEST=tools/mkmanifest.sh
25-
26-
PROGDIR=$(OBJC_PROGRAM_NAME).app
5+
POST_BUILD_ENV = \
6+
OBJC_PROGRAM_NAME="$(OBJC_PROGRAM_NAME)" \
7+
GNUSTEP_OBJ_DIR_NAME="$(GNUSTEP_OBJ_DIR_NAME)" \
8+
GNUSTEP_HOST_OS="$(GNUSTEP_HOST_OS)" \
9+
GNUSTEP_HOST_CPU="$(GNUSTEP_HOST_CPU)" \
10+
MINGW_PREFIX="$(MINGW_PREFIX)" \
11+
DEBUG="$(debug)" \
12+
DEPLOYMENT_RELEASE_CONFIGURATION="$(DEPLOYMENT_RELEASE_CONFIGURATION)" \
13+
MODERN="$(modern)" \
14+
ESPEAK="$(ESPEAK)" \
15+
USE_DEPS="$(use_deps)" \
16+
STRIP_BIN="$(strip)" \
17+
STRIP="$(STRIP)" \
18+
VER_FULL="$(VER_FULL)"
2719

2820
after-all::
29-
$(MKDIRS) $(PROGDIR)
30-
$(MKDIRS) $(PROGDIR)/Resources
31-
$(MKMANIFEST) > $(PROGDIR)/Resources/manifest.plist
32-
$(CP) $(CP_FLAGS) Resources/README.TXT $(PROGDIR)/Resources
33-
$(CP) $(CP_FLAGS) Resources/InfoPlist.strings $(PROGDIR)/Resources
34-
$(CP) $(CP_FLAGS) Resources/AIs $(PROGDIR)/Resources
35-
$(CP) $(CP_FLAGS) Resources/Config $(PROGDIR)/Resources
36-
$(CP) $(CP_FLAGS) Resources/Scenarios $(PROGDIR)/Resources
37-
$(CP) $(CP_FLAGS) Resources/Scripts $(PROGDIR)/Resources
38-
$(CP) $(CP_FLAGS) Resources/Shaders $(PROGDIR)/Resources
39-
$(CP) $(CP_FLAGS) Resources/Binary/Images $(PROGDIR)/Resources
40-
$(CP) $(CP_FLAGS) Resources/Binary/Models $(PROGDIR)/Resources
41-
$(CP) $(CP_FLAGS) Resources/Binary/Music $(PROGDIR)/Resources
42-
$(CP) $(CP_FLAGS) Resources/Binary/Sounds $(PROGDIR)/Resources
43-
$(CP) $(CP_FLAGS) Resources/Binary/Textures $(PROGDIR)/Resources
44-
$(CP) $(CP_FLAGS) Schemata $(PROGDIR)/Resources
45-
$(CP) $(CP_FLAGS) src/Cocoa/Info-Oolite.plist $(PROGDIR)/Resources/Info-gnustep.plist
46-
$(CP) $(CP_FLAGS) $(GNUSTEP_OBJ_DIR_NAME)/$(SRC_BIN) $(PROGDIR)/$(DEST_BIN)
47-
ifeq ($(ESPEAK),yes)
48-
ifeq ($(modern),yes)
49-
ifeq ($(GNUSTEP_HOST_OS),mingw32)
50-
$(CP) $(CP_FLAGS) $(MINGW_PREFIX)/share/espeak-ng-data $(PROGDIR)/Resources
51-
else
52-
ifeq ($(wildcard /usr/local/share/espeak-ng-data),)
53-
ifeq ($(wildcard /usr/lib/x86_64-linux-gnu/espeak-ng-data),)
54-
ifeq ($(wildcard /usr/share/espeak-ng-data),)
55-
ifeq ($(wildcard /app/share/espeak-ng-data),)
56-
$(error espeak-ng-data not found in any known location)
57-
else
58-
$(CP) $(CP_FLAGS) /app/share/espeak-ng-data $(PROGDIR)/Resources
59-
endif
60-
else
61-
$(CP) $(CP_FLAGS) /usr/share/espeak-ng-data $(PROGDIR)/Resources
62-
endif
63-
else
64-
$(CP) $(CP_FLAGS) /usr/lib/x86_64-linux-gnu/espeak-ng-data $(PROGDIR)/Resources
65-
endif
66-
else
67-
$(CP) $(CP_FLAGS) /usr/local/share/espeak-ng-data $(PROGDIR)/Resources
68-
endif
69-
endif
70-
71-
# replace f2 voice and set the default voice as well
72-
$(RM) $(PROGDIR)/Resources/espeak-ng-data/voices/default
73-
$(RM) $(PROGDIR)/Resources/espeak-ng-data/voices/!v/f2
74-
# copy required files from the existing cross-platform-deps repo
75-
$(CP) $(CP_FLAGS) deps/Cross-platform-deps/espeak-data/voices/!v/f2 $(PROGDIR)/Resources/espeak-ng-data/voices/!v/f2
76-
$(CP) $(CP_FLAGS) deps/Cross-platform-deps/espeak-data/voices/default $(PROGDIR)/Resources/espeak-ng-data/voices/default
77-
else
78-
ifeq ($(GNUSTEP_HOST_OS),mingw32)
79-
$(CP) $(CP_FLAGS) deps/Cross-platform-deps/espeak-data $(PROGDIR)/Resources
80-
else
81-
ifeq ($(use_deps),yes)
82-
$(CP) $(CP_FLAGS) deps/Cross-platform-deps/espeak-data $(PROGDIR)/Resources
83-
endif
84-
endif
85-
endif
86-
endif
87-
ifeq ($(strip),yes)
88-
$(STRIP) $(PROGDIR)/$(DEST_BIN)
89-
endif
90-
ifeq ($(GNUSTEP_HOST_OS),mingw32)
91-
ifeq ($(modern),yes)
92-
ldd $(PROGDIR)/$(DEST_BIN) | grep $(MINGW_PREFIX) | awk '{print $$3}' | xargs -I {} $(CP) $(CP_FLAGS) {} $(PROGDIR)
93-
else
94-
ifeq ($(GNUSTEP_HOST_CPU),x86_64)
95-
$(CP) $(CP_FLAGS) deps/Windows-deps/x86_64/DLLs/*.dll $(PROGDIR)
96-
else
97-
$(CP) $(CP_FLAGS) deps/Windows-deps/x86/DLLs/*.dll $(PROGDIR)
98-
endif
99-
ifeq ($(debug),no)
100-
$(RM) $(PROGDIR)/js32ECMAv5dbg.dll
101-
endif
102-
$(RM) $(PROGDIR)/js32ECMAv5.dll
103-
endif
104-
else
105-
$(CP) $(CP_FLAGS) ShellScripts/Linux/run_oolite.sh $(PROGDIR)
106-
endif
21+
@$(POST_BUILD_ENV) ShellScripts/common/post_build.sh
10722

10823
after-clean::
10924
$(RM) -rf $(GNUSTEP_OBJ_DIR_BASENAME) $(addprefix $(GNUSTEP_OBJ_DIR_BASENAME), .spk .dbg .spk.dbg)

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,27 @@ help:
3333
.PHONY: release
3434
release:
3535
$(MAKE) -f GNUmakefile debug=no strip=yes lto=yes
36-
mkdir -p AddOns && rm -rf AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp AddOns/Basic-debug.oxp
36+
mkdir -p build/AddOns && rm -rf build/AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp build/AddOns/Basic-debug.oxp
3737

3838
.PHONY: release-deployment
3939
release-deployment:
4040
$(MAKE) -f GNUmakefile DEPLOYMENT_RELEASE_CONFIGURATION=yes debug=no strip=yes lto=yes
4141

4242
.PHONY: release-snapshot
4343
release-snapshot:
44-
$(MAKE) -f GNUmakefile SNAPSHOT_BUILD=yes VERSION_STRING=$(VER) debug=no
45-
mkdir -p AddOns && rm -rf AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp AddOns/Basic-debug.oxp
44+
$(MAKE) -f GNUmakefile SNAPSHOT_BUILD=yes debug=no
45+
mkdir -p build/AddOns && rm -rf build/AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp build/AddOns/Basic-debug.oxp
4646

4747
.PHONY: debug
4848
debug:
4949
$(MAKE) -f GNUmakefile debug=yes strip=no
50-
mkdir -p AddOns && rm -rf AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp AddOns/Basic-debug.oxp
50+
mkdir -p build/AddOns && rm -rf build/AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp build/AddOns/Basic-debug.oxp
5151

5252
.PHONY: clean
5353
clean:
5454
$(MAKE) -f GNUmakefile clean
5555
$(RM) -rf oolite.app
56-
$(RM) -rf AddOns
56+
$(RM) -rf build/AddOns
5757

5858
.PHONY: all
5959
all: release release-deployment release-snapshot debug

ShellScripts/Linux/run_oolite.sh

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
22

3+
4+
HERE="$(dirname "$(readlink -f "$0")")"
5+
36
notify_failure() {
47
if [[ -n "$FLATPAK_ID" ]]; then
58
local MSG="<b>$FLATPAK_ID failed to start!</b>\n\nExit Code: $EXIT_CODE"
@@ -43,7 +46,6 @@ launch_guarded() {
4346

4447
find_exe_launch() {
4548
if [[ -z "$OO_EXECUTABLE" ]]; then
46-
HERE="$(dirname "$(readlink -f "$0")")"
4749
OO_EXECUTABLE="$HERE/oolite"
4850
if [[ ! -f "$OO_EXECUTABLE" ]]; then
4951
OO_EXECUTABLE="$HERE/oolite.app/oolite"
@@ -54,16 +56,31 @@ find_exe_launch() {
5456

5557
# Check if we are running inside a Flatpak
5658
if [[ -n "$FLATPAK_ID" ]]; then
59+
if [[ "$1" == "packageinfo" ]]; then
60+
cat "/app/bin/Resources/manifest.plist"
61+
exit 0
62+
fi
63+
5764
GAME_DATA="$HOME/.var/app/$FLATPAK_ID"
5865
OO_EXECUTABLE="/app/bin/oolite"
5966

6067
# Check if we are running inside an AppImage
6168
elif [[ -n "$APPIMAGE" ]]; then
62-
# Get the folder where AppRun is in the AppImage
63-
HERE="$(dirname "$(readlink -f "${0}")")"
64-
export LD_LIBRARY_PATH="$HERE/usr/lib:$LD_LIBRARY_PATH"
65-
export PATH="$HERE/usr/bin:$PATH"
66-
OO_EXECUTABLE="$HERE/usr/bin/oolite"
69+
MANIFEST="$APPDIR/usr/bin/Resources/manifest.plist"
70+
if [[ "$1" == "packageinfo" ]]; then
71+
cat "$MANIFEST"
72+
exit 0
73+
fi
74+
75+
export LD_LIBRARY_PATH="$APPDIR/usr/lib:$LD_LIBRARY_PATH"
76+
export PATH="$APPDIR/usr/bin:$PATH"
77+
OO_EXECUTABLE="$APPDIR/usr/bin/oolite"
78+
79+
DEBUG_OXP=$(grep "debug_functionality_support" "$MANIFEST")
80+
if [[ "$DEBUG_OXP" == *"yes"* ]]; then
81+
INTERNAL_ADDONS="$APPDIR/usr/bin/AddOns"
82+
export OO_ADDITIONALADDONSDIRS="${OO_ADDITIONALADDONSDIRS}${OO_ADDITIONALADDONSDIRS:+,}$INTERNAL_ADDONS"
83+
fi
6784

6885
if [[ -n "$OO_DIRTYPE" ]]; then
6986
if [[ "${OO_DIRTYPE,,}" == "xdg" ]]; then
@@ -76,18 +93,27 @@ elif [[ -n "$APPIMAGE" ]]; then
7693
HERE="$(dirname "$APPIMAGE")"
7794
GAME_DATA="$HERE/GameData"
7895
fi
96+
else
97+
if [[ "$1" == "packageinfo" ]]; then
98+
if [ -f "$HERE/Resources/manifest.plist" ]; then
99+
cat "$HERE/Resources/manifest.plist"
100+
else
101+
cat "$HERE/oolite.app/Resources/manifest.plist"
102+
fi
103+
exit 0
104+
fi
79105

80-
# Check if OO_DIRTYPE set
81-
elif [[ -n "$OO_DIRTYPE" ]]; then
82-
if [[ "${OO_DIRTYPE,,}" == "xdg" ]]; then
83-
GAME_DATA="$HOME/.local/share/Oolite"
84-
elif [[ "${OO_DIRTYPE,,}" == "legacy" ]]; then
85-
find_exe_launch "$@"
106+
# Check if OO_DIRTYPE set
107+
if [[ -n "$OO_DIRTYPE" ]]; then
108+
if [[ "${OO_DIRTYPE,,}" == "xdg" ]]; then
109+
GAME_DATA="$HOME/.local/share/Oolite"
110+
elif [[ "${OO_DIRTYPE,,}" == "legacy" ]]; then
111+
find_exe_launch "$@"
112+
fi
113+
else
114+
# Use script directory
115+
GAME_DATA="$HERE/GameData"
86116
fi
87-
else
88-
# Use script directory
89-
HERE="$(dirname "$(readlink -f "$0")")"
90-
GAME_DATA="$HERE/GameData"
91117
fi
92118

93119
mkdir -p "$GAME_DATA"

ShellScripts/common/get_version.sh

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
4-
pushd "$SCRIPT_DIR"
4+
pushd "$SCRIPT_DIR" > /dev/null
55

66
mkdir -p ../../build
77
cd ../../build
@@ -16,21 +16,12 @@ fi
1616
VER_DATE=$(date +%y%m%d)
1717
VER_GITREV=$(git rev-list --count HEAD)
1818
VER_GITHASH=$(git rev-parse --short=7 HEAD)
19-
VER="$VER_MAJ.$VER_MIN.$VER_REV.$VER_GITREV-$VER_DATE-$VER_GITHASH"
19+
VER_FULL="$VER_MAJ.$VER_MIN.$VER_REV.$VER_GITREV-$VER_DATE-$VER_GITHASH"
2020
BUILDTIME=$(date "+%Y.%m.%d %H:%M")
2121

2222

23-
echo "OOLITE_VERSION=$VER" >> OOLITE_VERSION.txt
24-
cat OOLITE_VERSION.txt
23+
echo "OOLITE_VERSION=$VER_FULL" > OOLITE_VERSION.txt
2524

26-
echo "VERSION=$VERSION" > version.mk
27-
echo "VER_MAJ=$VER_MAJ" >> version.mk
28-
echo "VER_MIN=$VER_MIN" >> version.mk
29-
echo "VER_REV=$VER_REV" >> version.mk
30-
echo "VER_DATE=$VER_DATE" >> version.mk
31-
echo "VER_GITREV=$VER_GITREV" >> version.mk
32-
echo "VER_GITHASH=$VER_GITHASH" >> version.mk
33-
echo "VER=$VER" >> version.mk
34-
echo "BUILDTIME=$BUILDTIME" >> version.mk
25+
echo "$VER_FULL"
3526

36-
popd
27+
popd > /dev/null

0 commit comments

Comments
 (0)