Add recipe for freegish.

This commit is contained in:
hometue
2016-01-05 20:55:00 +08:00
parent 98d7e2b4b2
commit e90f2f3e73
2 changed files with 177 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
SUMMARY="A free version of the game Gish"
DESCRIPTION="FreeGish is an open-source, freely redistributable version of Gish, a \
physics-based platforming game featuring a ball of tar."
HOMEPAGE="http://github.com/freegish/freegish"
COPYRIGHT="2012-2014 Joris van de Donk"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://github.com/freegish/freegish/archive/f53d9153.zip"
CHECKSUM_SHA256="2d5e0f9d24ddc648e4cdf45adf50043ec13ecd991da61166d670f4be74447665"
PATCHES="freegish-1.0.patchset"
ARCHITECTURES="?x86 x86_gcc2 ?x86_64"
PROVIDES="
freegish = $portVersion
app:FreeGish = $portVersion
"
REQUIRES="
haiku
lib:libogg
lib:libopenal
lib:libpng
lib:libsdl
lib:libvorbis
lib:libz
"
BUILD_REQUIRES="
devel:libogg
devel:libopenal
devel:libpng
devel:libsdl
devel:libvorbis
devel:libz
haiku_devel
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc
cmd:make
"
BUILD()
{
mkdir -p build && cd build
cmake .. -DDATAPATH='"$appsDir"'
make
}
INSTALL()
{
cd ..
mkdir -p $appsDir/FreeGish
cp -r freegish-1.0 $appsDir/FreeGish
mv $appsDir/FreeGish/freegish $appsDir/FreeGish/FreeGish
addAppDeskbarSymlink $appsDir/FreeGish/FreeGish
}

View File

@@ -0,0 +1,119 @@
From 62f4ee23ae8021134b861e3d6faf0dd089b075f1 Mon Sep 17 00:00:00 2001
From: Damien Lee <hometue.lee@gmail.com>
Date: Tue, 5 Jan 2016 18:51:11 +0000
Subject: Patch for Haiku and C89 standard
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ed8bf91..618d158 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,14 +14,16 @@ endif(NOT ${INSTALL_FHS})
# Uncomment this to hardcode the data path. On the command line, you
# would actually give -DDATAPATH='"/usr/share/games/gish"' or similar
# but CMake does the extra quoting for us.
-#add_definitions(-DDATAPATH="/usr/share/games/gish")
+#add_definitions(-DDATAPATH="/boot/home/config/non-packaged/bin/")
find_package(SDL REQUIRED)
find_package(OpenAL REQUIRED)
find_package(OpenGL REQUIRED)
find_package(Vorbis REQUIRED)
find_package(PNG REQUIRED)
-find_library(M_LIBRARIES m)
+if(NOT HAIKU)
+ find_library(M_LIBRARIES m)
+endif(NOT HAIKU)
include_directories(
${SDL_INCLUDE_DIR}
@@ -29,6 +31,7 @@ include_directories(
${OPENGL_INCLUDE_DIR}
${Vorbis_INCLUDE_DIR}
${PNG_INCLUDE_DIR}
+
)
if(NOT BIN_DIR)
diff --git a/src/main.c b/src/main.c
index d1f00c8..9b1a513 100644
--- a/src/main.c
+++ b/src/main.c
@@ -85,6 +85,8 @@ int main (int argc,char *argv[])
int count;
int flags;
const char *temp;
+ Uint32 videoModeFlags;
+ SDL_Surface *surface;
#ifdef DATAPATH
chdir(DATAPATH);
@@ -151,12 +153,12 @@ int main (int argc,char *argv[])
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE,windowinfo.depthbits);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE,windowinfo.stencilbits);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1);
-
-
- Uint32 videoModeFlags = SDL_OPENGL;
+
+
+ videoModeFlags = SDL_OPENGL;
if (windowinfo.fullscreen)
videoModeFlags |= SDL_FULLSCREEN;
- SDL_Surface *surface = SDL_SetVideoMode(windowinfo.resolutionx,windowinfo.resolutiony,windowinfo.bitsperpixel,videoModeFlags);
+ *surface = *SDL_SetVideoMode(windowinfo.resolutionx,windowinfo.resolutiony,windowinfo.bitsperpixel,videoModeFlags);
if (!surface)
{
fprintf(stderr, "Failed to initialize video:\n%s\n",SDL_GetError());
diff --git a/src/video/opengl.h b/src/video/opengl.h
index 77ce8bc..aa030b0 100644
--- a/src/video/opengl.h
+++ b/src/video/opengl.h
@@ -37,7 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../video/glext.h"
#endif
-#if defined(LINUX) || defined(__FreeBSD_kernel__) || defined(__GNU__)
+#if defined(LINUX) || defined(__FreeBSD_kernel__) || defined(__GNU__) || defined(__HAIKU__)
#include <GL/gl.h>
#include <GL/glext.h>
#endif
diff --git a/src/video/texture.c b/src/video/texture.c
index 69ecae4..6196260 100644
--- a/src/video/texture.c
+++ b/src/video/texture.c
@@ -52,7 +52,12 @@ int loadtexturepng(const char *filename, unsigned int **rgba, int *width, int *h
{
FILE *fp;
int load_status;
-
+ png_uint_32 texwidth;
+ png_uint_32 texheight;
+ int bit_depth;
+ int color_type;
+ int interlace_type;
+
if((fp = fopen(filename, "rb")) == NULL)
{
if(debug_texture_load) fprintf(stderr, "Texture Load Failed: %s\n", filename);
@@ -88,12 +93,12 @@ int loadtexturepng(const char *filename, unsigned int **rgba, int *width, int *h
png_init_io(png_ptr, fp);
png_set_sig_bytes(png_ptr, 8);
png_read_info(png_ptr, info_ptr);
- png_uint_32 texwidth = 0;
- png_uint_32 texheight = 0;
- int bit_depth = 0;
- int color_type = 0;
- int interlace_type = 0;
- png_get_IHDR(png_ptr, info_ptr, &texwidth, &texheight, &bit_depth, &color_type, 0, 0, 0);
+ texwidth = 0;
+ texheight = 0;
+ bit_depth = 0;
+ color_type = 0;
+ interlace_type = 0;
+ png_get_IHDR(png_ptr, info_ptr, &texwidth, &texheight, &bit_depth, &color_type, 0, 0, 0);
/* expand paletted colors into true rgb */
if (color_type == PNG_COLOR_TYPE_PALETTE)
--
2.2.2