Skip to content

Commit

Permalink
Debian pkg now supports icons through --deb-icon. #3
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterDA committed Sep 18, 2014
1 parent 32a6ffe commit 5eab2d8
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 20 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion completion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
15 changes: 7 additions & 8 deletions love-release.1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions love-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
35 changes: 34 additions & 1 deletion scripts/debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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

Expand Down Expand Up @@ -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"/
Expand All @@ -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
Expand Down

0 comments on commit 5eab2d8

Please sign in to comment.