numptyphysics, fix references to libSDL*, fix build (#4290)

* numptyphysics, fix references to libSDL*, fix build
This commit is contained in:
Schrijvers Luc
2019-11-18 12:20:58 +01:00
committed by GitHub
parent 8f53d3622a
commit ce35aa6237
4 changed files with 111 additions and 120 deletions

View File

@@ -1,5 +1,20 @@
resource app_signature "application/x-vnd.numptyphysics";
resource(11) #'VICN' array {
resource app_flags B_SINGLE_LAUNCH;
resource app_version {
major = 0,
middle = 3,
minor = 4,
variety = B_APPV_FINAL,
internal = 0,
short_info = "A drawing puzzle game",
long_info = "numptyphysics © Tim Edmonds, Thomas Perl"
};
resource vector_icon array {
$"6E63696602032BAB2B03FFE03F0A040BFEFF2B2E4529482A4928472840294228"
$"40233C233E233A2A3B2A3B2B392F3032312C2F313A3039323B393C393B393D35"
$"403540354136493245020B542E542D5431593156315C315A2B5C2D5829562857"

View File

@@ -6,61 +6,57 @@ HOMEPAGE="http://numptyphysics.garage.maemo.org"
COPYRIGHT="2008-2010 Tim Edmonds
2008, 2012, 2014-2016 Thomas Perl"
LICENSE="GNU GPL v3"
REVISION="2"
SOURCE_URI="https://github.com/thp/numptyphysics/archive/0.3.4.tar.gz"
REVISION="3"
SOURCE_URI="https://github.com/thp/numptyphysics/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="e00e1535c8246f3f1c3bab37d2e6f01259a14f59b38382299457b4b8447d2bc9"
SOURCE_DIR=""
PATCHES="numptyphysics-$portVersion.patchset"
ADDITIONAL_FILES="numptyphysics.rdef"
ARCHITECTURES="!x86_gcc2 !x86 !x86_64"
SECONDARY_ARCHITECTURES="!x86_gcc2 !x86"
# numptphysics needs a working box2d recipe before it will build correctly
# and probably needs a bit more work as well to get building and working right
PROVIDES="
numptyphysics = $portVersion
app:NumptyPhysics
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libBox2D$secondaryArchSuffix
lib:libSDL2_2.0$secondaryArchSuffix
lib:libSDL2_image_2.0$secondaryArchSuffix
lib:libSDL2_ttf_2.0$secondaryArchSuffix
lib:libGL$secondaryArchSuffix
lib:libSDL_1.2$secondaryArchSuffix
lib:libSDL_image_1.2$secondaryArchSuffix
lib:libSDL_ttf_2.0$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libBox2D$secondaryArchSuffix
devel:libsdl2_2.0$secondaryArchSuffix
devel:libSDL2_image_2.0$secondaryArchSuffix
devel:libSDL2_ttf_2.0$secondaryArchSuffix
devel:libGL$secondaryArchSuffix
devel:libSDL$secondaryArchSuffix
devel:libSDL_image$secondaryArchSuffix
devel:libSDL_ttf$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:aclocal$secondaryArchSuffix
cmd:autoconf$secondaryArchSuffix
cmd:automake$secondaryArchSuffix
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:libtoolize$secondaryArchSuffix
cmd:make
cmd:pkg_config$secondaryArchSuffix
"
BUILD()
{
libtoolize --force --copy --install
aclocal
autoconf
# ./configure --prefix=$prefix \
# --bindir=$appsDir/numptyphysics \
# --datarootdir=$appsDir
# TODO: figure out how to move the ~/.numptyphysics directory to ~/config/settings/numptyphysics
runConfigure ./configure
make
make PLATFORM=sdl1 PREFIX=$appsDir/NumptyPhysics OBJ_DIR=objects $jobArgs
}
INSTALL()
{
make install
make PLATFORM=sdl1 PREFIX=$appsDir/NumptyPhysics install
addResourcesToBinaries $portDir/additional-files/numptyphysics.rdef $appsDir/NumptyPhysics/bin/numptyphysics
ln -s $appsDir/NumptyPhysics/bin/numptyphysics $appsDir/NumptyPhysics/"Numpty Physics"
}

View File

@@ -1,95 +0,0 @@
Index: Canvas.cpp
===================================================================
--- numptyphysics-0.2-157/Canvas.cpp (revision 157)
+++ numptyphysics-0.2-157/Canvas.cpp (working copy)
@@ -26,7 +26,7 @@
#define Window X11Window //oops
#define Font X11Font //oops
#include <SDL/SDL_syswm.h>
-#ifndef WIN32
+#if (!defined(WIN32) && !defined(__HAIKU__))
#include <X11/X.h>
#include <X11/Xlib.h>
#endif
@@ -753,8 +753,8 @@
SDL_VERSION( &sys.version );
SDL_GetWMInfo( &sys );
-#if !defined(WIN32) && !(defined(__APPLE__) && defined(__MACH__))
- /* No X11 stuff on Windows and Mac OS X */
+#if !defined(WIN32) && !defined(__HAIKU__) && !(defined(__APPLE__) && defined(__MACH__))
+ /* No X11 stuff on Windows, Haiku and Mac OS X */
// take focus...
XEvent ev = { 0 };
@@ -840,7 +840,11 @@
int Canvas::writeBMP( const char* filename ) const
{
-#pragma pack(push,1)
+#ifdef __HAIKU__
+#pragma pack(1)
+#else
+#pragma pack(1,push)
+#endif
typedef struct {
unsigned short int type; /* Magic identifier */
unsigned int size; /* File size in bytes */
@@ -861,7 +865,11 @@
} BMPINFOHEADER;
int check_BMPHEADER[(sizeof(BMPHEADER)==14)-1];
int check_BMPINFOHEADER[(sizeof(BMPINFOHEADER)==40)-1];
+#ifdef __HAIKU__
+#pragma pack()
+#else
#pragma pack(pop)
+#endif
int w = width();
int h = height();
Index: configure.in
===================================================================
--- numptyphysics-0.2-157/configure.in (revision 157)
+++ numptyphysics-0.2-157/configure.in (working copy)
@@ -77,6 +77,7 @@
AC_CHECK_LIB(stdc++, main)
AC_CHECK_LIB(X11, main)
AC_CHECK_LIB(z, main)
+AC_CHECK_LIB(network, socket)
AC_CONFIG_FILES([Makefile])
Index: happyhttp.cpp
===================================================================
--- numptyphysics-0.2-157/happyhttp.cpp (revision 157)
+++ numptyphysics-0.2-157/happyhttp.cpp (working copy)
@@ -28,7 +28,7 @@
#include "happyhttp.h"
#ifndef WIN32
-// #include <sys/types.h>
+
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -41,6 +41,10 @@
#define vsnprintf _vsnprintf
#endif
+#ifdef __HAIKU__
+ #include <sys/select.h>
+#endif
+
#include <cstdio>
#include <cstring>
#include <cstdarg>
@@ -278,6 +282,9 @@
#ifdef WIN32
if( m_Sock >= 0 )
::closesocket( m_Sock );
+#elif __HAIKU__
+// need to figure this part out for Haiku still
+//
#else
if( m_Sock >= 0 )
::close( m_Sock );

View File

@@ -0,0 +1,75 @@
From c10e292e69df48bf6cab817e350c652068db22fe Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Sat, 12 Oct 2019 14:16:38 +0200
Subject: Fix build, install paths
diff --git a/external/glaserl/glaserl_gl.h b/external/glaserl/glaserl_gl.h
index 6c8a3e7..d327b32 100644
--- a/external/glaserl/glaserl_gl.h
+++ b/external/glaserl/glaserl_gl.h
@@ -18,7 +18,7 @@
#include <stdlib.h>
-#if defined(USE_OPENGL_ES)
+#if defined(USE_OPENGL_ES) && !defined(__HAIKU__)
# include <GLES2/gl2.h>
# define GLASERL_GLSL_PRECISION_INFO "precision mediump float;\n"
#elif defined(__APPLE__)
diff --git a/mk/install.mk b/mk/install.mk
index f713ea8..dac9046 100644
--- a/mk/install.mk
+++ b/mk/install.mk
@@ -3,7 +3,7 @@ PREFIX ?= /usr
install: $(APP) $(ADDITIONAL_INSTALL_TARGETS)
install -D -m 755 $(APP) $(DESTDIR)/$(PREFIX)/bin/$(APP)
- mkdir -p $(DESTDIR)/$(PREFIX)/share/$(APP)
- cp -rpv data $(DESTDIR)/$(PREFIX)/share/$(APP)/
+ mkdir -p $(DESTDIR)/$(PREFIX)/data/$(APP)
+ cp -rpv data/* $(DESTDIR)/$(PREFIX)/data/$(APP)/
.PHONY: install
diff --git a/platform/sdl1/platform.in b/platform/sdl1/platform.in
index 4bf22dc..3bdb5f4 100644
--- a/platform/sdl1/platform.in
+++ b/platform/sdl1/platform.in
@@ -1,6 +1,8 @@
# Platform build definition for SDL1
# Will be processed by makefile
+LIBS += -lGL -lSDL -lSDL_image -lSDL_ttf
+
add_platform(gl)
add_platform(sdlstb)
diff --git a/platform/sdlstb/OsSDLSTB.h b/platform/sdlstb/OsSDLSTB.h
index f701e26..92878a1 100644
--- a/platform/sdlstb/OsSDLSTB.h
+++ b/platform/sdlstb/OsSDLSTB.h
@@ -19,7 +19,7 @@
#include "SDLSTBRenderer.h"
-#include "SDL.h"
+#include "SDL/SDL.h"
static int mapSDLKeyToNumptyKey(int key)
diff --git a/platform/sdlstb/SDLSTBRenderer.h b/platform/sdlstb/SDLSTBRenderer.h
index 830126b..cd197ac 100644
--- a/platform/sdlstb/SDLSTBRenderer.h
+++ b/platform/sdlstb/SDLSTBRenderer.h
@@ -22,7 +22,7 @@
#include "Renderer.h"
#include "GLRenderer.h"
-#include <SDL.h>
+#include <SDL/SDL.h>
class SDLSTBRenderer : public GLRenderer {
public:
--
2.23.0