--- Begin Message ---
Package: amoeba
Version: 1.1-25
Severity: important
Tags: patch
Hi,
currently, amoeba fails to build on GNU/kFreeBSD[1][2] and GNU/Hurd[3].
The problem is a missing __linux__ -> __unix__ replacement in
opengl/glwindow.h; attached there is an updated version of the existing
patch 24-build-on-kfreebsd.diff that allows to build on kfreebsd and
hurd.
[1]
https://buildd.debian.org/status/fetch.php?pkg=amoeba&arch=kfreebsd-amd64&ver=1.1-25&stamp=1337042640
[2]
https://buildd.debian.org/status/fetch.php?pkg=amoeba&arch=kfreebsd-i386&ver=1.1-25&stamp=1337161662
[3]
https://buildd.debian.org/status/fetch.php?pkg=amoeba&arch=hurd-i386&ver=1.1-25&stamp=1337179712
Thanks,
--
Pino
--- a/audio/musichandler.cpp
+++ b/audio/musichandler.cpp
@@ -18,7 +18,7 @@
#define DEMOLIB_SOUND_PROVIDER OggVorbisAudioProvider
-#if __linux__
+#if __unix__
#include "audio/linux_oss.h"
#define DEMOLIB_SOUND_DRIVER OSSAudioDriver
#else
--- a/main/demohandler.cpp
+++ b/main/demohandler.cpp
@@ -2,7 +2,7 @@
#include <string.h>
#include <stdlib.h>
-#ifdef __linux__
+#ifdef __unix__
#include <X11/keysym.h>
#endif
@@ -56,7 +56,7 @@ void DemoHandler::start_effect()
glDepthFunc(GL_LESS);
while (this->active) {
-#ifdef __linux__
+#ifdef __unix__
/*
* Linux doesn't use a message queue like Win32, so we'll
* handle X events here :-)
--- a/main/mainloop.cpp
+++ b/main/mainloop.cpp
@@ -212,21 +212,21 @@ void MainLoop::process_element(const cha
int i = 0;
#if !DEMOLIB_SILENT
static bool init_timer = false;
-#if __linux__
+#if __unix__
static struct timeval first_lpp, now;
#else
static DWORD first_lpp, now;
#endif
if (!init_timer) {
-#if __linux__
+#if __unix__
gettimeofday(&first_lpp, NULL);
#else
first_lpp = GetTickCount();
#endif
init_timer = true;
}
-#if __linux__
+#if __unix__
gettimeofday(&now, NULL);
printf("LPP: [%6.3f]\n",
(now.tv_sec - first_lpp.tv_sec) +
@@ -322,7 +322,7 @@ void MainLoop::process_element(const cha
* and should be rewritten someday.
*/
if (this->num_events == 0) {
-#if __linux__
+#if __unix__
/* attempt to use the colorful GTK+ interface first =) */
try {
/*
--- a/main/piprecalc.cpp
+++ b/main/piprecalc.cpp
@@ -13,7 +13,7 @@
#define PI_STRING "3.14159265358979323846264338327950288"
/* ahem ;-) */
-#ifndef __linux__
+#ifndef __unix__
#define usleep(x) Sleep(x)
#endif
--- a/opengl/extensions.cpp
+++ b/opengl/extensions.cpp
@@ -12,7 +12,7 @@
#include <GL/gl.h>
-#if __linux__
+#if __unix__
#include <GL/glx.h>
extern "C" {
void (*glXGetProcAddressARB(const GLubyte *procName))();
@@ -52,7 +52,7 @@ bool GLExtensions::has_ext(const char *e
void *GLExtensions::func_ptr(const char *function)
{
-#if __linux__
+#if __unix__
void *ptr = (void *)glXGetProcAddressARB((GLubyte *)function);
#else
void *ptr = (void *)wglGetProcAddress(function);
@@ -72,7 +72,7 @@ void *GLExtensions::func_ptr(const char
(strcmp(suffix, "EXT") == 0 || strcmp(suffix, "ARB") == 0)) {
char *tmp = strdup(function);
tmp[strlen(tmp) - 3] = '\0';
-#if __linux__
+#if __unix__
ptr = (void *)glXGetProcAddressARB((GLubyte *)tmp);
#else
ptr = (void *)wglGetProcAddress(tmp);
--- a/opengl/glwindow.cpp
+++ b/opengl/glwindow.cpp
@@ -9,7 +9,7 @@
#include <windows.h>
#endif
-#ifdef __linux__
+#ifdef __unix__
#include <unistd.h>
#include <GL/glx.h>
#include <X11/extensions/xf86vmode.h>
@@ -56,7 +56,7 @@ void GLWindow::resize(int x, int y, int
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
-#ifdef __linux__
+#ifdef __unix__
// XClearWindow(this->dpy, this->win);
#endif
}
@@ -92,7 +92,7 @@ GLWindow::GLWindow(char *title, int widt
WindowRect.bottom = (long)height;
#endif /* WIN32 */
-#ifdef __linux__
+#ifdef __unix__
XVisualInfo *vi;
int dpyWidth = 0, dpyHeight = 0;
int i;
@@ -113,7 +113,7 @@ GLWindow::GLWindow(char *title, int widt
GLX_STENCIL_SIZE, 4,
None
};
-#endif /* __linux__ */
+#endif /* __unix__ */
this->x = 0;
this->y = 0;
@@ -140,7 +140,7 @@ GLWindow::GLWindow(char *title, int widt
if( !RegisterClass(&wc) ) throw new FatalException("Couldn't register Window Class");
#endif /* WIN32 */
-#ifdef __linux__
+#ifdef __unix__
/* set best mode to current */
bestMode = 0;
@@ -210,7 +210,7 @@ GLWindow::GLWindow(char *title, int widt
}
this->attr.border_pixel = 0;
-#endif /* __linux__ */
+#endif /* __unix__ */
/* change screen mode */
if (fullscreen) {
@@ -219,13 +219,13 @@ GLWindow::GLWindow(char *title, int widt
throw new FatalException("Couldn't set requested screen mode.");
}
#endif /* WIN32 */
-#ifdef __linux__
+#ifdef __unix__
XF86VidModeSwitchToMode(this->dpy, this->screen, modes[bestMode]);
XF86VidModeSetViewPort(this->dpy, this->screen, 0, 0);
dpyWidth = modes[bestMode]->hdisplay;
dpyHeight = modes[bestMode]->vdisplay;
XFree(modes);
-#endif /* __linux__ */
+#endif /* __unix__ */
}
/* create the window */
@@ -256,7 +256,7 @@ GLWindow::GLWindow(char *title, int widt
throw new FatalException("Could not change screenmode");
}
#endif
-#ifdef __linux__
+#ifdef __unix__
this->attr.background_pixel = 0;
if (fullscreen) {
@@ -290,7 +290,7 @@ GLWindow::GLWindow(char *title, int widt
title, None, NULL, 0, NULL);
XMapRaised(this->dpy, this->win);
}
-#endif /* __linux__ */
+#endif /* __unix__ */
#ifdef WIN32
static PIXELFORMATDESCRIPTOR pfd = {
@@ -326,7 +326,7 @@ GLWindow::GLWindow(char *title, int widt
SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
#endif /* WIN32 */
-#ifdef __linux__
+#ifdef __unix__
/* connect the glx-context to the window */
glXMakeCurrent(this->dpy, this->win, this->ctx);
XClearWindow(this->dpy, this->win);
@@ -337,14 +337,14 @@ GLWindow::GLWindow(char *title, int widt
}
nice(-7);
-#endif /* __linux__ */
+#endif /* __unix__ */
this->resize(0, 0, this->width, this->height);
}
GLWindow::~GLWindow()
{
-#ifdef __linux__
+#ifdef __unix__
if (this->ctx) {
if (!glXMakeCurrent(this->dpy, None, NULL)) {
throw new FatalException("Could not release drawing context.");
@@ -355,7 +355,7 @@ GLWindow::~GLWindow()
#endif
if (fullscreen) {
-#ifdef __linux__
+#ifdef __unix__
XF86VidModeSwitchToMode(this->dpy, this->screen, &this->deskMode);
XF86VidModeSetViewPort(this->dpy, this->screen, 0, 0);
#endif
@@ -365,7 +365,7 @@ GLWindow::~GLWindow()
#endif
}
-#ifdef __linux__
+#ifdef __unix__
XCloseDisplay(this->dpy);
#endif
@@ -396,7 +396,7 @@ void GLWindow::flip()
}
SwapBuffers(this->hDC);
#endif
-#ifdef __linux__
+#ifdef __unix__
glXSwapBuffers(this->dpy, this->win);
#endif
}
--- a/packer/pakfile.cpp
+++ b/packer/pakfile.cpp
@@ -5,7 +5,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#ifdef __linux__
+#ifdef __unix__
#include <unistd.h>
#else
#include <io.h>
@@ -38,7 +38,7 @@ PakFile::PakFile(char *filename)
int err, dirpos, dirsize;
unsigned int i;
-#if __linux__
+#if __unix__
int fd = open("/usr/share/amoeba/demo.dat", O_RDONLY);
#else
int fd = open("demo.dat", O_RDONLY | O_BINARY);
--- a/test-demolib.cpp
+++ b/test-demolib.cpp
@@ -106,7 +106,7 @@ int main(int argc, char **argv)
demo->run();
delete demo;
} catch (Exception *e) {
-#if __linux__
+#if __unix__
fprintf(stderr, "Unhandled exception: %s\n", e->get_error());
#else
MessageBox(NULL, e->get_error(), "Unhandled exception!", 0);
--- a/util/hashtable.cpp
+++ b/util/hashtable.cpp
@@ -11,7 +11,7 @@
#include "exception.h"
#include "demolib_prefs.h"
-#ifndef __linux__
+#ifndef __unix__
#define strcasecmp stricmp
#endif
--- a/audio/linux_oss.cpp
+++ b/audio/linux_oss.cpp
@@ -12,7 +12,7 @@
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
-#include <linux/soundcard.h>
+#include <sys/soundcard.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <errno.h>
--- a/opengl/glwindow.h
+++ b/opengl/glwindow.h
@@ -5,7 +5,7 @@
#include <windows.h>
#endif
-#ifdef __linux__
+#ifdef __unix__
#include <GL/glx.h>
#include <X11/extensions/xf86vmode.h>
#include <X11/keysym.h>
@@ -32,7 +32,7 @@ protected:
HWND hWnd;
HINSTANCE hInstance;
#endif
-#ifdef __linux__
+#ifdef __unix__
Display *dpy;
int screen;
Window win;
--- End Message ---