r3515 - packages/trunk/fenix/debian/patches
Miriam Ruiz
baby-guest at alioth.debian.org
Thu Aug 2 07:16:26 UTC 2007
Author: baby-guest
Date: 2007-08-02 07:16:26 +0000 (Thu, 02 Aug 2007)
New Revision: 3515
Added:
packages/trunk/fenix/debian/patches/fxdll_version.patch
packages/trunk/fenix/debian/patches/plugins_dir.patch
Modified:
packages/trunk/fenix/debian/patches/series
Log:
Added new patches
Added: packages/trunk/fenix/debian/patches/fxdll_version.patch
===================================================================
--- packages/trunk/fenix/debian/patches/fxdll_version.patch (rev 0)
+++ packages/trunk/fenix/debian/patches/fxdll_version.patch 2007-08-02 07:16:26 UTC (rev 3515)
@@ -0,0 +1,120 @@
+--- fenix-0.92a.dfsg1.orig/fxc/src/c_main.c
++++ fenix-0.92a.dfsg1/fxc/src/c_main.c
+@@ -36,6 +36,11 @@
+
+ #include <fnx_loadlib.h>
+
++#include <fxdll_version.h>
++#ifndef FXDLL_VERSION
++#error "FXDLL_VERSION NOT DEFINED"
++#endif
++
+ #ifdef USE_GETTEXT
+ #include <libintl.h>
+ #include <locale.h>
+@@ -342,6 +347,9 @@
+ const char * filename ;
+ void * library = NULL;
+ dlfunc RegisterFunctions ;
++#ifdef FXDLL_VERSION
++ unsigned int * PluginVersion ;
++#endif
+
+ #if defined( TARGET_Linux ) || defined ( TARGET_BEOS ) || defined ( TARGET_MAC ) || defined ( TARGET_BSD )
+ char soname[1024];
+@@ -409,8 +417,13 @@
+ library = dlopen (filename, RTLD_NOW | RTLD_GLOBAL) ;
+ if (!library) compile_error (dlerror()) ;
+
+- RegisterFunctions = dlsym (library, "RegisterFunctions") ;
++ RegisterFunctions = (dlfunc) dlsym (library, "RegisterFunctions") ;
+ if (!RegisterFunctions) compile_error(MSG_NO_COMPATIBLE_DLL) ;
++#ifdef FXDLL_VERSION
++ PluginVersion = (unsigned int *) dlsym (library, "PluginVersion") ;
++ if (PluginVersion && *PluginVersion != FXDLL_VERSION)
++ compile_error(MSG_NO_COMPATIBLE_DLL) ;
++#endif
+
+ (*RegisterFunctions)(compile_export, sysproc_add) ;
+ }
+--- fenix-0.92a.dfsg1.orig/include/fnx_loadlib.h
++++ fenix-0.92a.dfsg1/include/fnx_loadlib.h
+@@ -61,7 +61,7 @@
+
+ #ifdef WIN32
+ #define dlopen(a,b) LoadLibrary(a)
+- #define dlsym(a,b) (dlfunc)GetProcAddress(a,b)
++ #define dlsym(a,b) (void *)GetProcAddress(a,b)
+
+ static char * dlerror (void)
+ {
+--- fenix-0.92a.dfsg1.orig/include/fxdll.h
++++ fenix-0.92a.dfsg1/include/fxdll.h
+@@ -54,6 +54,14 @@
+ #else
+ #define FXEXTERN extern
+ #endif
++
++/*
++ * Identificador de la version soportada de plugins
++ * Debera cambiar cada vez que se modifiquen las cabeceras
++ * usadas para los plugins.
++ */
++
++#include "fxdll_version.h"
+
+ /*
+ * Declaracion de funciones
+--- fenix-0.92a.dfsg1.orig/include/fxdll_version.h
++++ fenix-0.92a.dfsg1/include/fxdll_version.h
+@@ -0,0 +1,11 @@
++#ifndef FXDLL_VERSION
++
++/*
++ * Identificador de la version soportada de plugins
++ * Debera cambiar cada vez que se modifiquen las cabeceras
++ * usadas para los plugins.
++ */
++
++#define FXDLL_VERSION 0x0001
++
++#endif
+--- fenix-0.92a.dfsg1.orig/fxi/src/i_func.c
++++ fenix-0.92a.dfsg1/fxi/src/i_func.c
+@@ -125,6 +125,11 @@
+
+ #include <fnx_loadlib.h>
+
++#include <fxdll_version.h>
++#ifndef FXDLL_VERSION
++#error "FXDLL_VERSION NOT DEFINED"
++#endif
++
+ #ifdef USE_GETTEXT
+ #include <libintl.h>
+ #define _(String) gettext (String)
+@@ -5089,6 +5094,9 @@
+ SYSPROC * proc = sysprocs ;
+ void * library ;
+ dlfunc RegisterFunctions ;
++#ifdef FXDLL_VERSION
++ unsigned int * PluginVersion ;
++#endif
+ const char * filename;
+ unsigned int n ;
+
+@@ -5155,8 +5163,13 @@
+
+ if (!library) gr_error (dlerror()) ;
+
+- RegisterFunctions = dlsym (library, "RegisterFunctions") ;
++ RegisterFunctions = (dlfunc) dlsym (library, "RegisterFunctions") ;
+ if (!RegisterFunctions) gr_error(_("Error in %s"), filename) ;
++#ifdef FXDLL_VERSION
++ PluginVersion = (unsigned int *) dlsym (library, "PluginVersion") ;
++ if (PluginVersion && *PluginVersion != FXDLL_VERSION)
++ gr_error(_("Error in %s"), filename) ;
++#endif
+
+ (*RegisterFunctions)(fnc_import, sysproc_add) ;
+ }
Added: packages/trunk/fenix/debian/patches/plugins_dir.patch
===================================================================
--- packages/trunk/fenix/debian/patches/plugins_dir.patch (rev 0)
+++ packages/trunk/fenix/debian/patches/plugins_dir.patch 2007-08-02 07:16:26 UTC (rev 3515)
@@ -0,0 +1,151 @@
+--- fenix-0.92a.dfsg1.orig/fxc/src/c_main.c
++++ fenix-0.92a.dfsg1/fxc/src/c_main.c
+@@ -49,10 +49,19 @@
+ #define _(String) String
+ #endif
+
++#if defined( TARGET_Linux ) || defined ( TARGET_BEOS ) || defined ( TARGET_BSD )
++#include <limits.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <unistd.h>
++#ifndef PLUGINS_DIR
++#define PLUGINS_DIR "/usr/lib/fenix/plugins"
++#endif
++#endif
++
+ #include "fxc.h"
+ #include "messages.c"
+
+-
+ /* ---------------------------------------------------------------------- */
+ /* Módulo principal del compilador. Contiene código que inicializa los */
+ /* identificadores conocidos, así como las funciones de compilado de */
+@@ -351,8 +360,16 @@
+ unsigned int * PluginVersion ;
+ #endif
+
++#if defined( TARGET_Linux ) || defined ( TARGET_BEOS ) || defined ( TARGET_BSD )
++ struct stat stat_buf;
++#endif
++
+ #if defined( TARGET_Linux ) || defined ( TARGET_BEOS ) || defined ( TARGET_MAC ) || defined ( TARGET_BSD )
++#ifdef PATH_MAX
++ char soname[PATH_MAX];
++#else
+ char soname[1024];
++#endif
+ char * ptr;
+ #endif
+ token_next() ;
+@@ -368,7 +385,7 @@
+ #define DLLEXT ".so"
+ #define SIZEDLLEXT 3
+
+- snprintf (soname, 1024, "./%s" DLLEXT, filename);
++ snprintf (soname, sizeof(soname), "./%s" DLLEXT, filename);
+ #endif
+
+ #ifdef TARGET_MAC
+@@ -398,7 +415,7 @@
+ #define DLLEXT ".dylib"
+ #define SIZEDLLEXT 6
+
+- snprintf (soname, 1024, "%s/%s" DLLEXT, files[path_file], filename);
++ snprintf (soname, sizeof(soname), "%s/%s" DLLEXT, files[path_file], filename);
+ #endif
+
+ #ifndef TARGET_Win32
+@@ -411,6 +428,18 @@
+ strcpy (ptr-(4+SIZEDLLEXT), DLLEXT);
+ }
+
++#if defined( TARGET_Linux ) || defined ( TARGET_BEOS ) || defined ( TARGET_BSD )
++ if (stat(soname, &stat_buf) == -1)
++ {
++ snprintf (soname, sizeof(soname), PLUGINS_DIR "/%s.so", filename);
++ for (ptr = soname ; *ptr ; ptr++) *ptr = TOLOWER(*ptr);
++ if (strlen(soname) > 7 && strcmp(ptr-7, ".dll.so") == 0)
++ strcpy (ptr-7, ".so");
++ if (strlen(soname) > 6 && strcmp(ptr-6, ".so.so") == 0)
++ strcpy (ptr-6, ".so");
++ }
++#endif
++
+ filename = soname;
+ #endif
+
+--- fenix-0.92a.dfsg1.orig/fxi/src/i_func.c
++++ fenix-0.92a.dfsg1/fxi/src/i_func.c
+@@ -137,6 +137,16 @@
+ #define _(String) String
+ #endif
+
++#if defined( TARGET_Linux ) || defined ( TARGET_BEOS ) || defined ( TARGET_BSD )
++#include <limits.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <unistd.h>
++#ifndef PLUGINS_DIR
++#define PLUGINS_DIR "/usr/lib/fenix/plugins"
++#endif
++#endif
++
+ #include "dcb.h"
+
+ fixed cos_table[90001] ;
+@@ -5038,8 +5048,16 @@
+ const char * filename;
+ unsigned int n ;
+
++#if defined( TARGET_Linux ) || defined ( TARGET_BEOS ) || defined ( TARGET_BSD )
++ struct stat stat_buf;
++#endif
++
+ #ifndef TARGET_Win32
++#ifdef PATH_MAX
++ char soname[PATH_MAX];
++#else
+ char soname[1024];
++#endif
+ char * ptr;
+ #endif
+
+@@ -5073,7 +5091,7 @@
+ }
+ pathMac[contmac]='\0';
+
+- snprintf (soname, 1024, "%s/%s.dylib",pathMac ,filename);
++ snprintf (soname, sizeof(soname), "%s/%s.dylib",pathMac ,filename);
+
+ /* Clean the name (strip .DLL, and use lowercase) */
+
+@@ -5085,7 +5103,7 @@
+
+ library = dlopen (soname, RTLD_NOW | RTLD_GLOBAL) ;
+ #else
+- snprintf (soname, 1024, "./%s.so",filename);
++ snprintf (soname, sizeof(soname), "./%s.so",filename);
+
+ /* Clean the name (strip .DLL, and use lowercase) */
+
+@@ -5093,8 +5111,18 @@
+ *ptr = TOLOWER(*ptr);
+ if (strlen(soname) > 7 && strcmp(ptr-7, ".dll.so") == 0)
+ strcpy (ptr-7, ".so");
+- if (strlen(soname) > 7 && strcmp(ptr-7, ".so.so") == 0)
++ if (strlen(soname) > 6 && strcmp(ptr-6, ".so.so") == 0)
++ strcpy (ptr-6, ".so");
++
++ if (stat(soname, &stat_buf) == -1)
++ {
++ snprintf (soname, sizeof(soname), PLUGINS_DIR "/%s.so",filename);
++ for (ptr = soname ; *ptr ; ptr++) *ptr = TOLOWER(*ptr);
++ if (strlen(soname) > 7 && strcmp(ptr-7, ".dll.so") == 0)
+ strcpy (ptr-7, ".so");
++ if (strlen(soname) > 6 && strcmp(ptr-6, ".so.so") == 0)
++ strcpy (ptr-6, ".so");
++ }
+
+ library = dlopen (soname, RTLD_NOW | RTLD_GLOBAL) ;
+ #endif
Modified: packages/trunk/fenix/debian/patches/series
===================================================================
--- packages/trunk/fenix/debian/patches/series 2007-08-01 10:44:42 UTC (rev 3514)
+++ packages/trunk/fenix/debian/patches/series 2007-08-02 07:16:26 UTC (rev 3515)
@@ -10,4 +10,6 @@
fxi_input.patch
fxc_return_values.patch
fxi_return_values.patch
+plugins_dir.patch
+fxdll_version.patch
0.92a_to_cvs-20070713.1513.patch
More information about the Pkg-games-commits
mailing list