Difference between revisions of "Building LÖVE"

m (adding a library to Ubuntu/Debian)
 
(65 intermediate revisions by 23 users not shown)
Line 1: Line 1:
'''Note: This page is still incomplete.'''
+
{{notice|This page is still incomplete, you are likely to be eaten by a grue.}}
 +
{{notice|This page has information on compiling the LÖVE source code. This is only necessary if you want to make modifications or additions to the framework itself, or if a binary is not provided for your platform (for example, GNU/Linux distributions other than Ubuntu or 32-bit GNU/Linux). If you just want to code a game in Lua, go back to [[Getting Started]].}}
 +
{{notice|LÖVE for Android has its own build instructions which deviates entirely from this page. See the [https://github.com/love2d/love-android repository] for more information!}}
  
If you want to build the LÖVE source code yourself, this page has all the information you need.
+
Still interested? Okay. Follow these three steps and you'll have your very own LÖVE binary:
 +
#[[#1._Getting_the_source|Getting the source]]
 +
#[[#2._Dependencies|Dependencies]]
 +
#[[#3._Building|Building]]
  
== Linux ==
+
== 1. Getting the source ==
 +
The official repository of LÖVE is hosted on [https://github.com/love2d/love GitHub].
  
=== Dependencies ===
+
You can download the source code either by downloading an archive from one of the tags on the [https://github.com/love2d/love/releases download page] or by installing Git and cloning the repository. Almost every Linux distributions have Git in their repositories, some even have it installed by default. Windows and OS X users can get the official binary of Git from [https://git-scm.com/downloads here].
  
You'll need Mercurial to download the latest sources, along with the LÖVE dependencies.
+
To create a clone with Git, open a terminal or command prompt, go to the directory that you want to download the source code folder to and use the following commands:
 +
<source lang="bash">
 +
git clone https://github.com/love2d/love
 +
</source>
 +
This will create a love folder and download the latest source code into it.
  
==== Ubuntu ====
+
If you want to use the source code of a specific version, go into the love directory and issue one of the following commands:
 
<source lang="bash">
 
<source lang="bash">
sudo apt-get install mercurial build-essential automake libmpg123-dev libmodplug-dev libphysfs-dev libfreetype6-dev libdevil-dev liblua5.1-0-dev libopenal-dev libsdl1.2-dev libvorbis-dev
+
git checkout 0.8.0 # any (released) version from 0.6.0 onwards.
 +
git checkout 0.7.2
 +
git checkout main # to the latest commit at stable branch (currently 11.x)
 +
git checkout 12.0-development # to the latest commit at upcoming version 12.0
 
</source>
 
</source>
  
Older versions of Ubuntu need the latest [http://packages.ubuntu.com/natty/libmodplug1 libmodplug1] and [http://packages.ubuntu.com/natty/libmodplug-dev libmodplug-dev] packages.
+
== 2. Dependencies ==
 +
LÖVE uses several open source libraries such as Lua, libvorbis, etc. Some are shipped alongside LÖVE source code but some must be installed manually. Those libraries and their development files are required to successfully build LÖVE. It's possible to build every dependency yourself, but this is out of the scope of this page. The following explains how you can get prebuilt binaries instead.
 +
 
 +
=== Windows ===
 +
The dependencies and instructions for LÖVE [[0.9.0]]+ can be found [https://github.com/love2d/megasource here].
 +
 
 +
=== Mac OS X ===
 +
The required pre-built frameworks are available [https://love2d.org/sdk/ here]. Place the frameworks in <code>/Library/Frameworks/</code> in order for LÖVE's Xcode project to recognize them.
 +
 
 +
=== Linux ===
 +
Download the development packages of the dependencies from the repository of your distribution.
 +
 
 +
==== Ubuntu and Debian Jessie onwards ====
 +
<source lang="bash">
 +
sudo apt-get install build-essential autotools-dev automake libtool pkg-config \
 +
libfreetype6-dev libluajit-5.1-dev libsdl2-dev libopenal-dev libogg-dev \
 +
libvorbis-dev libmodplug-dev libmpg123-dev libtheora-dev libharfbuzz-dev
 +
</source>
 +
These are taken from the <code>platform/unix/debian/control.in</code> file in the repository.
 +
 
 +
For the 0.9.0 branch, older versions of Ubuntu need the latest libsdl2-dev packages, which can be found via this ppa: https://launchpad.net/~bartbes/+archive/love-stable
 +
 
 +
If you get an error during the build complaining about libturbojpeg, you must first fix a bug in Ubuntu, then run `configure` again:
 +
<source lang="bash">
 +
ln -s /usr/lib/x86_64-linux-gnu/libturbojpeg.so.0 /usr/lib/x86_64-linux-gnu/libturbojpeg.so
 +
</source>
 +
 
 +
Notes: Prior to [[11.0]], <code>libphysfs-dev</code> is also needed. Starting from [[12.0]], <code>libmpg123-dev</code> is no longer needed.
  
 
==== Arch Linux ====
 
==== Arch Linux ====
 
<source lang="bash">
 
<source lang="bash">
pacman -S mercurial
+
pacman -S devil flac freetype2 glibc libmodplug libvorbis lua51 mesa mpg123 openal physfs sdl # 0.6.x
pacman -S devil flac freetype2 glibc libmodplug libvorbis lua mesa mpg123 openal physfs sdl # 0.6.x
+
pacman -S devil freetype2 libmodplug libvorbis lua51 mpg123 openal physfs sdl # 0.7.x
pacman -S devil freetype2 libmodplug libvorbis lua mpg123 openal physfs # 0.7.x
+
pacman -S luajit physfs freetype2 devil mpg123 openal libvorbis libmodplug sdl2 shared-mime-info hicolor-icon-theme desktop-file-utils # for 0.9.x (taken from package in repository)
 +
pacman -S luajit freetype2 mpg123 openal libvorbis libtheora libmodplug sdl2 shared-mime-info hicolor-icon-theme desktop-file-utils # for 11.x
 +
pacman -S luajit freetype2 openal libvorbis libtheora libmodplug sdl2 shared-mime-info hicolor-icon-theme desktop-file-utils # for 12.x
 
</source>
 
</source>
  
 
==== Fedora ====
 
==== Fedora ====
 
<source lang="bash">
 
<source lang="bash">
yum install mercurial flac-devel freetype-devel glibc-devel libmpg123-devel libmodplug-devel physfs-devel mesa-libGL-devel openal-soft-devel DevIL-devel libvorbis-devel SDL-devel libmng-devel libtiff-devel
+
dnf install freetype-devel glibc-devel libmpg123-devel libmodplug-devel physfs-devel mesa-libGL-devel openal-soft-devel DevIL-devel libvorbis-devel SDL-devel libmng-devel libtiff-devel lua-devel gcc-c++ libtool  luajit luajit-devel libtheora-devel SDL2-devel
 
</source>
 
</source>
  
==== Debian Squeeze ====
+
Please note that libmpg123-devel is in the rpmfusion-free repository.
 +
 
 +
==== Debian Wheezy ====
 
Install the following packages (using aptitude or apt):
 
Install the following packages (using aptitude or apt):
  
 
<source lang="bash">
 
<source lang="bash">
aptitude install mercurial automake libtool libphysfs-dev libsdl-dev libopenal-dev liblua5.1-0-dev libdevil-dev libmodplug-dev libmpg123-dev libvorbis-dev  
+
aptitude install build-essential automake libtool libphysfs-dev libsdl-dev libopenal-dev liblua5.1-0-dev libdevil-dev libmodplug-dev libfreetype6-dev libmpg123-dev libvorbis-dev libmng-dev libxpm-dev libxcursor-dev libXxf86vm-dev  
 
</source>
 
</source>
  
Afterwards, just get the source code and build it like it is mentioned below. It's e-a-s-y! :)
+
Afterwards, just build it like it is mentioned below, but passing the <code>--with-lua=lua</code> option to <code>./configure</code>
  
==== Other distributions ====
+
If you want or need to use LuaJIT, you will need to either backport the Debian packaged from Jessie, or build it from the upstream source.
todo: add stuff here!
 
  
=== Getting the sources ===
+
==== Mageia 2 ====
 +
<source lang="bash">
 +
urpmi make automake autoconf libopenal-devel libtool libtool-base libphysfs-devel libSDL-devel lua liblua-devel libdevil-devel libmodplug-devel libfreetype6-devel libmpg123-devel libvorbis-devel libmng-devel libxpm-devel libxcursor-devel libxxf86vm-devel
 +
</source>
  
The next step is downloading the LÖVE source code. Open a terminal and go to the directory that you want to download the source code folder to. Next, use the following commands:
+
==== Gentoo ====
 +
<source lang="bash">
 +
emerge -va lua physfs libsdl opengl devil freetype openal libvorbis mpg123 libmodplug
 +
</source>
 +
Make sure you have autotools installed (which should normally be the case):
 
<source lang="bash">
 
<source lang="bash">
hg clone https://bitbucket.org/rude/love && cd love
+
emerge -va automake autoconf libtool
# if you want to use the source code of a specific version, issue one of the following commands:
 
# todo: add stuff here!
 
 
</source>
 
</source>
  
=== Building ===
+
==== Other distributions ====
 +
Any other distribution will most likely have the dependencies in their repositories too, possibly with slightly different package names.
 +
 
 +
== 3. Building ==
 +
=== Windows ===
 +
Follow the instructions at the [https://github.com/love2d/megasource megasource] repository page to build LÖVE 0.9.0+.
 +
 
 +
Be sure to keep the required DLLs in the same folder as love.exe when running the executable.
 +
 
 +
=== Mac OS X ===
 +
Open the <code>love.xcodeproj</code> file with Xcode and press 'build', or use the <code>xcodebuild</code> command-line utility.
 +
 
 +
=== Linux ===
 +
Use the automagic script to generate the configure file and then run configure and make as usual.
 +
 
 +
Be aware that if you got your source from the [https://love2d.org/ LÖVE homepage] your configure script has been pre-generated. This means that the ./platform/unix/automagic step should be skipped.
  
 
<source lang="bash">
 
<source lang="bash">
sh platform/unix/automagic
+
./platform/unix/automagic
 
./configure
 
./configure
 
make
 
make
 
</source>
 
</source>
 +
 
Your LÖVE binary will end up in the src directory.
 
Your LÖVE binary will end up in the src directory.
 +
 +
Note: If you need to build an AppImage, check [https://github.com/love2d/love-appimage-source love-appimage-source] repository instead.
 +
 +
== Other Languages ==
 +
{{i18n|Building LÖVE}}
 +
 +
[[Category:LÖVE]]

Latest revision as of 22:22, 27 June 2024

O.png This page is still incomplete, you are likely to be eaten by a grue.  


O.png This page has information on compiling the LÖVE source code. This is only necessary if you want to make modifications or additions to the framework itself, or if a binary is not provided for your platform (for example, GNU/Linux distributions other than Ubuntu or 32-bit GNU/Linux). If you just want to code a game in Lua, go back to Getting Started.  


O.png LÖVE for Android has its own build instructions which deviates entirely from this page. See the repository for more information!  


Still interested? Okay. Follow these three steps and you'll have your very own LÖVE binary:

  1. Getting the source
  2. Dependencies
  3. Building

1. Getting the source

The official repository of LÖVE is hosted on GitHub.

You can download the source code either by downloading an archive from one of the tags on the download page or by installing Git and cloning the repository. Almost every Linux distributions have Git in their repositories, some even have it installed by default. Windows and OS X users can get the official binary of Git from here.

To create a clone with Git, open a terminal or command prompt, go to the directory that you want to download the source code folder to and use the following commands:

git clone https://github.com/love2d/love

This will create a love folder and download the latest source code into it.

If you want to use the source code of a specific version, go into the love directory and issue one of the following commands:

git checkout 0.8.0		# any (released) version from 0.6.0 onwards.
git checkout 0.7.2
git checkout main		# to the latest commit at stable branch (currently 11.x)
git checkout 12.0-development	# to the latest commit at upcoming version 12.0

2. Dependencies

LÖVE uses several open source libraries such as Lua, libvorbis, etc. Some are shipped alongside LÖVE source code but some must be installed manually. Those libraries and their development files are required to successfully build LÖVE. It's possible to build every dependency yourself, but this is out of the scope of this page. The following explains how you can get prebuilt binaries instead.

Windows

The dependencies and instructions for LÖVE 0.9.0+ can be found here.

Mac OS X

The required pre-built frameworks are available here. Place the frameworks in /Library/Frameworks/ in order for LÖVE's Xcode project to recognize them.

Linux

Download the development packages of the dependencies from the repository of your distribution.

Ubuntu and Debian Jessie onwards

sudo apt-get install build-essential autotools-dev automake libtool pkg-config \
libfreetype6-dev libluajit-5.1-dev libsdl2-dev libopenal-dev libogg-dev \
libvorbis-dev libmodplug-dev libmpg123-dev libtheora-dev libharfbuzz-dev

These are taken from the platform/unix/debian/control.in file in the repository.

For the 0.9.0 branch, older versions of Ubuntu need the latest libsdl2-dev packages, which can be found via this ppa: https://launchpad.net/~bartbes/+archive/love-stable

If you get an error during the build complaining about libturbojpeg, you must first fix a bug in Ubuntu, then run `configure` again:

ln -s /usr/lib/x86_64-linux-gnu/libturbojpeg.so.0 /usr/lib/x86_64-linux-gnu/libturbojpeg.so

Notes: Prior to 11.0, libphysfs-dev is also needed. Starting from 12.0, libmpg123-dev is no longer needed.

Arch Linux

pacman -S devil flac freetype2 glibc libmodplug libvorbis lua51 mesa mpg123 openal physfs sdl # 0.6.x
pacman -S devil freetype2 libmodplug libvorbis lua51 mpg123 openal physfs sdl # 0.7.x
pacman -S luajit physfs freetype2 devil mpg123 openal libvorbis libmodplug sdl2 shared-mime-info hicolor-icon-theme desktop-file-utils # for 0.9.x (taken from package in repository)
pacman -S luajit freetype2 mpg123 openal libvorbis libtheora libmodplug sdl2 shared-mime-info hicolor-icon-theme desktop-file-utils # for 11.x
pacman -S luajit freetype2 openal libvorbis libtheora libmodplug sdl2 shared-mime-info hicolor-icon-theme desktop-file-utils # for 12.x

Fedora

dnf install freetype-devel glibc-devel libmpg123-devel libmodplug-devel physfs-devel mesa-libGL-devel openal-soft-devel DevIL-devel libvorbis-devel SDL-devel libmng-devel libtiff-devel lua-devel gcc-c++ libtool  luajit luajit-devel libtheora-devel SDL2-devel

Please note that libmpg123-devel is in the rpmfusion-free repository.

Debian Wheezy

Install the following packages (using aptitude or apt):

aptitude install build-essential automake libtool libphysfs-dev libsdl-dev libopenal-dev liblua5.1-0-dev libdevil-dev libmodplug-dev libfreetype6-dev libmpg123-dev libvorbis-dev libmng-dev libxpm-dev libxcursor-dev libXxf86vm-dev

Afterwards, just build it like it is mentioned below, but passing the --with-lua=lua option to ./configure

If you want or need to use LuaJIT, you will need to either backport the Debian packaged from Jessie, or build it from the upstream source.

Mageia 2

urpmi make automake autoconf libopenal-devel libtool libtool-base libphysfs-devel libSDL-devel lua liblua-devel libdevil-devel libmodplug-devel libfreetype6-devel libmpg123-devel libvorbis-devel libmng-devel libxpm-devel libxcursor-devel libxxf86vm-devel

Gentoo

emerge -va lua physfs libsdl opengl devil freetype openal libvorbis mpg123 libmodplug

Make sure you have autotools installed (which should normally be the case):

emerge -va automake autoconf libtool

Other distributions

Any other distribution will most likely have the dependencies in their repositories too, possibly with slightly different package names.

3. Building

Windows

Follow the instructions at the megasource repository page to build LÖVE 0.9.0+.

Be sure to keep the required DLLs in the same folder as love.exe when running the executable.

Mac OS X

Open the love.xcodeproj file with Xcode and press 'build', or use the xcodebuild command-line utility.

Linux

Use the automagic script to generate the configure file and then run configure and make as usual.

Be aware that if you got your source from the LÖVE homepage your configure script has been pre-generated. This means that the ./platform/unix/automagic step should be skipped.

./platform/unix/automagic
./configure
make

Your LÖVE binary will end up in the src directory.

Note: If you need to build an AppImage, check love-appimage-source repository instead.

Other Languages