solarus: Fix problems with recipe

* Now builds and runs
* Included patch to make solarus use
  luajit vs lua51, however as solarus seems
  to crash loading any game, i'm opting for
  the known should-be-working lua51
This commit is contained in:
Alexander von Gluck IV
2014-01-15 17:31:15 -06:00
parent 07beea3fb7
commit 7bfe0c3ccc
2 changed files with 90 additions and 13 deletions

View File

@@ -0,0 +1,75 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 782799a..c17a479 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,7 +16,7 @@ find_package(OpenAL REQUIRED)
find_package(VorbisFile REQUIRED)
find_package(Ogg REQUIRED)
find_package(ModPlug REQUIRED)
-find_package(Lua51 REQUIRED)
+find_package(LuaJIT REQUIRED)
find_package(PhysFS REQUIRED)
# Explicit link to libdl is needed for Lua on some systems.
diff --git a/cmake/modules/FindLuaJIT.cmake b/cmake/modules/FindLuaJIT.cmake
new file mode 100644
index 0000000..6b45ed6
--- /dev/null
+++ b/cmake/modules/FindLuaJIT.cmake
@@ -0,0 +1,56 @@
+# Locate LuaJIT library
+# This module defines
+# LUAJIT_FOUND, if false, do not try to link to Lua
+# LUA_LIBRARIES
+# LUA_INCLUDE_DIR, where to find lua.h
+# LUAJIT_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
+
+## Copied from default CMake FindLua51.cmake
+
+find_path(LUA_INCLUDE_DIR luajit.h
+ HINTS
+ ENV LUA_DIR
+ PATH_SUFFIXES include/luajit-2.0 include
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+ /opt
+)
+
+find_library(LUA_LIBRARY
+ NAMES luajit-5.1
+ HINTS
+ ENV LUA_DIR
+ PATH_SUFFIXES lib
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+)
+
+if(LUA_LIBRARY)
+ set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
+endif()
+
+if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/luajit.h")
+ file(STRINGS "${LUA_INCLUDE_DIR}/luajit.h" luajit_version_str REGEX "^#define[ \t]+LUAJIT_VERSION[ \t]+\"LuaJIT .+\"")
+
+ string(REGEX REPLACE "^#define[ \t]+LUAJIT_VERSION[ \t]+\"LuaJIT ([^\"]+)\".*" "\\1" LUAJIT_VERSION_STRING "${luajit_version_str}")
+ unset(luajit_version_str)
+endif()
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
+# all listed variables are TRUE
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJIT
+ REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
+ VERSION_VAR LUAJIT_VERSION_STRING)
+
+mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)
+

View File

@@ -5,38 +5,40 @@ Solarus is an open-source Zelda-like 2D game engine.
HOMEPAGE="http://solarus-games.org"
SRC_URI="http://www.solarus-games.org/downloads/solarus/solarus-1.1.1-src.tar.gz"
CHECKSUM_MD5="168894091ce4b728889069c767a1532d"
REVISION="1"
REVISION="2"
LICENSE="GNU GPL v3"
COPYRIGHT="2006-2013 Christopho, Solarus"
ARCHITECTURES="!x86_gcc2 !x86 !x86_64"
SECONDARY_ARCHITECTURES="!x86 !x86_64"
ARCHITECTURES="x86_gcc2 !x86 !x86_64"
SECONDARY_ARCHITECTURES="x86 !x86_64"
PROVIDES="
solarus = $portVersion
app:solarus = $portVersion
solarus$secondaryArchSuffix = $portVersion
cmd:solarus = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix >= $haikuVersion
lib:libSDL$secondaryArchSuffix
lib:sdl_ttf$secondaryArchSuffix
lib:sdl_image$secondaryArchSuffix
lib:libsdl_ttf$secondaryArchSuffix
lib:libsdl_image$secondaryArchSuffix
lib:libvorbis$secondaryArchSuffix
lib:libmodplug$secondaryArchSuffix >= 0.8.0
lib:libphysfs$secondaryArchSuffix
lib:liblua$secondaryArchSuffix
lib:liblua$secondaryArchSuffix == 5.1.4
lib:libopenal$secondaryArchSuffix
lib:libogg$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel >= $haikuVersion
devel:libSDL$secondaryArchSuffix
devel:sdl_ttf$secondaryArchSuffix
devel:sdl_image$secondaryArchSuffix
devel:libsdl_ttf$secondaryArchSuffix
devel:libsdl_image$secondaryArchSuffix
devel:libvorbis$secondaryArchSuffix
devel:libmodplug$secondaryArchSuffix >= 0.8.0
devel:libphysfs$secondaryArchSuffix
devel:liblua$secondaryArchSuffix
devel:liblua$secondaryArchSuffix == 5.1.4
devel:libopenal$secondaryArchSuffix
devel:libogg$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
@@ -48,12 +50,12 @@ BUILD_PREREQUIRES="
BUILD()
{
cmake -DCMAKE_BUILD_TYPE=Release .
cmake -DCMAKE_INSTALL_PREFIX="$prefix" \
-DCMAKE_BUILD_TYPE=Release .
make $jobArgs
}
INSTALL()
{
make install
#addAppDeskbarSymlink $binDir/solarus
}