[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#650585: patches to fix building on kfreebsd



Package: amoeba
Version: src:amoeba
Severity: important
Tags: patch
User: debian-bsd@lists.debian.org

Hi!

  I've attached 2 patches to make amoeba build on kfreebsd (and
potentially hurd). The two issues are first assuming everything no
linux is windows (while the linux code works on *nix) and using
linux/soundcard.h instead of sys/soundcard.h which is not only
available on linux but also on e.g. kfreebsd

Regards

    Christoph

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: kfreebsd-amd64 (x86_64)

Kernel: kFreeBSD 8.2-1-amd64
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Index: amoeba-1.1/audio/musichandler.cpp
===================================================================
--- amoeba-1.1.orig/audio/musichandler.cpp	2011-11-29 15:50:28.000000000 +0100
+++ amoeba-1.1/audio/musichandler.cpp	2011-11-29 15:50:50.000000000 +0100
@@ -18,7 +18,7 @@
 
 #define DEMOLIB_SOUND_PROVIDER OggVorbisAudioProvider
 	
-#if __linux__
+#if __GLIBC__
 #include "audio/linux_oss.h"
 #define DEMOLIB_SOUND_DRIVER OSSAudioDriver
 #else
Index: amoeba-1.1/main/demohandler.cpp
===================================================================
--- amoeba-1.1.orig/main/demohandler.cpp	2011-11-29 15:50:28.000000000 +0100
+++ amoeba-1.1/main/demohandler.cpp	2011-11-29 15:50:51.000000000 +0100
@@ -2,7 +2,7 @@
 #include <string.h>
 #include <stdlib.h>
 
-#ifdef __linux__
+#ifdef __GLIBC__
 #include <X11/keysym.h>
 #endif
 
