Create Resources directory dynamically at compile time

The 'Resources' directory is used in macOS development to test the binary
without building TuxPaint.app bundle, which is helpful for rapid application
development since creating the app bundle takes a long time.

It's been reported that the symlink in the Resources directory was causing the
'release' target to copy the files in the 'data' directory twice into the
source release tarball.

This change removes the static Resources directory but creates it dynamically
when the 'tuxpaint' target is built and removes it via 'clean' target so the
'release' target does not copy the files in the 'data' directory into the
source release tarball twice.
This commit is contained in:
Mark Kim 2020-12-27 23:12:46 -05:00
parent e3356eb4d8
commit 4019f8b963
3 changed files with 5 additions and 26 deletions

View file

@ -83,6 +83,9 @@ RSRC_CMD:=$($(OS)_RSRC_CMD)
beos_MIMESET_CMD:=mimeset -f tuxpaint
MIMESET_CMD:=$($(OS)_MIMESET_CMD)
macos_RAD_CMD:=[[ ! -d Resources/share ]] && mkdir -p Resources/share && ln -s ../../data Resources/share/tuxpaint || :
RAD_CMD:=$($(OS)_RAD_CMD)
windows_SO_TYPE:=dll
macos_SO_TYPE:=dylib
beos_SO_TYPE:=so
@ -607,7 +610,7 @@ clean:
@-rm -f templates/.thumbs/*.png
@if [ -d templates/.thumbs ]; then rmdir templates/.thumbs; fi
@-if [ "x$(BUNDLE)" != "x" ]; then rm -rf $(BUNDLE); fi
@-rm -f TuxPaint.dmg temp.dmg; rm -rf magic/*.dSYM
@-rm -f TuxPaint.dmg temp.dmg; rm -rf magic/*.dSYM Resources
@echo
# "make uninstall" should remove the various parts from their
@ -1052,6 +1055,7 @@ tuxpaint: obj/tuxpaint.o obj/i18n.o obj/im.o obj/cursor.o obj/pixels.o \
$(CC) $(CFLAGS) $(LDFLAGS) $(DEBUG_FLAGS) $(SDL_CFLAGS) $(FRIBIDI_CFLAGS) $(DEFS) \
-o tuxpaint $^ \
$(SDL_LIBS) $(SVG_LIB) $(ARCH_LINKS)
@$(RAD_CMD)
@$(RSRC_CMD)
@$(MIMESET_CMD)

View file

@ -1,24 +0,0 @@
This folder exists to ease testing under macOS. Please ignore but do not
delete. More details are below.
macOS requires all files in an application have a specific folder structure.
We create this structure under the folder "TuxPaint.app" when `make install` is
run. But `make install` takes a long time to run under macOS due to the large
number of files that need to be copied, as well as all the processing we do to
those files (see custom/macos.sh for what we need to do.) This makes testing
even a small code change time consuming.
That's the problem this folder solves: Instead of creating the folder
structure under TuxPaint.app every time to test a code change to be able to run
the application, we pre-build the folder structure around the tuxpaint binary
so the binary can be executed directly without re-creating the folder structure
every time. Luckily for us, this only require that we only have a single
folder "Resources" in the root folder of the tuxpaint source code (with some
subfolders and symlinks underneath the Resources folder.)
I hope my fellow Tux Paint contributors will forgive me for taking up yet
another whole folder for use by a single platform, let alone almost empty, in
the root folder of the source code distribution meant for multiple platforms.
Mark Kim
2018.06.27

View file

@ -1 +0,0 @@
../../data