Customization stuff from Eric P's OSX update.

This commit is contained in:
William Kendrick 2014-03-19 22:37:37 +00:00
parent ccc7488232
commit d3552fb7e8
4 changed files with 86 additions and 0 deletions

11
custom/README.txt Executable file
View file

@ -0,0 +1,11 @@
Tux Paint Customization
//EP added in 0.9.22 the customization process, custom folder and its files
This folder allows for customization of Tux Paint. One example is adding resources such as fonts, stamps, starters...
On Mac OS X, at the very end of build in Xcode, a build phase looks for macosx.sh script in this folder. If found, it is run, otherwise no customization is done.
On Windows, the win32.bat in this folder has to be run manually. At some point, a calling to the script could be integrated in the build process so as to be run automatically, just like it is on Mac OS X (see above).
On Linux, it should be straightforward to replicate the process describe above on Mac OS X, and automatically call a linux.sh script, in this folder, from the build process.

33
custom/macosx.sh Executable file
View file

@ -0,0 +1,33 @@
#!/bin/bash
#//EP added in version 0.9.22
# called from within XCode
# contains customization tasks
export APP="${BUILT_PRODUCTS_DIR}/${TARGET_NAME}.app"
#export CUSTOM="${BUILT_PRODUCTS_DIR}/../../../custom/content.zip"
export CUSTOM="content.zip"
export DST="$APP/Contents/Resources"
export FONTS="$DST/fonts"
export LOG="/tmp/custom.log"
if [ -f $CUSTOM ];
then
echo Custom content file "$CUSTOM" found
echo Installing custom content into target "$APP"
echo Content folder is "$DST"
# clean up fonts folder
echo Cleaning up fonts folder "$FONTS"
/usr/bin/sudo /bin/mv -f "$FONTS/default_font.ttf" /tmp # save the font(s) we want to keep
/usr/bin/sudo /bin/rm -rf "$FONTS/"* # empty fonts folder
/usr/bin/sudo /bin/mv -f "/tmp/default_font.ttf" "$FONTS" # restore the font(s) we want to keep
# install content from archive
echo Extracting content from archive into target
/usr/bin/unzip -o "$CUSTOM" -d "$DST" > "$LOG"
echo Custom content has been installed
else
echo Custom content file $CUSTOM not found
fi

34
custom/win32.bat Executable file
View file

@ -0,0 +1,34 @@
@echo off
rem //EP added in version 0.9.22
rem must be called manually at end of build
rem contains customization tasks
set CUSTOM=content.zip
set DST=..\data
set FONTS=%DST%\fonts
set LOG=%TEMP%\custom.log
if exist "%CUSTOM%" (
echo Custom content file %CUSTOM% found
echo Installing custom content into target folder %DST%
rem clean up fonts folder
echo Cleaning up fonts folder %FONTS%
rem save the fonts we want to keep
move %FONTS%\default_font.ttf "%TEMP%"
rem empty fonts folder
del /s /q %FONTS%\*
rem restore the fonts we want to keep
move "%TEMP%\default_font.ttf" %FONTS%
rem install content from archive
echo Extracting content from archive into target
unzip -yO -x*.icns -x__MACOSX\*.* -d -o %CUSTOM% %DST% > %LOG%
echo Custom content has been installed
) else (
echo Custom content file %CUSTOM% not found
)