@@ -56,7 +56,7 @@
         glDepthFunc(GL_LESS);
 
 	while (this->active) {
-#ifdef __linux__
+#ifdef __GLIBC__
 		/*
 		 * Linux doesn't use a message queue like Win32, so we'll
 		 * handle X events here :-)
Index: amoeba-1.1/main/mainloop.cpp
===================================================================
--- amoeba-1.1.orig/main/mainloop.cpp	2011-11-29 15:50:28.000000000 +0100
+++ amoeba-1.1/main/mainloop.cpp	2011-11-29 15:50:51.000000000 +0100
@@ -212,21 +212,21 @@
 		int i = 0;
 #if !DEMOLIB_SILENT
 		static bool init_timer = false;
-#if __linux__
+#if __GLIBC__
 		static struct timeval first_lpp, now;
 #else
 		static DWORD first_lpp, now;
 #endif
 		
 		if (!init_timer) {
-#if __linux__
+#if __GLIBC__
 			gettimeofday(&first_lpp, NULL);
 #else
 			first_lpp = GetTickCount();
 #endif
 			init_timer = true;
 		}
-#if __linux__
+#if __GLIBC__
 		gettimeofday(&now, NULL);
 		printf("LPP: [%6.3f]\n",
 			(now.tv_sec - first_lpp.tv_sec) +
@@ -322,7 +322,7 @@
 		 * and should be rewritten someday.
 		 */
 		if (this->num_events == 0) {
-#if __linux__
+#if __GLIBC__
 			/* attempt to use the colorful GTK+ interface first =) */
 			try {
 				/* 
Index: amoeba-1.1/opengl/extensions.cpp
===================================================================
--- amoeba-1.1.orig/opengl/extensions.cpp	2011-11-29 15:50:28.000000000 +0100
+++ amoeba-1.1/opengl/extensions.cpp	2011-11-29 15:50:50.000000000 +0100
@@ -12,7 +12,7 @@
 
 #include <GL/gl.h>
 
-#if __linux__
+#if __GLIBC__
 #include <GL/glx.h>
 extern "C" {
 	void (*glXGetProcAddressARB(const GLubyte *procName))();
@@ -52,7 +52,7 @@
 
 void *GLExtensions::func_ptr(const char *function)
 {
-#if __linux__
+#if __GLIBC__
 	void *ptr = (void *)glXGetProcAddressARB((GLubyte *)function);
 #else
 	void *ptr = (void *)wglGetProcAddress(function);
@@ -72,7 +72,7 @@
 	    (strcmp(suffix, "EXT") == 0 || strcmp(suffix, "ARB") == 0)) {
 		char *tmp = strdup(function);
 		tmp[strlen(tmp) - 3] = '\0';
-#if __linux__
+#if __GLIBC__
 		ptr = (void *)glXGetProcAddressARB((GLubyte *)tmp);
 #else
 		ptr = (void *)wglGetProcAddress(tmp);
Index: amoeba-1.1/opengl/glwindow.cpp
===================================================================
--- amoeba-1.1.orig/opengl/glwindow.cpp	2011-11-29 15:50:28.000000000 +0100
+++ amoeba-1.1/opengl/glwindow.cpp	2011-11-29 15:50:50.000000000 +0100
@@ -9,7 +9,7 @@
 #include <windows.h>
 #endif
 
-#ifdef __linux__
+#ifdef __GLIBC__
 #include <unistd.h>
 #include <GL/glx.h>
 #include <X11/extensions/xf86vmode.h>
@@ -56,7 +56,7 @@
 	glMatrixMode(GL_MODELVIEW);
 	glLoadIdentity();
 
-#ifdef __linux__
+#ifdef __GLIBC__
 //	XClearWindow(this->dpy, this->win);
 #endif
 }
@@ -92,7 +92,7 @@
 	WindowRect.bottom = (long)height;
 	
 #endif /* WIN32 */	
-#ifdef __linux__
+#ifdef __GLIBC__
 	XVisualInfo *vi;
 	int dpyWidth = 0, dpyHeight = 0;
 	int i;
@@ -113,7 +113,7 @@
 		GLX_STENCIL_SIZE, 4,
 		None
 	};
-#endif /* __linux__ */
+#endif /* __GLIBC__ */
 
 	this->x = 0;
 	this->y = 0;
@@ -140,7 +140,7 @@
 	if( !RegisterClass(&wc) ) throw new FatalException("Couldn't register Window Class");
 
 #endif /* WIN32 */
-#ifdef __linux__
+#ifdef __GLIBC__
 	/* set best mode to current */
 	bestMode = 0;
 
@@ -210,7 +210,7 @@
 	}
 		
 	this->attr.border_pixel = 0;
-#endif /* __linux__ */
+#endif /* __GLIBC__ */
 
 	/* change screen mode */	
 	if (fullscreen) {
@@ -219,13 +219,13 @@
 			throw new FatalException("Couldn't set requested screen mode.");
 		}
 #endif /* WIN32 */
-#ifdef __linux__
+#ifdef __GLIBC__
 		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 /* __GLIBC__ */
 	}
 
 	/* create the window */
@@ -256,7 +256,7 @@
 		throw new FatalException("Could not change screenmode");
 	}
 #endif
-#ifdef __linux__
+#ifdef __GLIBC__
 	this->attr.background_pixel = 0;
 
 	if (fullscreen) {
@@ -290,7 +290,7 @@
 			title, None, NULL, 0, NULL);
 		XMapRaised(this->dpy, this->win);
 	}
-#endif /* __linux__ */
+#endif /* __GLIBC__ */
 
 #ifdef WIN32
 	static PIXELFORMATDESCRIPTOR pfd = {
@@ -326,7 +326,7 @@
 
 	SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
 #endif /* WIN32	*/
-#ifdef __linux__
+#ifdef __GLIBC__
 	/* connect the glx-context to the window */
 	glXMakeCurrent(this->dpy, this->win, this->ctx);
 	XClearWindow(this->dpy, this->win);
@@ -337,14 +337,14 @@
 	}
 
 	nice(-7);
