Fixed all bugs

This commit is contained in:
Antonin Décimo
2016-01-18 18:43:22 +01:00
parent b3a3d238d0
commit 48c3bd657c
12 changed files with 0 additions and 1756 deletions

1
.gitignore vendored
View File

@@ -1 +0,0 @@
build/

108
Makefile
View File

@@ -1,108 +0,0 @@
SHELL=/usr/bin/env bash
BUILD_DIR=build
# Installation directories
BINARY_DIR=/usr/bin
INSTALL_DIR=/usr/share/love-release
MANPAGE_DIR=/usr/share/man/man1
COMPLETION_DIR=/usr/share/bash-completion/completions
SED_INSTALL_DIR=$(shell echo "$(INSTALL_DIR)" | sed -e 's/[\/&]/\\&/g')
love-release: deps clean
mkdir -p '$(BUILD_DIR)'
longopt=$$(grep -m1 "LONG_OPTIONS" love-release.sh | sed -E 's/.*LONG_OPTIONS="(.*)"/\1/'); \
for file in scripts/*.sh; do \
s="$$(grep -E -m1 "^MOD_OPTIONS" "$$file" | sed -E "s/OPTIONS=(['\"]?)(.*)\1/\2/")"; \
short="$${short}$${s}"; \
s="$${s:0:1}"; \
ll=$$(grep -E -m1 "^MOD_LONG_OPTIONS" "$$file" | sed -E "s/LONG_OPTIONS=(['\"]?)(.*)\1/\2/"); \
long="$${long},$${s}$${longopt//,/,$$s}"; \
if [[ -n $$ll ]]; then long="$${long},$${s}$${ll//,/,$$s}"; fi; \
shelp="$$shelp\\n\\ -$$(grep "init_module" $$file | sed -Ee 's/init_module //' -e 's/" "/ /g' -e "s/\"//g" | awk -F "\t" '{print($$3," ",$$1)}')\\"; \
done; \
shelp="$$shelp\\n"; \
sed -Ee "s/[^_]OPTIONS=(['\"]?)/ OPTIONS=\1$$short/" -e "s/LONG_OPTIONS=(['\"]?)(.*)\1/LONG_OPTIONS=\1\2$$long\1/" \
-e 's/INSTALLED=false/INSTALLED=true/' \
-e 's/SCRIPTS_DIR="scripts"/SCRIPTS_DIR="$(SED_INSTALL_DIR)\/scripts"/' \
-e "$$(echo "$$(sed -n '/^EndOfSHelp/=' love-release.sh) i \\$$(printf "$$shelp")")" love-release.sh > '$(BUILD_DIR)/love-release'; \
comp="$$(if [[ -n $$long ]]; then echo --$$long | tr -d ':' | sed -e 's/,$$//' -e 's/,/ --/g'; fi)$$(if [[ -n $$short ]]; then echo $$short | sed -E 's/(.)/ -\1/g'; fi) "; \
sed -Ee "s/opts=\"(.*)/opts=\"$$comp\1/" completion.sh > '$(BUILD_DIR)/completion.sh'
cp love-release.1 '$(BUILD_DIR)/love-release.1'
gzip '$(BUILD_DIR)/love-release.1'
install:
install -m 0755 '$(BUILD_DIR)/love-release' '$(BINARY_DIR)'
install -m 0755 -d '$(INSTALL_DIR)' '$(INSTALL_DIR)/scripts' '$(COMPLETION_DIR)'
install -m 0755 scripts/* '$(INSTALL_DIR)/scripts'
install -m 0644 README.md conf.lua modules.md '$(INSTALL_DIR)'
install -m 0644 '$(BUILD_DIR)/completion.sh' '$(COMPLETION_DIR)/love-release'
install -m 0644 '$(BUILD_DIR)/love-release.1.gz' '$(MANPAGE_DIR)'
embedded: clean
mkdir -p '$(BUILD_DIR)'
longopt=$$(grep -m1 "LONG_OPTIONS" love-release.sh | sed -E 's/.*LONG_OPTIONS="(.*)"/\1/'); \
for file in scripts/*.sh; do \
module="$$(basename -s '.sh' "$$file")"; \
content='(source <(cat <<\EndOfModule'$$'\n'"$$(cat $$file)"$$'\n''EndOfModule'$$'\n''))'$$'\n''default_module'$$'\n\n'; \
echo "$$content" >> "$(BUILD_DIR)/tmp"; \
s="$$(grep -E -m1 "^MOD_OPTIONS" "$$file" | sed -E "s/OPTIONS=(['\"]?)(.*)\1/\2/")"; \
short="$${short}$${s}"; \
s="$${s:0:1}"; \
ll=$$(grep -E -m1 "^MOD_LONG_OPTIONS" "$$file" | sed -E "s/LONG_OPTIONS=(['\"]?)(.*)\1/\2/"); \
long="$${long},$${s}$${longopt//,/,$$s}"; \
if [[ -n $$ll ]]; then long="$${long},$${s}$${ll//,/,$$s}"; fi; \
shelp="$$shelp\\n\\ -$$(grep "init_module" $$file | sed -Ee 's/init_module //' -e 's/" "/ /g' -e "s/\"//g" | awk -F "\t" '{print($$3," ",$$1)}')\\"; \
done; \
shelp="$$shelp\\n"; \
sed -Ee "s/[^_]OPTIONS=(['\"]?)/ OPTIONS=\1$$short/" -e "s/LONG_OPTIONS=(['\"]?)(.*)\1/LONG_OPTIONS=\1\2$$long\1/" \
-e 's/EMBEDDED=false/EMBEDDED=true/' \
-e '/include_scripts_here$$/r $(BUILD_DIR)/tmp' \
-e "$$(echo "$$(sed -n '/^EndOfSHelp/=' love-release.sh) i \\$$(printf "$$shelp")")" love-release.sh > '$(BUILD_DIR)/love-release.sh';
chmod 0775 '$(BUILD_DIR)/love-release.sh'
rm -rf '$(BUILD_DIR)/tmp'
deps:
@if (( BASH_VERSINFO < 4 )); then \
echo "Bash 4 is not installed."; \
fi; \
command -v curl > /dev/null 2>&1 || { \
echo "curl is not installed."; \
EXIT=true; \
}; \
command -v zip > /dev/null 2>&1 || { \
echo "zip is not installed."; \
EXIT=true; \
}; \
command -v unzip > /dev/null 2>&1 || { \
echo "unzip is not installed."; \
EXIT=true; \
}; \
command -v getopt > /dev/null 2>&1 || { \
opt=false; \
} && { \
unset GETOPT_COMPATIBLE; \
out=$$(getopt -T); \
if (( $$? != 4 )) && [[ -n $$out ]]; then \
opt=false; \
fi; \
}; \
if [[ $$opt == false ]]; then \
echo "GNU getopt is not installed."; \
EXIT=true; \
fi; \
if ( ! command -v readlink > /dev/null 2>&1 || ! readlink -m / > /dev/null 2>&1 ) && command -v greadlink > /dev/null 2>&1; then \
echo "GNU readlink is not installed."; \
EXIT=true; \
fi; \
if [[ $$EXIT == true ]]; then false; fi
remove:
rm -rf '$(BINARY_DIR)/love-release'
rm -rf '$(INSTALL_DIR)'
rm -rf '$(MANPAGE_DIR)/love-release.1.gz'
rm -rf '$(COMPLETION_DIR)/love-release' '/etc/bash_completion.d/love-release'
clean:
rm -rf '$(BUILD_DIR)'

193
README.md
View File

@@ -1,193 +0,0 @@
### NAME
[love-release][] -- Bash script to generate [LÖVE][] game releases
Automate LÖVE [Game Distribution][].
MIT-licensed.
### INSTALLATION
#### Dependencies
- Bash 4
- `GNU getopt` and `GNU readlink`. OSX/BSD users need to install them. You can add `GETOPT_COMPATIBLE=` in your shell rc to prevent incompatibilities.
- `curl`, `zip` and `unzip`.
- `lua` to read the configuration.
You also need Wine to get icons and installer for Windows, the Debian packaging utilities for Debian and the Android SDK to build a package for Android.
#### Build and install
First clone the repository, then you have two choices:
- you can build the script and install it on your system, and benefit of command-line completion, man page and extensibility,
- or make an embedded version with every thing you need in one file.
Alternatively, you can change the installation directories by editing the Makefile.
```shell
# Install on your system (assumes root rights)
make
make install
# All-in-one
make embedded
```
To remove love-release, if you haven't changed the default installation directories, run `make remove`.
### SYNOPSIS
`love-release.sh [-ADLMW] [-t project_title] [-r release_dir] [-l love_version] [FILES...]`
### DESCRIPTION
love-release.sh can be used to generate LÖVE game applications and get over the fastidious zipping commands you had to do.
The script fully supports Windows, MacOS either on x86 or x64, Debian and Android packages.
It needs an Internet connection to download LÖVE files.
### CONFIGURATION
You can install `lua` and add a `conf.lua` to your project to get automatic releases.
See the `conf.lua` file included to see how configuration works.
### OPTIONS
`-h` Print a short help
`--help` Print this longer help
#### OPERATING SYSTEMS
`-A` Create an Android package.
In order to create an Android package, you must have installed the Android SDK.
See [Building LÖVE for Android][], but there is no need to install the [LÖVE port to Android][], as the script will handle this by itself.
You also might want to provide more informations about it.
See the ANDROID section below.
`-D` Create a deb package. Aimed at Debian and Ubuntu derivatives.
In order to create a Debian package, you must provide more informations about it.
See the DEBIAN section below.
`-L` Create a plain LÖVE file. It is just a zip of your sources, renamed in \*.love.
Mostly aimed at Linux players or developers and the most common distribution process.
`-M` Create MacOS application.
Starting with LÖVE 0.9.0, LÖVE no longer supports old x86 Macintosh.
If you are targeting one of these, your project must be developped with LÖVE 0.8.0 or lower.
Depending on the LÖVE version used, the script will choose which one,
between x64 only or Universal Build to create.
`-W` Create Windows application.
Starting with LÖVE 0.8.0, a release is specially available for Windows x64.
If you are targeting one of these, your project must be developed with LÖVE 0.8.0 or newer.
Remember that x86 is always backwards compatible with x64.
Depending on the LÖVE version used, the script will choose which one,
between x64 and x86 or x86 only to create.
`-W32` Create Windows x86 executable only
`-W64` Create Windows x64 executable only
#### PROJECT OPTIONS
You can use the option of a module and append a long option from this list to set a specific
option for a module. For example, the option `--Wauthor` will set the author's name for Windows only.
`-a, --author` Set the project's author.
`-d, --description` Set the project's description.
`-e, --email` Set the author's email.
`-i, --icon` Path to icons.
`-l, --love` LÖVE version. Default is 0.9.2.
Starting with LÖVE 0.8.0, a release is specially available for Windows x64.
Starting with LÖVE 0.9.0, LÖVE no longer supports old x86 Macintosh.
`-p, --pkg` Set the project's identity.
`-r, --release` Set the release directory. By default, a subdirectory called releases is created.
`-t, --title` Set the project's title. By default, the name of the current directory is used.
`-u, --url` Set the project's homepage.
`-v, --version` Set your project's version.
`-x, --exclude` Exclude file or directory.
Use backslashes or quotes to avoid the shell filename substitution,
so that the name matching is performed by zip at all directory levels.
#### WINDOWS
You can create an installer. If you dont, you will have zip of a folder
containing your game executable and its dlls.
Creating installers and using icons require [Wine][] to be installed.
When the script installs Resource Hacker or Inno Setup, an install wizard GUI will appear.
Please let everything as is, do not uncheck checkboxes or replace installation directory.
`--Wicon` Path to an ico file to use.
`--Winstaller` Create an installer with [Inno Setup][].
`--Wappid` Your game ID. You can use a GUID/UUID and generate one with `uuidgen`.
It should remain the same between updates.
Mandatory if using an installer, not needed for a simple zip.
`--Wauthor` Set the maintainers name.
Mandatory if using an installer, not needed for a simple zip.
`--Wpkg` Set the name of your package.
Mandatory if using an installer, not needed for a simple zip.
`--Wversion` Set the version of your package.
Mandatory if using an installer, not needed for a simple zip.
#### MAC OS X
`--Micon` Path to an icns file to use.
`--Mauthor` Set the maintainers name. Provide it for OS X CFBundleIdentifier.
#### DEBIAN
`--Dicon` 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.
`--Demail` Set the maintainers email.
`--Dauthor` Set the maintainers name.
`--Dpkg` Set the name of the package and the command that will be used to launch your game.
By default, it is the name of your project converted to lowercase, with eventual spaces replaced by dashes.
`--Dversion` Set the version of your package.
#### ANDROID
Note that every argument passed to the options should be alphanumerical,
with eventual underscores (i.e. [a-zA-Z0-9\_]), otherwise you'll get errors.
`--Aicon` Path to a single folder where icons are stored.
The script will first look up for filename that contains
`42x42`, `72x72`, `96x96` or `144x144`.
It will then search the icon directory for subdirectories like
`drawable-mdpi`, `drawable-hdpi`, `drawable-xhdpi` and `drawable-xxhdpi`
to find an `ic_launcher.png` image.
OUYA icon (size `732x412`, or `drawable-xhdpi/ouya_icon.png`) is supported.
`--Aactivity` The name of the class that extends GameActivity.
By default it is the name of the project with Activity appended,
eventual spaces and dashes replaced by underscores.
`--Aauthor` Set the maintainers name.
It must be only alphanumerical characters, with eventual underscores.
`--Apkg` Set the name of the package.
By default, it is the name of your project, with eventual spaces replaced by underscores.
`--Aversion` Set the version of your package.
`--Aupdate` Update the love-android-sdl2.git repository used in the cache.
#### OTHERS
`--clean` Clean the cache located in `~/.cache/love-release`.
One can replace the LÖVE binaries there.
#### MODULES
The script is modular.
Each different platform is handled by a subscript stored in `scripts`.
If youd like to add the support of another platform, or write your own build script, see [modules.md](modules.md).
#### ICONS
The script doesnt yet handle the process of creating icons,
but if provided it can use them.
- if you want to create MacOS icons (.icns), and you are
- running MacOS, then check [iconutil][].
- running GNU/Linux, then check [libicns][].
- if you want to create Windows icons (.ico), you can
- use [icoutils][] to create the icon,
- then [Wine][] and [Resource Hacker][] to set the icon.
This last step can be automatically done, assuming Wine is installed.
[LÖVE]: https://www.love2d.org
[Game Distribution]: https://www.love2d.org/wiki/Game_Distribution
[love-release]: https://www.github.com/MisterDA/love-release
[iconutil]: https://developer.apple.com/library/mac/documentation/userexperience/conceptual/applehiguidelines/IconsImages/IconsImages.html
[libicns]: http://icns.sourceforge.net
[icoutils]: http://www.nongnu.org/icoutils/
[Wine]: http://www.winehq.org
[Resource Hacker]: http://www.angusj.com/resourcehacker
[Inno Setup]: http://www.jrsoftware.org/isinfo.php
[LÖVE port to Android]: https://bitbucket.org/MartinFelis/love-android-sdl2
[Building LÖVE for Android]: https://bitbucket.org/MartinFelis/love-android-sdl2/wiki/Building_L%C3%96VE_for_Android_-_Linux

View File

@@ -1,18 +0,0 @@
# love-release Bash completion
_love-release()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="-L -a -d -e -h -i -l -p -r -t -u -v -x --author --clean --description --email --exclude --help --icon --love --pkg --release --title --url --version"
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
}
complete -f -F _love-release love-release

View File

@@ -1,33 +0,0 @@
function love.conf(t)
t.identity = nil -- The name of the save directory (string)
-- love-release requires [a-z0-9_] characters. Cannot begin with a number.
t.version = "0.9.2" -- The LÖVE version this game was made for (string)
t.game_version = nil -- The version of your game (string)
t.icon = nil -- The path to the executable icons (string)
t.console = false -- Attach a console (boolean, Windows only)
t.title = "Untitled" -- The name of the game (string)
t.author = "Unnamed" -- The name of the author (string)
t.email = nil -- The email of the author (string)
t.url = nil -- The website of the game (string)
t.description = nil -- The description of the game (string)
-- OS to release your game on. Use a table if you want to overwrite the options, or just the OS name.
-- Available OS are "love", "windows", "osx", "debian" and "android".
-- A LÖVE file is created if none is specified.
t.os = {
"love",
windows = {
x32 = true,
x64 = true,
installer = false,
appid = nil,
},
"osx",
"debian",
"android",
}
-- t.window.*
-- t.modules.*
end

View File

@@ -1,220 +0,0 @@
.TH LOVE-RELEASE.SH 1
.SH NAME
love-release.sh \- Bash script to generate LÖVE game releases
.SH SYNOPSIS
.B love\-release.sh
[\fB\-ADLMW\fR] [\fB\-t\fR \fIproject_title\fR] [\fB\-r\fR \fIrelease_dir\fR] [\fB\-l\fR \fIlove_version\fR] [\fIFILES...\fR]
.SH DESCRIPTION
.B love-release.sh
can be used to generate LÖVE game applications and get over the fastidious zipping commands you had to do.
.PP
The script fully supports Windows, MacOS either on x86 or x64, Debian and Android packages.
It needs an Internet connection to download LÖVE files.
.SH CONFIGURATION
You can install \fIlua\fR and add a \fIconf.lua\fR to your project to get automatic releases.
See the \fIconf.lua\fR file included to see how configuration works.
.SH OPTIONS
.TP
.B \-h
Print a short help
.TP
.B \-\-help
Print this longer help
.SH OPERATING SYSTEMS
.TP
.B \-A
Create an Android package.
In order to create an Android package, you must have installed the Android SDK,
but there is no need to install the LÖVE port to Android,
as the script will handle this by itself.
You also might want to provide more informations about it.
See the ANDROID section below.
.TP
.B \-D
Create a deb package. Aimed at Debian and Ubuntu derivatives.
In order to create a Debian package, you must provide more informations about it.
See the DEBIAN section below.
.TP
.B \-L
Create a plain LÖVE file. It is just a zip of your sources, renamed in \fI*.love\fR.
Mostly aimed at Linux players or developers and the most common distribution process.
.TP
.B \-M
Create MacOS application.
Starting with LÖVE 0.9.0, LÖVE no longer supports old x86 Macintosh.
If you are targeting one of these, your project must be developed with LÖVE 0.8.0 or lower.
Depending on the LÖVE version used, the script will choose which one,
between x64 only or Universal Build to create.
.TP
.BR \-W \fIarch\fR
Create Windows application.
Starting with LÖVE 0.8.0, a release is specially available for Windows x64.
If you are targeting one of these, your project must be developed with LÖVE 0.8.0 or newer.
Remember that x86 is always backwards compatible with x64.
Depending on the LÖVE version used, the script will choose which one,
between x64 and x86 or x86 only to create.
.br
.B \-W32
Create Windows x86 executable only.
.br
.B \-W64
Create Windows x64 executable only.
.SH PROJECT OPTIONS
You can use the option of a module and append a long option from this list to set a specific
option for a module. For example, the option \fI\-\-Wauthor\fR will set the author's name for Windows only.
.br
.TP
.B \-a, \-\-author \fIauthor\fR
Set the project's author.
.TP
.B \-d, \-\-description \fIdescription\fR
Set the project's description.
.TP
.B \-e, \-\-email \fIemail\fR
Set the author's email.
.TP
.B \-i, \-\-icon \fIicon\fR
Path to icons.
.TP
.B \-l, \-\-love \fIlove\fR
LÖVE version. Default is 0.9.2.
Starting with LÖVE 0.8.0, a release is specially available for Windows x64.
Starting with LÖVE 0.9.0, LÖVE no longer supports old x86 Macintosh.
.TP
.B \-p, \-\-pkg \fIidentity\fR
Set the project's identity.
.TP
.B \-r, \-\-release \fIrelease-dir\fR
Set the release directory. By default, a subdirectory called releases is created.
.TP
.B \-t, \-\-title \fItitle\fR
Set the project's title. By default, the name of the current directory is used.
.TP
.B \-u, \-\-url \fIurl\fR
Set your project's homepage.
.TP
.B \-v, \-\-version \fIversion\fR
Set the version for your project.
.TP
.B \-x, \-\-exclude \fIfile\fR|\fIdirectory\fR
Exclude file or directory.
Use backslashes or quotes to avoid the shell filename substitution,
so that the name matching is performed by zip at all directory levels.
.SH WINDOWS
You can create an installer. If you dont, you will have zip of a folder
containing your game executable and its dlls.
Creating installers and using icons require Wine to be installed.
When the script installs Resource Hacker or Inno Setup, an install wizard GUI will appear.
Please let everything as is, do not uncheck checkboxes or replace installation directory.
.TP
.B \-\-Wicon \fIicon\fR
Path to an ico file to use.
.TP
.B \-\-Winstaller
Create an installer with Inno Setup.
.TP
.B \-\-Wappid \fIid\fR
Your game ID. You can use a GUID/UUID and generate one with \fIuuigen\fR.
It should remain the same between updates.
Mandatory if using an installer, not needed for a simple zip.
.TP
.B \-\-Wauthor \fIname\fR
Set the maintainers name.
Mandatory if using an installer, not needed for a simple zip.
.TP
.B \-\-Wpkg \fIname\fR
Set the name of the package.
Mandatory if using an installer, not needed for a simple zip.
.TP
.B \-\-Wversion \fIversion\fR
Set the version of your package.
Mandatory if using an installer, not needed for a simple zip.
.SH MAC OS X
.TP
.B \-\-Micon \fIicon\fR
Path to an icns file to use.
.TP
.B \-\-Mauthor \fIname\fR
Set the maintainer's name. Provide it for OS X CFBundleIdentifier.
.SH DEBIAN
.TP
.B \-\-Dicon \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 \-\-Demail \fIemail\fR
Set the maintainer's email.
.TP
.B \-\-Dauthor \fIname\fR
Set the maintainer's name.
.TP
.B \-\-Dpkg \fIname\fR
Set the name of the package and the command that will be use to launch your game.
By default, it is the name of your project converted to lowercase,
with eventual spaces replaced by dashes.
.TP
.B \-\-Dversion \fIversion\fR
Set the version of your package.
.SH ANDROID
Note that every argument passed to the options should be alphanumerical,
with eventual underscores (i.e. [a-zA-Z0-9_]), otherwise you'll get errors.
.TP
.B \-\-Aicon \fIdir\fR
Path to a single folder where icons are stored.
The script will first look up for filename that contains
\fI42x42\fR, \fI72x72\fR, \fI96x96\fR or \fI144x144\fR.
It will then search the icon directory for subdirectories like
\fIdrawable-mdpi\fR, \fIdrawable-hdpi\fR, \fIdrawable-xhdpi\fR and \fIdrawable-xxhdpi\fR
to find an \fIic_launcher.png\fR image.
OUYA icon (size \fI732x412\fR, or \fIdrawable-xhdpi/ouya_icon.png\fR) is supported.
.TP
.B \-\-Aactivity \fIactivity\fR
The name of the class that extends GameActivity.
By default it is the name of the project with 'Activity' appended,
eventual spaces and dashes replaced by underscores.
.TP
.B \-\-Aauthor \fIname\fR
Set the maintainers name.
It must be only alphanumerical characters, with eventual underscores.
.TP
.B \-\-Apkg \fIname\fR
Set the name of the package.
By default, it is the name of your project, with eventual spaces replaced by underscores.
.TP
.B \-\-Aversion \fIversion\fR
Set the version of your package.
.TP
.B \-\-Aupdate
Update the love-android-sdl2.git repository used in the cache.
.SH OTHERS
.TP
.B \-\-clean
Clean the cache located in \fI~/.cache/love-release\fR.
One can replace the LÖVE binaries there.
.SH MODULES
The script is modular.
Each different platform is handled by a subscript stored in \fIscripts\fR.
If you'd like to add the support of another platform,
or write your own build script, see \fImodules.md\fR.
.SH ICONS
The script doesnt yet handle the process of creating icons,
but if provided it can use them.
.br
If you want to create MacOS icons (\fI.icns\fR), and you are
running MacOS, then check \fIiconutil\fR. If you are running GNU/Linux,
then check \fIlibicns\fR.
.br
If you want to create Windows icons (\fI.ico\fR),
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.
.SH SEE ALSO
.I https://www.love2d.org
.br
.I https://www.love2d.org/wiki/Game_Distribution
.br
.I https://www.github.com/MisterDA/love-release

View File

@@ -1,468 +0,0 @@
#!/usr/bin/env bash
# LÖVE version
readonly LOVE_DEF_VERSION=0.10.0
readonly INSTALLED=false
readonly EMBEDDED=false
readonly OPTIONS="La:d:e:hi:l:p:r:t:u:v:x:"
readonly LONG_OPTIONS="author:,clean,description:,email:,exclude:,help,icon:,love:,pkg:,release:,title:,url:,version:"
readonly ARGS=$(getopt -o "$OPTIONS" -l "$LONG_OPTIONS" -n 'love-release' -- "$@")
# Helper functions
# Dependencies check
check_deps () {
command -v curl > /dev/null 2>&1 || {
>&2 echo "curl is not installed. Aborting."
local EXIT=true
}
command -v zip > /dev/null 2>&1 || {
>&2 echo "zip is not installed. Aborting."
local EXIT=true
}
command -v unzip > /dev/null 2>&1 || {
>&2 echo "unzip is not installed. Aborting."
local EXIT=true
}
command -v getopt > /dev/null 2>&1 || {
local opt=false
} && {
unset GETOPT_COMPATIBLE
local out
out=$(getopt -T)
if (( $? != 4 )) && [[ -n $out ]]; then
local opt=false
fi
}
if [[ $opt == false ]]; then
>&2 echo "GNU getopt is not installed. Aborting."
local EXIT=true
fi
if ! command -v readlink > /dev/null 2>&1 || ! readlink -m / > /dev/null 2>&1; then
command -v greadlink > /dev/null 2>&1 || {
>&2 echo "GNU readlink is not installed. Aborting."
local EXIT=true
} && {
readlink () {
greadlink "$@"
}
}
fi
command -v lua > /dev/null 2>&1 || {
echo "lua is not installed. Install it to ease your releases."
} && {
LUA=true
}
if [[ $EXIT == true ]]; then
exit_module "deps"
fi
}
# Get user confirmation, simple Yes/No question
## $1: message, usually just a question
## $2: default choice, 0 - yes; 1 - no, default - yes
## return: 0 - yes, 1 - no
get_user_confirmation () {
if [[ -z $2 || $2 == "0" ]]; then
read -n 1 -p "$1 [Y/n]: " yn
local default=0
else
read -n 1 -p "$1 [y/N]: " yn
local default=1
fi
case $yn in
[Yy]* )
echo; return 0;;
[Nn]* )
echo; return 1;;
"" )
return $default;;
* )
echo; return $default;;
esac
}
# Generate LÖVE version variables
## $1: LÖVE version string
## return: 0 - string matched, 1 - else
gen_version () {
if [[ $1 =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
LOVE_VERSION=$1
LOVE_VERSION_MAJOR=${BASH_REMATCH[1]}
LOVE_VERSION_MINOR=${BASH_REMATCH[2]}
LOVE_VERSION_REVISION=${BASH_REMATCH[3]}
return 0
fi
return 1
}
# Compare two LÖVE versions
## $1: First LÖVE version
## $2: comparison operator
## "ge", "le", "gt" "lt"
## ">=", "<=", ">", "<"
## $3: Second LÖVE version
## return: 0 - true, 1 - false
compare_version () {
if [[ $1 =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
local v1_maj=${BASH_REMATCH[1]}
local v1_min=${BASH_REMATCH[2]}
local v1_rev=${BASH_REMATCH[3]}
else
return 1
fi
if [[ $3 =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
local v2_maj=${BASH_REMATCH[1]}
local v2_min=${BASH_REMATCH[2]}
local v2_rev=${BASH_REMATCH[3]}
else
return 1
fi
case $2 in
ge|\>= )
if (( $v1_maj >= $v2_maj && $v1_min >= $v2_min && $v1_rev >= $v2_rev )); then
return 0
else
return 1
fi
;;
le|\<= )
if (( $v1_maj <= $v2_maj && $v1_min <= $v2_min && $v1_rev <= $v2_rev )); then
return 0
else
return 1
fi
;;
gt|\> )
if (( $v1_maj > $v2_maj || ( $v1_max == $v2_max && $v1_min > $v2_min ) ||
( $v1_max == $v2_max && $v1_min == $v2_min && $v1_rev > $v2_rev ) )); then
return 0
else
return 1
fi
;;
lt|\< )
if (( $v1_maj < $v2_maj || ( $v1_max == $v2_max && $v1_min < $v2_min ) ||
( $v1_max == $v2_max && $v1_min == $v2_min && $v1_rev < $v2_rev ) )); then
return 0
else
return 1
fi
;;
esac
}
# Read configuration
## $1: system name
read_config () {
if [[ $LUA == true ]] && [[ -f "conf.lua" ]]; then
local var
var=$(lua - <<EOF
f = loadfile("conf.lua")
t, love = {window = {}, modules = {}, screen = {}}, {}
f()
love.conf(t)
-- "love", "windows", "osx", "debian" or "android"
os = "$1"
fields = {
"identity", "version", "game_version", "icon", "exclude",
"title", "author", "email", "url", "description", }
for _, f in ipairs(fields) do
t[f] = t[f] or ""
end
t.os = t.os or {}
for _, v in ipairs(t.os) do
t.os[v] = {}
end
if os == "default" then
t.os.default = {}
end
if t.os[os] then
print(os:upper()..'=true')
for _, f in ipairs(fields) do
t.os[os][f] = t.os[os][f] or t[f]
if type(t.os[os][f]) == "table" then
str = f:upper()..'=('
for _, v in ipairs(t.os[os][f]) do
str = str..' "'..v..'"'
end
str = str..' )'
print(str)
else
print(f:upper()..'="'..t.os[os][f]..'"')
end
end
else
print(os:upper()..'=false')
end
if t.os.windows and os == "windows" then
t.os.windows.x32 = t.os.windows.x32 and true or false
t.os.windows.x64 = t.os.windows.x64 and true or false
t.os.windows.installer = t.os.windows.installer and true or false
t.os.windows.appid = t.os.windows.appid or ""
print("X32="..tostring(t.os.windows.x32))
print("X64="..tostring(t.os.windows.x64))
print("INSTALLER="..tostring(t.os.windows.installer))
print("APPID="..t.os.windows.appid)
end
EOF
)
eval "$var"
fi
}
# Read script options
## $1: options prefix
read_options () {
local pre="$1"
eval set -- "$ARGS"
while true; do
case "$1" in
-a|--${pre}author ) AUTHOR="$2"; shift 2 ;;
--${pre}clean ) rm -rf "$CACHE_DIR"; shift ;;
-d|--${pre}description ) DESCRIPTION="$2"; shift 2 ;;
-e|--${pre}email ) EMAIL="$2"; shift 2 ;;
-h|--${pre}help ) short_help; exit 0 ;;
-i|--${pre}icon )
ICON="$2"
if [[ -d $ICON ]]; then
local wd
local icon
icon="$(readlink -m "$ICON")"
wd="$(readlink -m "$PWD")"
EXCLUDE+=( "${icon//$wd\/}/*" )
elif [[ -f $ICON ]]; then
EXCLUDE+=( "$ICON" )
fi
shift 2 ;;
-l|--${pre}love ) if ! gen_version "$2"; then exit_module "version"; fi; shift 2 ;;
-p|--${pre}pkg ) IDENTITY="$2"; shift 2 ;;
-r|--${pre}release ) RELEASE_DIR="$2"; shift 2 ;;
-t|--${pre}title ) TITLE="$2"; shift 2 ;;
-u|--${pre}url ) URL="$2"; shift 2 ;;
-v|--${pre}version ) GAME_VERSION="$2"; shift 2 ;;
-x|--${pre}exclude ) EXCLUDE+=( "$2" ); shift 2 ;;
-- ) shift; break ;;
* ) shift ;;
esac
done
}
# Test if default module should be executed
default_module () {
if [[ $? -ne 2 ]]; then
DEFAULT_MODULE=false
fi
}
# Print short help
short_help () {
cat <<EndOfSHelp
Usage: love-release.sh [options...] [files...]
Options:
-h Print short help
-t <title> Set the project's title
-r <release> Set the release directory
-v <version> Set the LÖVE version
Modules:
-L LÖVE
EndOfSHelp
}
dump_var () {
echo "LOVE_VERSION=$LOVE_VERSION"
echo "LOVE_DEF_VERSION=$LOVE_DEF_VERSION"
echo "LOVE_WEB_VERSION=$LOVE_WEB_VERSION"
echo
echo "RELEASE_DIR=$RELEASE_DIR"
echo "CACHE_DIR=$CACHE_DIR"
echo
echo "IDENTITY=$IDENTITY"
echo "GAME_VERSION=$GAME_VERSION"
echo "ICON=$ICON"
echo
echo "TITLE=$TITLE"
echo "AUTHOR=$AUTHOR"
echo "EMAIL=$EMAIL"
echo "URL=$URL"
echo "DESCRIPTION=$DESCRIPTION"
echo
echo "${FILES[@]}"
}
# Modules functions
# Init module
## $1: Pretty module name
## $2: Configuration module name
## $3: Module option
## return: 0 - if module should be executed, else exit 2
init_module () {
(
opt="$3"
if (( ${#opt} == 1 )); then opt="-$opt"
elif (( ${#opt} >= 2 )); then opt="--$opt"; fi
eval set -- "$ARGS"
while true; do
case "$1" in
$opt ) exit 0 ;;
-- ) exit 1 ;;
* ) shift ;;
esac
done
)
local opt=$?
local module="$2"
read_config "$module"
module=${module^^}
if (( $opt == 0 )); then
if [[ ${!module} == false ]]; then
read_config "default"
fi
else
if [[ ${!module} == false ]]; then
exit_module "execute"
fi
fi
gen_version $VERSION
unset VERSION
MODULE="$1"
CACHE_DIR="$CACHE_DIR/$2"
read_options "$3"
LOVE_FILE="${TITLE}.love"
mkdir -p "$RELEASE_DIR" "$CACHE_DIR"
echo "Generating $TITLE with LÖVE $LOVE_VERSION for ${MODULE}..."
return 0
}
# Create the LÖVE file
## $1: Compression level 0-9
create_love_file () {
local dotfiles=()
for file in .*; do
if [[ $file == '.' || $file == '..' ]]; then continue; fi
if [[ -d $file ]]; then file="$file/*"; fi
dotfiles+=( "$file" )
done
local wd
local release_dir
release_dir="$(readlink -m "$RELEASE_DIR")"
wd="$(readlink -m "$PWD")"
zip -FS -$1 -r "$RELEASE_DIR/$LOVE_FILE" \
-x "$0" "${release_dir//$wd\/}/*" "${dotfiles[@]}" "${EXCLUDE[@]}" @ \
"${FILES[@]}"
}
# Exit module
## $1: optional error identifier
## $2: optional error message
exit_module () {
if [[ -z $1 ]]; then
echo "Done !"
exit 0
fi
if [[ -n $2 ]]; then
>&2 echo -e "$2"
fi
case $1 in
execute )
exit 2 ;;
binary )
>&2 echo "LÖVE $LOVE_VERSION could not be found or downloaded."
exit 3 ;;
options )
exit 4 ;;
version )
>&2 echo "LÖVE version string is invalid."
exit 5 ;;
deps )
exit 6 ;;
undef|* )
exit 1 ;;
esac
}
# Main
main () {
check_deps
# Get latest LÖVE version number
gen_version $LOVE_DEF_VERSION
LOVE_WEB_VERSION=$(curl -s https://love2d.org/releases.xml | grep -m 2 "<title>" | tail -n 1 | grep -Eo "[0-9]+.[0-9]+.[0-9]+")
gen_version $LOVE_WEB_VERSION
DEFAULT_MODULE=true
TITLE="$(basename $(pwd))"
PROJECT_DIR="$PWD"
RELEASE_DIR=releases
CACHE_DIR=~/.cache/love-release
FILES=()
EXCLUDE=()
if (( $? != 0 )); then short_help; exit_module "options"; fi
eval set -- "$ARGS"
read_options
while [[ $1 != '--' ]]; do shift; done; shift
for arg do
FILES+=( "$arg" )
done
if (( ${#FILES} == 0 )); then FILES+=( "." ); fi
eval set -- "$ARGS"
if [[ $INSTALLED == false && $EMBEDDED == false ]]; then
exit_module "undef" "love-release has not been installed, and is not embedded into one script."
fi
if [[ ! -f "main.lua" ]]; then
>&2 echo "No main.lua file was found."
exit_module 1
fi
if [[ $EMBEDDED == true ]]; then
: # include_scripts_here
elif [[ $INSTALLED == true ]]; then
SCRIPTS_DIR="scripts"
for file in "$SCRIPTS_DIR"/*.sh; do
(source "$file")
default_module
done
fi
(
init_module "LÖVE" "love" "L"
create_love_file 9
exit_module
)
if [[ $? -ne 0 && $DEFAULT_MODULE == true ]]; then
(
init_module "LÖVE" "default"
create_love_file 9
exit_module
)
fi
return 0
}
main "$@"

View File

@@ -1,122 +0,0 @@
# How to write love-release module ?
## Introduction
What's the point anyway ?
Well, you could do that if you wanted to support another platform, or maybe to set up your own build script if you want to use old or custom versions of LÖVE, or finally to add other directives at build time.
Read this example and take a look at the other modules.
To create a new module, you have to create a file in the `scripts` directory, and then recompile love-release.
If you wish to submit a new module, please also edit `README.md` and `love-release.1`
## Variables
You have access to global variables. You can modify them freely, as a module is executed in a subshell.
- `$PROJECT_DIR`: absolute path to the directory where `love-release` was launched.
- `$RELEASE_DIR`: path the release directory. You should not assume the path will be absolute nor relative. To be sure, always do `cd "$PROJECT_DIR"` before using this variable.
- `$LOVE_FILE`: the name of the default LÖVE file. Always do `cd "$RELEASE_DIR"` before using this variable.
- `$CACHE_DIR`: absolute path to the cache directory of your module.
- `$FILES`: an array containing the list of files and directories to include in the zip. By default, it's `FILE=( "." )`.
- `$EXCLUDE`: an array containing the list of files and directories to exclude. By default, all the `.file` are excluded.
- `$LOVE_VERSION`: the LÖVE version your module should use. The three following variables are generated by the `gen_version` function.
* `$LOVE_VERSION_MAJOR`,
* `$LOVE_VERSION_MINOR`,
* `$LOVE_VERSION_REVISION`.
- `$TITLE`: the game's title.
- `$IDENTITY`: the game's identity. You should generate it yourself if needed.
- `$DESCRIPTION`: the games's description.
- `$GAME_VERSION`: the game's version.
- `$URL`: the game's url.
- `$AUTHOR`: the game's author.
- `$EMAIL`: the author's email.
- `$ICON`: it can contain a directory path to a directory where icons are stored, or a direct path to the icon file. You should not assume the path will be absolute nor relative. To be sure, always do `cd "$PROJECT_DIR"` before using this variable.
## Init
A module should always begin with the function `init_module`.
It tests if the module should be executed or not, and reads the configuration file and the options.
If the module should not be executed, then it will exit.
`init_module` takes three parameters:
- the pretty name of the module, for logging.
- the real name of the module. It must be the name of the script, and the name of the OS used in the configuration file.
- the option that will trigger your script.
For example, we could have `init_module "Android" "android" "A"`.
### Additional options
Declare the additional options your script will be using.
Beware ! They are parsed by sed, so let them be simple strings at the beginning of the line.
Love-release uses GNU getopt. Short options are made of one character. Add them in the `$MOD_OPTIONS` variable. Long options can be added in the `$MOD_LONG_OPTIONS` variable, separated by a comma. Each option may be followed by one colon to indicate it has a required argument, and by two colons to indicate it has an optional argument.
```bash
MOD_OPTIONS="A"
MOD_LONG_OPTIONS="activity:,update"
```
## Setup
### Configuration
Configuration is loaded if a `conf.lua` file is present. You have nothing to do.
### Additional options
If you have declared additional options, you have to read them.
Reaching `--` means that they are no more options to read.
```bash
while true; do
case "$1" in
--activity ) ACTIVITY="$2"; shift 2 ;;
--update ) UPDATE=true; shift ;;
-- ) break ;;
* ) shift ;;
esac
done
```
### Dependencies
If your module has external dependencies, you should test if they are installed. You can use this snippet:
```bash
if ! command -v git > /dev/null 2>&1; then
exit_module "deps" "git was not found."
fi
```
### Script variables
If your module requires (by example) the `$AUTHOR` variable, you should test if it's empty. You can also test the validity of the variables.
## LÖVE file
Modules scripts always start in `$PROJECT_DIR`. If you have moved, get back in !
Use `create_love_file 9` to create the LÖVE file. It is created in `$RELEASE_DIR`. The function takes as parameter the level of compression to use.
## Write your code
Read the title !
You can use the `dump_var` to print most of the script's variables for debugging purposes.
You can also compare two LÖVE versions with the `compare_version`.
```bash
# Compare two LÖVE versions
## $1: First LÖVE version
## $2: comparison operator
## "ge", "le", "gt" "lt"
## ">=", "<=", ">", "<"
## $3: Second LÖVE version
## return: 0 - true, 1 - false
if compare_version "$LOVE_VERSION" '>=' '0.8.0'; then
: # do something
fi
```
## Exit the module
Exit the module with `exit_module`.
You can also report an error with an identifier as first argument:
- `execute`: module could not be executed.
- `binary`: the LÖVE binaries could not be found or downloaded.
- `options`: errors in the options given to the script.
- `version`: the LÖVE version string is invalid.
- `deps`: unsatisfacted dependencies.
- `undef|*`: undefined error.

View File

@@ -1,155 +0,0 @@
# Android debug package
init_module "Android" "android" "A"
MOD_OPTIONS="A"
MOD_LONG_OPTIONS="activity:,update"
IDENTITY=$(echo $TITLE | sed -e 's/[^-a-zA-Z0-9_]/-/g' | tr '[:upper:]' '[:lower:]')
ACTIVITY=$(echo $TITLE | sed -e 's/[^a-zA-Z0-9_]/_/g')
# Options
while true; do
case "$1" in
--Aactivity ) ACTIVITY="$2"; shift 2 ;;
--Aupdate ) UPDATE_ANDROID=true; shift ;;
-- ) break ;;
* ) shift ;;
esac
done
# Android
missing_info=false
missing_deps=false
error_msg="Could not build Android package."
if ! command -v git > /dev/null 2>&1; then
missing_deps=true
error_msg="$error_msg\ngit was not found."
fi
if ! command -v ndk-build > /dev/null 2>&1; then
missing_deps=true
error_msg="$error_msg\nndk-build was not found."
fi
if ! command -v ant > /dev/null 2>&1; then
missing_deps=true
error_msg="$error_msg\nant was not found."
fi
if [[ $missing_deps == true ]]; then
exit_module "deps" "$error_msg"
fi
if [[ -z $GAME_VERSION ]]; then
missing_info=true
error_msg="$error_msg\nMissing project's version. Use -v or --Aversion."
fi
if [[ -z $AUTHOR ]]; then
missing_info=true
error_msg="$error_msg\nMissing maintainer's name. Use -a or --Aauthor."
fi
if [[ $missing_info == true ]]; then
exit_module "options" "$error_msg"
fi
create_love_file 0
LOVE_ANDROID_DIR="$CACHE_DIR/love-android-sdl2"
if [[ -d $LOVE_ANDROID_DIR ]]; then
cd "$LOVE_ANDROID_DIR"
git checkout -- .
rm -rf src/com bin gen
if [[ $UPDATE_ANDROID = true ]]; then
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse @{u})
BASE=$(git merge-base @ @{u})
if [[ $LOCAL == $REMOTE ]]; then
echo "love-android-sdl2 is already up-to-date."
elif [[ $LOCAL == $BASE ]]; then
git pull
ndk-build --jobs $(( $(nproc) + 1))
fi
fi
else
cd "$CACHE_DIR"
git clone https://bitbucket.org/MartinFelis/love-android-sdl2.git
cd "$LOVE_ANDROID_DIR"
ndk-build --jobs $(( $(nproc) + 1))
fi
ANDROID_VERSION=$(grep -Eo -m 1 "[0-9]+.[0-9]+.[0-9]+[a-z]*" "$LOVE_ANDROID_DIR"/AndroidManifest.xml)
ANDROID_LOVE_VERSION=$(echo "$ANDROID_VERSION" | grep -Eo "[0-9]+.[0-9]+.[0-9]+")
if [[ "$LOVE_VERSION" != "$ANDROID_LOVE_VERSION" ]]; then
exit_module 1 "Love version ($LOVE_VERSION) differs from love-android-sdl2 version ($ANDROID_LOVE_VERSION). Could not create package."
fi
mkdir -p assets
cd "$PROJECT_DIR"
cd "$RELEASE_DIR"
cp "$LOVE_FILE" "$LOVE_ANDROID_DIR/assets/game.love"
cd "$LOVE_ANDROID_DIR"
sed -i.bak -e "s/org.love2d.android/com.${AUTHOR}.${IDENTITY}/" \
-e "s/$ANDROID_VERSION/${ANDROID_VERSION}-${IDENTITY}-v${GAME_VERSION}/" \
-e "0,/LÖVE for Android/s//$TITLE $GAME_VERSION/" \
-e "s/LÖVE for Android/$TITLE/" \
-e "s/GameActivity/$ACTIVITY/" \
AndroidManifest.xml
mkdir -p "src/com/$AUTHOR/$IDENTITY"
cat > "src/com/$AUTHOR/$IDENTITY/${ACTIVITY}.java" <<EOF
package com.${AUTHOR}.${IDENTITY};
import org.love2d.android.GameActivity;
public class $ACTIVITY extends GameActivity {}
EOF
if [[ -d "$ICON" ]]; then
cd "$PROJECT_DIR"
cd "$ICON"
for icon in *; do
RES=$(echo "$icon" | grep -Eo "[0-9]+x[0-9]+")
EXT=$(echo "$icon" | sed -e 's/.*\.//g')
if [[ $RES == "42x42" ]]; then
cp "$icon" "$LOVE_ANDROID_DIR/res/drawable-mdpi/ic_launcher.png"
elif [[ $RES == "72x72" ]]; then
cp "$icon" "$LOVE_ANDROID_DIR/res/drawable-hdpi/ic_launcher.png"
elif [[ $RES == "96x96" ]]; then
cp "$icon" "$LOVE_ANDROID_DIR/res/drawable-xhdpi/ic_launcher.png"
elif [[ $RES == "144x144" ]]; then
cp "$icon" "$LOVE_ANDROID_DIR/res/drawable-xxhdpi/ic_launcher.png"
elif [[ "$RES" == "732x412" ]]; then
cp "$icon" "$LOVE_ANDROID_DIR/res/drawable-xhdpi/ouya_icon.png"
fi
done
if [[ -f "drawable-mdpi/ic_launcher.png" ]]; then
cp "drawable-mdpi/ic_launcher.png" "$LOVE_ANDROID_DIR/res/drawable-mdpi/ic_launcher.png"
fi
if [[ -f "drawable-hdpi/ic_launcher.png" ]]; then
cp "drawable-hdpi/ic_launcher.png" "$LOVE_ANDROID_DIR/res/drawable-hdpi/ic_launcher.png"
fi
if [[ -f "drawable-xhdpi/ic_launcher.png" ]]; then
cp "drawable-xhdpi/ic_launcher.png" "$LOVE_ANDROID_DIR/res/drawable-xhdpi/ic_launcher.png"
fi
if [[ -f "drawable-xxhdpi/ic_launcher.png" ]]; then
cp "drawable-xxhdpi/ic_launcher.png" "$LOVE_ANDROID_DIR/res/drawable-xxhdpi/ic_launcher.png"
fi
if [[ -f "drawable-xhdpi/ouya_icon.png" ]]; then
cp "drawable-xhdpi/ouya_icon.png" "$LOVE_ANDROID_DIR/res/drawable-xhdpi/ouya_icon.png"
fi
cd "$LOVE_ANDROID_DIR"
fi
ant debug
cd "$PROJECT_DIR"
cp "$LOVE_ANDROID_DIR/bin/love_android_sdl2-debug.apk" "$RELEASE_DIR"
git checkout -- .
rm -rf src/com bin gen
exit_module

View File

@@ -1,103 +0,0 @@
# Debian package
init_module "Debian" "debian" "D"
MOD_OPTIONS="D"
MOD_LONG_OPTIONS=""
IDENTITY=$(echo $TITLE | sed -e 's/[^-a-zA-Z0-9_]/-/g' | tr '[:upper:]' '[:lower:]')
# Debian
missing_info=false
error_msg="Could not build Debian package."
if [[ -z $GAME_VERSION ]]; then
missing_info=true
error_msg="$error_msg\nMissing project's version. Use -v or --Dversion."
fi
if [[ -z $URL ]]; then
missing_info=true
error_msg="$error_msg\nMissing project's homepage. Use -u or -Durl."
fi
if [[ -z $DESCRIPTION ]]; then
missing_info=true
error_msg="$error_msg\nMissing project's description. Use -d or --Ddescription."
fi
if [[ -z $AUTHOR ]]; then
missing_info=true
error_msg="$error_msg\nMissing maintainer's name. Use -a or --Dauthor."
fi
if [[ -z $EMAIL ]]; then
missing_info=true
error_msg="$error_msg\nMissing maintainer's email. Use -e or --Demail."
fi
if [[ $missing_info == true ]]; then
exit_module "options" "$error_msg"
fi
create_love_file 9
cd "$RELEASE_DIR"
TEMP="$(mktemp -d)"
umask 0022
mkdir -p "$TEMP/DEBIAN"
cat > "$TEMP/DEBIAN/control" <<EOF
Package: $IDENTITY
Version: $GAME_VERSION
Architecture: all
Maintainer: $AUTHOR <$EMAIL>
Installed-Size: $(( $(stat -c %s "$LOVE_FILE") / 1024 ))
Depends: love (>= $LOVE_VERSION)
Priority: extra
Homepage: $URL
Description: $DESCRIPTION
EOF
mkdir -p "$TEMP/usr/share/applications"
cat > "$TEMP/usr/share/applications/${IDENTITY}.desktop" <<EOF
[Desktop Entry]
Name=$TITLE
Comment=$DESCRIPTION
Exec=$IDENTITY
Type=Application
Categories=Game;
EOF
mkdir -p "$TEMP/usr/bin"
cat <(echo -ne '#!/usr/bin/env love\n') "$LOVE_FILE" > "$TEMP/usr/bin/$IDENTITY"
chmod +x "$TEMP/usr/bin/$IDENTITY"
if [[ -d $ICON ]]; then
ICON_LOC=$TEMP/usr/share/icons/hicolor
mkdir -p $ICON_LOC
echo "Icon=$IDENTITY" >> "$TEMP/usr/share/applications/${IDENTITY}.desktop"
cd "$ICON"
for file in *; do
RES=$(echo "$file" | grep -Eo "[0-9]+x[0-9]+")
EXT=$(echo "$file" | sed -e 's/.*\.//g')
if [[ $EXT == "svg" ]]; then
mkdir -p "$ICON_LOC/scalable/apps"
cp "$file" "$ICON_LOC/scalable/apps/${IDENTITY}.svg"
chmod 0644 "$ICON_LOC/scalable/apps/${IDENTITY}.svg"
elif [[ -n $RES ]]; then
mkdir -p "$ICON_LOC/$RES/apps"
cp "$file" "$ICON_LOC/$RES/apps/${IDENTITY}.$EXT"
chmod 0644 "$ICON_LOC/$RES/apps/${IDENTITY}.$EXT"
fi
done
else
echo "Icon=love" >> "$TEMP/usr/share/applications/${IDENTITY}.desktop"
fi
cd "$TEMP"
# TODO: There might be a problem here if the filename contains weird characters.
find "usr" -type f -exec md5sum {} \; | sed -E "s/^([0-9a-f]{32} )/\1\//g" > "$TEMP/DEBIAN/md5sums"
cd "$PROJECT_DIR"
fakeroot dpkg-deb -b "$TEMP" "$RELEASE_DIR/$IDENTITY-${GAME_VERSION}_all.deb"
rm -rf "$TEMP"
exit_module

View File

@@ -1,99 +0,0 @@
# Mac OS X
init_module "Mac OS X" "osx" "M"
MOD_OPTIONS="M"
MOD_LONG_OPTIONS=""
IDENTITY=$(echo $TITLE | sed -e 's/[^-a-zA-Z0-9_]/-/g' | tr '[:upper:]' '[:lower:]')
if [[ -z $AUTHOR ]]; then
exit_module "options" "Missing maintainer's name. Use -a or --Mauthor."
fi
if [[ -z $GAME_VERSION ]]; then
GAME_VERSION="$LOVE_VERSION"
fi
if [[ -n $ICON ]]; then
if [[ -d $ICON ]]; then
for file in $ICON/*.icns; do
if [[ -f $file ]]; then
ICON="$file"
break
else
found=false
fi
done
fi
if [[ $found == false || ! -f $ICON ]]; then
>&2 echo "OS X icon was not found in ${ICON}."
icon=Love.icns
ICON=
else
icon="${IDENTITY}.icns"
fi
fi
create_love_file 9
cd "$RELEASE_DIR"
## MacOS 64-bits ##
if compare_version "$LOVE_VERSION" '>=' '0.9.0'; then
if [[ ! -f "$CACHE_DIR/love-$LOVE_VERSION-macosx-x64.zip" ]]; then
curl -L -C - -o $CACHE_DIR/love-$LOVE_VERSION-macosx-x64.zip https://bitbucket.org/rude/love/downloads/love-$LOVE_VERSION-macosx-x64.zip
fi
unzip -qq "$CACHE_DIR/love-$LOVE_VERSION-macosx-x64.zip"
rm -rf "$TITLE-macosx-x64.zip" 2> /dev/null
mv love.app "${TITLE}.app"
cp "$LOVE_FILE" "${TITLE}.app/Contents/Resources"
if [[ -n $ICON ]]; then
cd "$PROJECT_DIR"
cp "$ICON" "$RELEASE_DIR/$icon"
cd "$RELEASE_DIR"
mv "$icon" "${TITLE}.app/Contents/Resources"
fi
sed -i.bak -e '/<key>UTExportedTypeDeclarations<\/key>/,/^\t<\/array>/d' \
-e "s/>org.love2d.love</>org.${AUTHOR}.$IDENTITY</" \
-e "s/$LOVE_VERSION/$GAME_VERSION/" \
-e "s/Love.icns/$icon/" \
-e "s/>LÖVE</>$TITLE</" \
"${TITLE}.app/Contents/Info.plist"
rm "${TITLE}.app/Contents/Info.plist.bak"
zip -9 -qyr "${TITLE}-macosx-x64.zip" "${TITLE}.app"
rm -rf love-$LOVE_VERSION-macosx-x64.zip "${TITLE}.app" __MACOSX
## MacOS 32-bits ##
else
if [[ ! -f "$CACHE_DIR/love-$LOVE_VERSION-macosx-ub.zip" ]]; then
curl -L -C - -o $CACHE_DIR/love-$LOVE_VERSION-macosx-ub.zip https://bitbucket.org/rude/love/downloads/love-$LOVE_VERSION-macosx-ub.zip
fi
unzip -qq "$CACHE_DIR/love-$LOVE_VERSION-macosx-ub.zip"
rm -rf "$TITLE-macosx-ub.zip" 2> /dev/null
mv love.app "${TITLE}.app"
cp "$LOVE_FILE" "${TITLE}.app/Contents/Resources"
if [[ -n $ICON ]]; then
cd "$PROJECT_DIR"
cp "$ICON" "$RELEASE_DIR/$icon"
cd "$RELEASE_DIR"
mv "$icon" "${TITLE}.app/Contents/Resources"
fi
sed -i.bak -e '/<key>UTExportedTypeDeclarations<\/key>/,/^\t<\/array>/d' \
-e "s/>org.love2d.love</>org.${AUTHOR}.$IDENTITY</" \
-e "s/$LOVE_VERSION/$GAME_VERSION/" \
-e "s/Love.icns/$icon/" \
-e "s/>LÖVE</>$TITLE</" \
"${TITLE}.app/Contents/Info.plist"
rm "${TITLE}.app/Contents/Info.plist.bak"
zip -9 -qyr "${TITLE}-macosx-ub.zip" "${TITLE}.app"
rm -rf love-$LOVE_VERSION-macosx-ub.zip "${TITLE}.app" __MACOSX
fi
exit_module

View File

@@ -1,236 +0,0 @@
# Windows
init_module "Windows" "windows" "W"
MOD_OPTIONS="W::"
MOD_LONG_OPTIONS="appid:,installer"
if [[ -z $IDENTITY ]]; then
IDENTITY=$(echo $IDENTITY | sed -e 's/[^-a-zA-Z0-9_]/-/g' | tr '[:upper:]' '[:lower:]')
fi
while true; do
case "$1" in
--Wappid ) APPID="$2"; shift 2 ;;
--Winstaller ) INSTALLER=true; shift ;;
-W ) if [[ -z "$2" ]]; then X32=true; X64=true;
elif (( "$2" == 32 )); then X32=true;
elif (( "$2" == 64 )); then X64=true;
fi; shift ;;
-- ) break ;;
* ) shift ;;
esac
done
FOUND_WINE=true
command -v wine >/dev/null 2>&1 || { FOUND_WINE=false; } && { WINEPREFIX="$CACHE_DIR/wine"; }
if [[ -n $ICON ]]; then
if [[ $FOUND_WINE == true ]]; then
if [[ -d $ICON ]]; then
for file in $ICON/*.ico; do
if [[ -f $file ]]; then
ICON="$file"
break
else
found=false
fi
done
fi
if [[ $found == false || ! -f $ICON ]]; then
>&2 echo "Windows icon was not found in ${ICON}."
ICON=
else
RESHACKER="$WINEPREFIX/drive_c/Program Files (x86)/Resource Hacker/ResourceHacker.exe"
if [[ ! -f $RESHACKER ]]; then
curl -L -C - -o "$WINEPREFIX/drive_c/reshacker_setup.exe" "http://www.angusj.com/resourcehacker/reshacker_setup.exe"
WINEPREFIX="$WINEPREFIX" wine "$WINEPREFIX/drive_c/reshacker_setup.exe" 2>&1 /dev/null
fi
fi
else
>&2 echo "Can not set Windows icon without Wine."
fi
fi
if [[ $INSTALLER == true ]]; then
missing_opt=false
error_msg="Could not build Windows installer."
if [[ $FOUND_WINE == false ]]; then
>&2 echo "Can not build Windows installer without Wine."
exit_module "deps"
fi
if [[ -z $AUTHOR ]]; then
missing_opt=true
error_msg="$error_msg\nMissing project author. Use -a or --Wauthor."
fi
if [[ -z $URL ]]; then
missing_opt=true
error_msg="$error_msg\nMissing project url. Use -u or --Wurl."
fi
if [[ -z $GAME_VERSION ]]; then
missing_opt=true
error_msg="$error_msg\nMissing project version. Use -v or --Wversion."
fi
if [[ -z $APPID ]]; then
missing_opt=true
error_msg="$error_msg\nMissing application GUID. Use --Wappid."
fi
if [[ $missing_opt == true ]]; then
exit_module "options" "$error_msg"
fi
INNOSETUP="$WINEPREFIX/drive_c/Program Files (x86)/Inno Setup 5/ISCC.exe"
if [[ ! -f $INNOSETUP ]]; then
curl -L -C - -o "$WINEPREFIX/drive_c/is-unicode.exe" "http://www.jrsoftware.org/download.php/is-unicode.exe"
WINEPREFIX="$WINEPREFIX" wine "$WINEPREFIX/drive_c/is-unicode.exe" 2>&1 /dev/null
fi
# Inno Setup
# $1: Path to game exe directory
# $2: true if 64 bits release
create_installer () {
ln -s "$1" "$WINEPREFIX/drive_c/game"
if [[ -n $ICON ]]; then
cd "$PROJECT_DIR"
ln -s "$ICON" "$WINEPREFIX/drive_c/game.ico"
cd "$RELEASE_DIR"
else
ln -s "$1/game.ico" "$WINEPREFIX/drive_c/game.ico"
fi
cat > "$WINEPREFIX/drive_c/innosetup.iss" <<EOF
#define MyAppName "$TITLE"
#define MyAppVersion "$GAME_VERSION"
#define MyAppPublisher "$AUTHOR"
#define MyAppURL "$URL"
#define MyAppExeName "${TITLE}.exe"
[Setup]
;ArchitecturesInstallIn64BitMode=x64 ia64
AppId={{$APPID}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
OutputBaseFilename=${IDENTITY}-setup
SetupIconFile=C:\\game.ico
Compression=lzma
SolidCompression=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[Files]
EOF
if [[ $2 == true ]]; then
sed -i 's/;ArchitecturesInstallIn64BitMode/ArchitecturesInstallIn64BitMode/' "$WINEPREFIX/drive_c/innosetup.iss"
fi
for file in $1; do
echo "Source: \"C:\\game\\$file\"; DestDir: \"{app}\"; Flags: ignoreversion" \
>> "$WINEPREFIX"/drive_c/innosetup.iss
done
WINEPREFIX="$WINEPREFIX" wine "$INNOSETUP" /Q 'c:\innosetup.iss'
mv "$WINEPREFIX/drive_c/Output/$IDENTITY-setup.exe" .
rm -rf "$WINEPREFIX/drive_c/{game,game.ico,innosetup.iss,Output}"
}
fi
${X32:=false}
${X64:=false}
if [[ $X32 == false && $X64 == false ]]; then
X32=true
X64=true
fi
create_love_file 9
cd "$RELEASE_DIR"
# Windows 32-bits
if [[ $X32 == true ]]; then
if [[ ! -f "$CACHE_DIR/love-$LOVE_VERSION-win32.zip" ]]; then
if compare_version "$LOVE_VERSION" '>=' '0.9.0'; then
curl -L -C - -o "$CACHE_DIR/love-$LOVE_VERSION-win32.zip" "https://bitbucket.org/rude/love/downloads/love-$LOVE_VERSION-win32.zip"
else
curl -L -C - -o "$CACHE_DIR/love-$LOVE_VERSION-win32.zip" "https://bitbucket.org/rude/love/downloads/love-$LOVE_VERSION-win-x86.zip"
fi
fi
unzip -qq "$CACHE_DIR/love-$LOVE_VERSION-win32.zip"
if [[ -n $ICON ]]; then
WINEPREFIX="$WINEPREFIX" wine "$RESHACKER" \
-addoverwrite "love-$LOVE_VERSION-win32/love.exe,love-$LOVE_VERSION-win32/love.exe,$ICON,ICONGROUP,MAINICON,0" 2>&1 /dev/null
fi
cat love-$LOVE_VERSION-win32/love.exe "$LOVE_FILE" > "love-$LOVE_VERSION-win32/${TITLE}.exe"
rm love-$LOVE_VERSION-win32/love.exe
mv love-$LOVE_VERSION-win32 "$TITLE"-win32
if [[ $INSTALLER == true ]]; then
rm -rf "$IDENTITY-setup-win32.exe" 2> /dev/null
create_installer "$TITLE-win32"
mv "$IDENTITY-setup.exe" "$IDENTITY-setup-win32.exe"
else
zip -FS -9 -qr "$TITLE-win32.zip" "$TITLE-win32"
fi
rm -rf "$TITLE-win32"
fi
## Windows 64-bits ##
if [[ $X64 == true ]] && compare_version "$LOVE_VERSION" '>=' '0.8.0'; then
if [[ ! -f "$CACHE_DIR/love-$LOVE_VERSION-win64.zip" ]]; then
if compare_version "$LOVE_VERSION" '>=' '0.9.0'; then
curl -L -C - -o "$CACHE_DIR/love-$LOVE_VERSION-win64.zip" "https://bitbucket.org/rude/love/downloads/love-$LOVE_VERSION-win64.zip"
else
curl -L -C - -o "$CACHE_DIR/love-$LOVE_VERSION-win-x64.zip" "https://bitbucket.org/rude/love/downloads/love-$LOVE_VERSION-win-x64.zip"
fi
fi
unzip -qq "$CACHE_DIR/love-$LOVE_VERSION-win64.zip"
if [[ -n $ICON ]]; then
WINEPREFIX="$WINEPREFIX" wine "$RESHACKER" \
-addoverwrite "love-$LOVE_VERSION-win64/love.exe,love-$LOVE_VERSION-win64/love.exe,$ICON,ICONGROUP,MAINICON,0" 2>&1 /dev/null
fi
cat love-$LOVE_VERSION-win64/love.exe "$LOVE_FILE" > "love-$LOVE_VERSION-win64/${TITLE}.exe"
rm love-$LOVE_VERSION-win64/love.exe
mv love-$LOVE_VERSION-win64 "$TITLE-win64"
if [[ $INSTALLER == true ]]; then
rm -rf "$IDENTITY-setup-win64.exe" 2> /dev/null
create_installer "$TITLE-win64" "true"
mv "$IDENTITY-setup.exe" "$IDENTITY-setup-win64.exe"
else
zip -FS -9 -qr "$TITLE-win64.zip" "$TITLE-win64"
fi
rm -rf "$TITLE-win64"
fi
exit_module