Distribution, lets tackle this thing
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Distribution, lets tackle this thing
A lot of people ask how to distribute there love2d games on different platforms, so here's a list of solutions for distributing your games on various platforms. Just a quick and dirty description on how to do it, the individual can determine how to go about doing it.
Windows
Windows is probably one of the easier platforms to distribute on. You can just bundle an exe and distribute the exe and the DLLs in a zip, or you can make an installer with Windows Installer, provided with the Windows Software SDK. This is probably your best option.
Linux:
Bundle the executable and .love.
Debian/Ubuntu
Use the repositories. You can use a deb file to install a repository, add your game's repository, and love's repository. The deb should then install your game, and the latest version of love. You can also add menu items and desktop shortcuts. You can use the repositories to distribute updates also.
Redhat/fedora
Use the repositories. Create a RPM to install love and game repositories. The RPM can then install love and your game.
OS X
OS X has a application distributing format a lot like love. Instead they have .app's(they're actually folders) which contain libraries and executable's. The downfall of this is often times you can't share dynamic libraries easily. For this you'll have to ship a version of love with your .app. To do this you have to bundle your executable with your engine(as seen on the wiki), you can then use xcode to bundle your engine and the libraries into a .app
Windows
Windows is probably one of the easier platforms to distribute on. You can just bundle an exe and distribute the exe and the DLLs in a zip, or you can make an installer with Windows Installer, provided with the Windows Software SDK. This is probably your best option.
Linux:
Bundle the executable and .love.
Debian/Ubuntu
Use the repositories. You can use a deb file to install a repository, add your game's repository, and love's repository. The deb should then install your game, and the latest version of love. You can also add menu items and desktop shortcuts. You can use the repositories to distribute updates also.
Redhat/fedora
Use the repositories. Create a RPM to install love and game repositories. The RPM can then install love and your game.
OS X
OS X has a application distributing format a lot like love. Instead they have .app's(they're actually folders) which contain libraries and executable's. The downfall of this is often times you can't share dynamic libraries easily. For this you'll have to ship a version of love with your .app. To do this you have to bundle your executable with your engine(as seen on the wiki), you can then use xcode to bundle your engine and the libraries into a .app
- slime
- Solid Snayke
- Posts: 3132
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: Distribution, lets tackle this thing
OSX is one of the simplest, actually. For basic distribution you just have to download the LÖVE .app, put your .love file into love.app/Contents/Resources/ , and it will Just Work. You will probably want to modify the .plist file to be specific to your game though, and you can swap out the .icns for a custom one too.tsturzl wrote:OS X
OS X has a application distributing format a lot like love. Instead they have .app's(they're actually folders) which contain libraries and executable's. The downfall of this is often times you can't share dynamic libraries easily. For this you'll have to ship a version of love with your .app. To do this you have to bundle your executable with your engine(as seen on the wiki), you can then use xcode to bundle your engine and the libraries into a .app
Last edited by slime on Tue Mar 13, 2012 5:24 pm, edited 1 time in total.
- nevon
- Commander of the Circuloids
- Posts: 938
- Joined: Thu Feb 14, 2008 8:25 pm
- Location: Stockholm, Sweden
- Contact:
Re: Distribution, lets tackle this thing
The next time I'm in my Linux partition, I'll share my set up for distributing a LÖVE game via a PPA.
- Jasoco
- Inner party member
- Posts: 3725
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Distribution, lets tackle this thing
It is the simplest. Since installation of Löve on OS X consists of opening the DMG and dragging the .app to the hard drive. I have 7 different versions of Löve all installed right now because each one uses its own libraries in a self-contained package. Creating a self-contained game takes the few steps you mentioned above with nothing else required at all.slime wrote:OSX is one of the simplest, actually. For basic distribution you just have to download the LÖVE .app, put your .love file into love.app/Contents/Resources/ , and it will Just Work. You will probably want to modify the .plist file to be specific to your game though, and you can swap out the .icns for a custom one too.
I'm prepared for anything.
Re: Distribution, lets tackle this thing
Lol Jasoco xD
Woo OS X!
Unfortunately I'm poor so when my five year old macbook died I had to get a PC. I'm fairly happy with it though.
Woo OS X!
Unfortunately I'm poor so when my five year old macbook died I had to get a PC. I'm fairly happy with it though.
Re: Distribution, lets tackle this thing
For Arch Linux, just depend on the love package in the [community] repo, and create a simple launcher script.
See the mari0 AUR package.
See the mari0 AUR package.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Distribution, lets tackle this thing
I'm very interested on this. I've tried to create .deb files and ppas in the past and failed miserably.nevon wrote:The next time I'm in my Linux partition, I'll share my set up for distributing a LÖVE game via a PPA.
When I write def I mean function.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Distribution, lets tackle this thing
Me too. I have made a single .deb package (for a dice roll program) and I failed to make a PPA for it. (Also, I couldn't get anything .deb related to work for SELÖVE.)kikito wrote:I'm very interested on this. I've tried to create .deb files and ppas in the past and failed miserably.nevon wrote:The next time I'm in my Linux partition, I'll share my set up for distributing a LÖVE game via a PPA.
Help us help you: attach a .love.
- nevon
- Commander of the Circuloids
- Posts: 938
- Joined: Thu Feb 14, 2008 8:25 pm
- Location: Stockholm, Sweden
- Contact:
Re: Distribution, lets tackle this thing
Alright, here we go. This is not a guide on how to create a stand-alone deb (though I could probably do that as well, if I can remember how). It's a guide on how to set up a PPA. The script I'll provide requires you to have your code available from a remote repository. In my case it's a git repo. You also need to have created a user account on Launchpad, accepted the Ubuntu Code of Conduct, created a PPA (you can do that in the web UI), and generated a gpg key and uploaded it to Launchpad.
It's been quite a while since me and Bart wrote this, so I don't honestly recall what everything does. Maybe Bart can chime in and explain what I don't remember. I'm not going to go into too much depth on what everything does, so I'd highly recommend that you look things up in the Ubuntu Wiki Packaging Guide.
In this example, I'm going to be using "appname", "launcher", "iconname" and so on. Replace those with names that are specific to your application.
First of all, we need to set up a directory structure with some metadata and various control files for the package. This is what the directory should look like when we're done:
base
Base contains icons, a launcher script, a desktop file and a makefile. I'll go through each in order.
icons
Within the icons folder, you should basically replicate the structure found in /usr/share/icons/. Not much else to say, really. I've only included a few icon sizes, but you can have as many or as few as you'd like.
launcher
The launcher is what's going to end up in /usr/bin, and is used to launch your game.
appname.desktop
A desktop file contains information that will be shown in the desktop menu. It gives the menu entry a name, a description, a path to the launcher, an icon, etc. Remember that Exec should point to the launcher, and iconname should be the same as the icons you added to icons/SIZExSIZE/
Makefile
The makefile contains commands to run when the package is installed or removed. What needs to be done is different in every case, but I'll give you an example nonetheless. During the installation, it basically creates the directories we need, as well as copies the files we need into those directories. Similarly, during uninstallation, it removes said files and directories.
debian
The debian directory (this is back in the root level. Check the directory tree) contains a bunch of data about the package. Again, I'll go through each file separately.
compat
This sets the debhelper compatibility level. More info on that here. For now, this is what it should look like:
control
The control file contains data that will be used by the package manager. It's here that you'll list dependencies, for example.
copyright
Pretty self-explanatory. Just throw your copyright information in here.
menu
In case the window manager doesn't use desktop files, you can use the menu file to define that stuff as well.
rules
I'm not even going to pretend that I know what this does. The rules file is a separate makefile for the application that actually builds the package. I'm fairly sure this one just tells dh to go fuck itself.
source/format
(source is a directory within the debian directory. It contains a file named format)
format contains information regarding the desired format for the source package. We want a native debian package, so it should just contain:
That's it for the directories and shit. Onto the build process itself!
Building
Note: In this example, I'm cloning from a git repo. You can just as well copy from a local directory, download via wget or whatever.
Packaging is so unlovely. I suggest that you try running each of the commands in the script manually and try to follow along with it. I have a feeling that'll make things more clear.
It's been quite a while since me and Bart wrote this, so I don't honestly recall what everything does. Maybe Bart can chime in and explain what I don't remember. I'm not going to go into too much depth on what everything does, so I'd highly recommend that you look things up in the Ubuntu Wiki Packaging Guide.
In this example, I'm going to be using "appname", "launcher", "iconname" and so on. Replace those with names that are specific to your application.
First of all, we need to set up a directory structure with some metadata and various control files for the package. This is what the directory should look like when we're done:
Code: Select all
├── base
│ ├── icons
│ │ ├── 22x22
│ │ │ └── apps
│ │ │ └── iconname.png
│ │ ├── 24x24
│ │ │ └── apps
│ │ │ └── iconname.png
│ │ ├── 32x32
│ │ │ └── apps
│ │ │ └── iconname.png
│ │ ├── 48x48
│ │ │ └── apps
│ │ │ └── iconname.png
│ │ └── scalable
│ │ └── apps
│ │ └── iconname.svg
│ ├── Makefile
│ ├── launcher
│ └── appname.desktop
└── debian
├── compat
├── control
├── copyright
├── menu
├── rules
└── source
└── format
Base contains icons, a launcher script, a desktop file and a makefile. I'll go through each in order.
icons
Within the icons folder, you should basically replicate the structure found in /usr/share/icons/. Not much else to say, really. I've only included a few icon sizes, but you can have as many or as few as you'd like.
launcher
The launcher is what's going to end up in /usr/bin, and is used to launch your game.
Code: Select all
#!/usr/bin/env bash
love /usr/lib/gamename/appname.love
A desktop file contains information that will be shown in the desktop menu. It gives the menu entry a name, a description, a path to the launcher, an icon, etc. Remember that Exec should point to the launcher, and iconname should be the same as the icons you added to icons/SIZExSIZE/
Code: Select all
[Desktop Entry]
Name=appname
Comment=A description of your game.
Exec=/usr/bin/launcher
Type=Application
Categories=Game;
Terminal=false
Icon=iconname
The makefile contains commands to run when the package is installed or removed. What needs to be done is different in every case, but I'll give you an example nonetheless. During the installation, it basically creates the directories we need, as well as copies the files we need into those directories. Similarly, during uninstallation, it removes said files and directories.
Code: Select all
CP=cp -r
ZIP=zip -r
RM=rm -rIf
MKDIR=mkdir -p
RMDIR=rmdir -p --ignore-fail-on-non-empty
appname.love:
cd love; \
$(ZIP) ../appname.love *
install: all
$(MKDIR) $(DESTDIR)/usr/bin/
$(MKDIR) $(DESTDIR)/usr/lib/appname/
$(MKDIR) $(DESTDIR)/usr/share/applications/
$(MKDIR) $(DESTDIR)/usr/share/icons/hicolor
$(CP) appname.love $(DESTDIR)/usr/lib/appname/
$(CP) launcher $(DESTDIR)/usr/bin/
$(CP) appname.desktop $(DESTDIR)/usr/share/applications/
$(CP) icons/* $(DESTDIR)/usr/share/icons/hicolor/
uninstall:
$(RM) $(DESTDIR)/usr/lib/appname/appname.love
$(RM) $(DESTDIR)/usr/bin/launcher
$(RM) $(DESTDIR)/usr/share/applications/appname.desktop
$(RM) $(DESTDIR)/usr/share/icons/hicolor/icons/32x32/apps/iconname.png
$(RM) $(DESTDIR)/usr/share/icons/hicolor/icons/22x22/apps/iconname.png
$(RM) $(DESTDIR)/usr/share/icons/hicolor/icons/24x24/apps/iconname.png
$(RM) $(DESTDIR)/usr/share/icons/hicolor/icons/48x48/apps/iconname.png
$(RM) $(DESTDIR)/usr/share/icons/hicolor/icons/scalable/apps/iconname.svg
$(RMDIR) $(DESTDIR)/usr/lib/appname
$(RMDIR) $(DESTDIR)/usr/bin/
$(RMDIR) $(DESTDIR)/usr/share/applications/
$(RMDIR) $(DESTDIR)/usr/share/icons/hicolor
clean:
$(RM) appname.love
distclean: clean
all: appname.love launcher appname.desktop
The debian directory (this is back in the root level. Check the directory tree) contains a bunch of data about the package. Again, I'll go through each file separately.
compat
This sets the debhelper compatibility level. More info on that here. For now, this is what it should look like:
Code: Select all
7
The control file contains data that will be used by the package manager. It's here that you'll list dependencies, for example.
Code: Select all
Source: appname
Section: games
Priority: optional
Maintainer: Your Name <[email protected]>
Build-Depends: debhelper (>= 7), zip
Standards-Version: 3.8.4
Homepage: http://url.to/your-applications-website/
Package: appname
Architecture: any
Depends: love (>= 0.7.2), ${shlibs:Depends}, ${misc:Depends}
Description: App Title On Its Own Line
A multiline description where each line is indented by two spaces.
Pretty self-explanatory. Just throw your copyright information in here.
menu
In case the window manager doesn't use desktop files, you can use the menu file to define that stuff as well.
Code: Select all
?package(appname):needs="X11|text|vc|wm" section="Games" title="apptitle" command="/usr/bin/launcher"
I'm not even going to pretend that I know what this does. The rules file is a separate makefile for the application that actually builds the package. I'm fairly sure this one just tells dh to go fuck itself.
Code: Select all
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
%:
dh $@
(source is a directory within the debian directory. It contains a file named format)
format contains information regarding the desired format for the source package. We want a native debian package, so it should just contain:
Code: Select all
3.0 (native)
Building
Note: In this example, I'm cloning from a git repo. You can just as well copy from a local directory, download via wget or whatever.
Code: Select all
#!/bin/bash
### Configuration ###
#repo location
REPO="git://github.com/username/yourrepo.git"
#ppa
PPA=ppa:launchpadusername/ppaname
#Here you define the target distribution version. In this example, we're telling Launchpad that this should be for Ubuntu 12.04, Precise Pangolin.
if [ "x$DISTRIBUTION" == "x" ]; then
DISTRIBUTION=precise
DISTRIBVERSION=12.04
fi
#Package version
VERSION=1.0.0
#path to the prepared directories
DEBIANDIR=$HOME/emptypackagedir/debian
BASEDIR=$HOME/emptypackagedir/base
#maintainer data
MAINTAINER="Your Name"
MAINTAINEREMAIL="[email protected]"
### The Script ###
export LC_ALL=C
#Create a temporary directory where we'll put everything together.
TEMPDIR=`mktemp -d /tmp/omgwordsppa.XXXXXX` || exit 1
pushd $TEMPDIR
#Clone the game from the repo
git clone $REPO appname
cd appname
#Prepare a changelog from the latest git commit
REVDESC=$(git log HEAD^1..HEAD | tail -n 1)
cd ..
DIRNAME="appname-${VERSION}~${DISTRIBVERSION}ppa3"
mkdir $DIRNAME
cd $DIRNAME
mkdir love
cp -r ../appname/* love/
cp -r $BASEDIR/* .
#dh_make takes the directory we've just created and "debianizes" it.
#More information: http://manpages.ubuntu.com/manpages/karmic/man8/dh_make.8.html
dh_make -s -e $MAINTAINEREMAIL --createorig
rm -r debian
cp -r $DEBIANDIR .
#Here we actually create the changelog
(echo "omgwords (${VERSION}~${DISTRIBVERSION}ppa3) ${DISTRIBUTION}; urgency=low" && echo "" && echo " * $REVDESC" && echo "" && echo -n " -- $MAINTAINER <$MAINTAINEREMAIL> " && date -R) | cat > debian/changelog
#Now we build. -S specifies that we want to build a source package. I don't remember what -sa does, and I can't seem to find it either.
debuild -S -sa
cd ..
#Upload the changes to the ppa
dput $PPA omgwords_${VERSION}~${DISTRIBVERSION}ppa3_source.changes
popd
#cleanup
rm -rf $TEMPDIR
Last edited by nevon on Wed Mar 14, 2012 9:51 am, edited 1 time in total.
Re: Distribution, lets tackle this thing
Great guide, nevon. One error, though:
nevon wrote: MakefileCode: Select all
uninstall: $(RM) $(DESTDIR)/usr/lib/omgwords/appname.love
Who is online
Users browsing this forum: Imnotaplayer, Semrush [Bot] and 83 guests