-#endif /* __linux__ */
+#endif /* __GLIBC__ */
 
 	this->resize(0, 0, this->width, this->height);
 }
 
 GLWindow::~GLWindow()
 {
-#ifdef __linux__
+#ifdef __GLIBC__
 	if (this->ctx) {
 		if (!glXMakeCurrent(this->dpy, None, NULL)) {
 			throw new FatalException("Could not release drawing context.");
@@ -355,7 +355,7 @@
 #endif
 
 	if (fullscreen) {
-#ifdef __linux__
+#ifdef __GLIBC__
 		XF86VidModeSwitchToMode(this->dpy, this->screen, &this->deskMode);
 		XF86VidModeSetViewPort(this->dpy, this->screen, 0, 0);
 #endif
@@ -365,7 +365,7 @@
 #endif
 	}
 
-#ifdef __linux__
+#ifdef __GLIBC__
 	XCloseDisplay(this->dpy);
 #endif
 
@@ -396,7 +396,7 @@
 	}
 	SwapBuffers(this->hDC);
 #endif
-#ifdef __linux__
+#ifdef __GLIBC__
 	glXSwapBuffers(this->dpy, this->win);
 #endif
 }
Index: amoeba-1.1/opengl/glwindow.h
===================================================================
--- amoeba-1.1.orig/opengl/glwindow.h	2011-11-29 15:50:28.000000000 +0100
+++ amoeba-1.1/opengl/glwindow.h	2011-11-29 15:50:50.000000000 +0100
@@ -5,7 +5,7 @@
 #include <windows.h>
 #endif
 
-#ifdef __linux__
+#ifdef __GLIBC__
 #include <GL/glx.h>
 #include <X11/extensions/xf86vmode.h>
 #include <X11/keysym.h>
@@ -32,7 +32,7 @@
 	HWND hWnd;
 	HINSTANCE hInstance;
 #endif
-#ifdef __linux__
+#ifdef __GLIBC__
 	Display *dpy;
 	int screen;
 	Window win;
Index: amoeba-1.1/packer/pakfile.cpp
===================================================================
--- amoeba-1.1.orig/packer/pakfile.cpp	2011-11-29 15:50:28.000000000 +0100
+++ amoeba-1.1/packer/pakfile.cpp	2011-11-29 15:50:50.000000000 +0100
@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#ifdef __linux__
+#ifdef __GLIBC__
 #include <unistd.h>
 #else
 #include <io.h>
@@ -38,7 +38,7 @@
 	int err, dirpos, dirsize;
 	unsigned int i;
 
-#if __linux__
+#if __GLIBC__
 	int fd = open("/usr/share/amoeba/demo.dat", O_RDONLY);
 #else
 	int fd = open("demo.dat", O_RDONLY | O_BINARY);
Index: amoeba-1.1/test-demolib.cpp
===================================================================
--- amoeba-1.1.orig/test-demolib.cpp	2011-11-29 15:50:28.000000000 +0100
+++ amoeba-1.1/test-demolib.cpp	2011-11-29 15:50:51.000000000 +0100
@@ -106,7 +106,7 @@
 		demo->run();
 		delete demo;
 	} catch (Exception *e) {
-#if __linux__
+#if __GLIBC__
 		fprintf(stderr, "Unhandled exception: %s\n", e->get_error());
 #else
                 MessageBox(NULL, e->get_error(), "Unhandled exception!", 0);
Index: amoeba-1.1/util/hashtable.cpp
===================================================================
--- amoeba-1.1.orig/util/hashtable.cpp	2011-11-29 15:50:28.000000000 +0100
+++ amoeba-1.1/util/hashtable.cpp	2011-11-29 15:50:50.000000000 +0100
@@ -11,7 +11,7 @@
 #include "exception.h"
 #include "demolib_prefs.h"
 
-#ifndef __linux__
+#ifndef __GLIBC__
 #define strcasecmp stricmp
 #endif
 
Index: amoeba-1.1/audio/linux_oss.cpp
===================================================================
--- amoeba-1.1.orig/audio/linux_oss.cpp	2011-11-29 15:48:23.000000000 +0100
+++ amoeba-1.1/audio/linux_oss.cpp	2011-11-29 15:52:13.000000000 +0100
@@ -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>

Reply to: