From 5eab2d841daa8357e44891d5423aaf413db22261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Thu, 18 Sep 2014 21:31:42 +0200 Subject: [PATCH] Debian pkg now supports icons through --deb-icon. #3 --- README.md | 12 +++++------- completion.sh | 2 +- config.ini | 6 ++++++ love-release.1 | 15 +++++++-------- love-release.sh | 6 +++--- scripts/debian.sh | 35 ++++++++++++++++++++++++++++++++++- 6 files changed, 56 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index cd1519c..e4641e2 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,11 @@ it will automatically detect which version your project uses. `--osx-maintainer-name` Set the maintainer’s name. Provide it for OS X CFBundleIdentifier. #### DEBIAN +`--deb-icon` Path to a single folder where icons are stored. + To be properly recognized, icons filename must contain `YYxYY`, + where `YY` is the resolution of the icon. + SVG files are recognized if suffixed with `.svg`. + Other files will be ignored. `--maintainer-email` Set the maintainer’s email. `--deb-maintainer-name` Set the maintainer’s name. `--deb-package-name` Set the name of the package and the command that will be used to launch your game. @@ -126,13 +131,6 @@ but if provided it can use them. - then [Wine](http://www.winehq.org/) and [Resource Hacker](http://www.angusj.com/resourcehacker/) to set the icon. This last step can be automatically done, assuming Wine is installed. -If you want to add icons in the debian package, -open it and put the icons in `/usr/share/icons/hicolor/YYxYY/apps/`, -where YY is the width of the icon. -You also have to edit the line `Icon=love` in -`/usr/share/applications/yourgame.desktop` to match the icon's name. -See [developer.gnome.org](https://developer.gnome.org/integration-guide/stable/basic-integration.html.en) for more informations. - ### SEE ALSO [https://www.love2d.org](https://www.love2d.org) [https://www.love2d.org/wiki/Game_Distribution](https://www.love2d.org/wiki/Game_Distribution) diff --git a/completion.sh b/completion.sh index 67c7b70..096bdfd 100644 --- a/completion.sh +++ b/completion.sh @@ -8,7 +8,7 @@ _love-release() prev="${COMP_WORDS[COMP_CWORD-1]}" opts="-l" opts="$opts -w --win-icon" - opts="$opts -d --deb-package-version --deb-maintainer-name --maintainer-email --deb-package-name" + opts="$opts -d --deb-icon --deb-package-version --deb-maintainer-name --maintainer-email --deb-package-name" opts="$opts -a --activity --apk-package-version --apk-maintainer-name --apk-package-name --update-android" opts="$opts -m --osx-icon --osx-maintainer-name" opts="$opts -h -n -r -v -x --config --homepage --description --clean --help" diff --git a/config.ini b/config.ini index 8500c07..005e681 100644 --- a/config.ini +++ b/config.ini @@ -45,6 +45,12 @@ maintainer_email="" ; No spaces and no special characters except underscore. Better be lowercase. package_name="" +; Icon directory +; Icons must contain YYxYY in their filename to be recognized, +; where YY is the resolution of the icon. +; SVG files are recognized if suffixed with .svg +icon="" + [android] ; Android game activity ; No spaces and no special characters except underscore. Better be lowercase. diff --git a/love-release.1 b/love-release.1 index d839859..faef85a 100644 --- a/love-release.1 +++ b/love-release.1 @@ -97,6 +97,13 @@ Path to an icns file to use. Set the maintainer's name. Provide it for OS X CFBundleIdentifier. .SH DEBIAN .TP +.B \-\-deb-icon \fIdir\fR +Path to a single folder where icons are stored. +To be properly recognized, icons filename must contain \fIYYxYY\fR, +where \fIYY\fR is the resolution of the icon. +SVG files are recognized if suffixed with \fI.svg\fR. +Other files will be ignored. +.TP .B \-\-maintainer-email \fIemail\fR Set the maintainer's email. .TP @@ -160,14 +167,6 @@ you can use \fIicoutils\fR to create the icon, then Wine and Resource Hacker to set the icon. This last step can be automatically done, assuming Wine is installed. -.br -If you want to add icons in the debian package, -open it and put the icons in \fI/usr/share/icons/hicolor/YYxYY/apps/\fR, -where YY is the width of the icon. -You also have to edit the line \"Icon=love\" in -\fI/usr/share/applications/yourgame.desktop\fR to match the icon's name. -See \fIhttps://developer.gnome.org/integration-guide/stable/basic-integration.html.en\fR -for more informations. .SH SEE ALSO .I https://www.love2d.org .br diff --git a/love-release.sh b/love-release.sh index fa75878..5ae0578 100755 --- a/love-release.sh +++ b/love-release.sh @@ -20,7 +20,7 @@ SCRIPT_ARGS="l;" SCRIPT_ARGS="w. win-icon: $SCRIPT_ARGS" ## Debian -SCRIPT_ARGS="d; deb-package-version: deb-maintainer-name: maintainer-email: deb-package-name: $SCRIPT_ARGS" +SCRIPT_ARGS="d; deb-icon: deb-package-version: deb-maintainer-name: maintainer-email: deb-package-name: $SCRIPT_ARGS" ## Android SCRIPT_ARGS="a; activity: apk-package-version: apk-maintainer-name: apk-package-name: update-android; $SCRIPT_ARGS" @@ -30,8 +30,8 @@ SCRIPT_ARGS="m; osx-icon: osx-maintainer-name: $SCRIPT_ARGS" ## List the options that require a file/directory that should be excluded by zip. -EXCLUDE_OPTIONS=("win-icon" "osx-icon") -EXCLUDE_CONFIG=("INI__windows__icon" "INI__macosx__icon") +EXCLUDE_OPTIONS=("win-icon" "osx-icon" "deb-icon") +EXCLUDE_CONFIG=("INI__windows__icon" "INI__macosx__icon" "INI__debian__icon") ## Add a short summary of your platform script here diff --git a/scripts/debian.sh b/scripts/debian.sh index d3bf21b..28752a1 100644 --- a/scripts/debian.sh +++ b/scripts/debian.sh @@ -18,6 +18,11 @@ if [ "$CONFIG" = true ]; then if [ -n "${INI__android__package_name}" ]; then PACKAGE_NAME=${INI__debian__package_name} fi + if [ -n "${INI__debian__icon}" ]; then + IFS=$'\n' + ICON_DIR=${INI__debian__icon} + ICON_FILES=( $(ls -AC1 "$ICON_DIR") ) + fi fi @@ -33,6 +38,10 @@ do elif [ "$OPTOPT" = "deb-package-name" ]; then PACKAGE_NAME=$OPTARG package_name_defined_argument=true + elif [ "$OPTOPT" = "deb-icon" ]; then + IFS=$'\n' + ICON_DIR=$OPTARG + ICON_FILES=( $(ls -AC1 "$ICON_DIR") ) fi done @@ -90,7 +99,6 @@ echo "Comment=$PROJECT_DESCRIPTION" >> $DESKTOP echo "Exec=$PACKAGE_NAME" >> $DESKTOP echo "Type=Application" >> $DESKTOP echo "Categories=Game;" >> $DESKTOP -echo "Icon=love" >> $DESKTOP chmod 0644 $DESKTOP PACKAGE_DIR=/usr/share/games/"$PACKAGE_NAME"/ @@ -107,6 +115,31 @@ echo "set -e" >> $TEMP$BIN_LOC"$PACKAGE_NAME" echo "love $PACKAGE_DIR$PACKAGE_LOC" >> $TEMP$BIN_LOC"$PACKAGE_NAME" chmod 0755 $TEMP$BIN_LOC"$PACKAGE_NAME" +ICON_LOC=/usr/share/icons/hicolor/ +mkdir -p $TEMP$ICON_LOC +if [ -n "$ICON_DIR" ]; then + echo "Icon=$PACKAGE_NAME" >> $DESKTOP + for ICON in "${ICON_FILES[@]}" + do + RES=$(echo "$ICON" | grep -Eo "[0-9]+x[0-9]+") + EXT=$(echo "$ICON" | sed -e 's/.*\.//g') + if [ "$EXT" = "svg" ]; then + mkdir -p $TEMP${ICON_LOC}scalable/apps + cp "$PROJECT_DIR"/"$ICON_DIR"/"$ICON" $TEMP${ICON_LOC}scalable/apps/"$PACKAGE_NAME".$EXT + chmod 0644 $TEMP${ICON_LOC}scalable/apps/"$PACKAGE_NAME".EXT + else + if [ -n "$RES" ]; then + mkdir -p $TEMP$ICON_LOC$RES/apps + cp "$PROJECT_DIR"/"$ICON_DIR"/"$ICON" $TEMP$ICON_LOC$RES/apps/"$PACKAGE_NAME".$EXT + chmod 0644 $TEMP$ICON_LOC$RES/apps/"$PACKAGE_NAME".$EXT + fi + fi + done +else + echo "Icon=love" >> $DESKTOP +fi + + cd $TEMP for line in $(find usr/ -type f); do md5sum $line >> $TEMP/DEBIAN/md5sums