- highly experimental: optionally use DT_AUXILIARY stub libraries to not depend

on libGeoIP and libgdk_pixbuf at runtime


git-svn-id: http://svn.code.sf.net/p/xqf/code/trunk@703 d2ac09be-c843-0410-8b1f-f8a84130e0ec
This commit is contained in:
Ludwig Nussel 2005-01-21 21:21:46 +00:00 committed by l-n
parent 1c3d173975
commit e4f8700974
6 changed files with 272 additions and 7 deletions

View File

@ -1,3 +1,7 @@
Jan 21, 2005: Ludwig Nussel <l-n@users.sourceforge.net>
- highly experimental: optionally use DT_AUXILIARY stub libraries to not depend
on libGeoIP and libgdk_pixbuf at runtime
Jan 12, 2005: Ludwig Nussel <l-n@users.sourceforge.net>
- split get_new_defaults into game specific functions
- fix doom3 protocol detection (#1092165)

View File

@ -23,6 +23,7 @@ dnl Checks for programs.
AC_PROG_CC
AC_ISC_POSIX
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
dnl Checks for header files.
@ -93,13 +94,14 @@ QSTAT23="-DQSTAT23 -DQSTAT_HAS_UNREAL_SUPPORT"
AC_SUBST(QSTAT23)
AC_CHECK_HEADER(zlib.h,,[AC_MSG_ERROR([zlib.h not found, please install zlib development files])])
AC_CHECK_LIB(z, crc32,,[AC_MSG_ERROR([libz not found])])
AC_CHECK_LIB(z, crc32,[AC_DEFINE([HAVE_LIBZ],[],[Whether libz is installed])],[AC_MSG_ERROR([libz not found])])
dnl determine if we should include readline support...
dnl ripped from physfs package
dnl AC_ARG_ENABLE(readline,
dnl AC_HELP_STRING([--enable-externalrcon],[compile external rcon program (default=yes)])
dnl , ,enable_rcon=yes)
XQFRCON_LIBS=
AC_ARG_ENABLE(externalrcon,[ --enable-externalrcon compile external rcon program (default=no)])
if test x$enable_externalrcon = xyes; then
AC_CHECK_HEADER(readline/readline.h, have_readline_hdr=yes)
@ -108,8 +110,6 @@ if test x$enable_externalrcon = xyes; then
AC_CHECK_LIB(readline, add_history, have_history_lib=yes, , -lncurses )
if test x$have_readline_hdr = xyes -a x$have_readline_lib = xyes; then
if test x$have_history_hdr = xyes -a x$have_history_lib = xyes; then
XQFRCON="xqf-rcon";
AC_SUBST(XQFRCON)
XQFRCON_LIBS="-lreadline -lncurses"
AC_SUBST(XQFRCON_LIBS)
else
@ -119,6 +119,7 @@ if test x$enable_externalrcon = xyes; then
AC_MSG_WARN([libreadline not found, rcon program disabled])
fi
fi
AM_CONDITIONAL(BUILD_XQFRCON, test "x$XQFRCON_LIBS" != x)
dnl determine whether GeoIP should be used
AC_CHECK_HEADER(GeoIP.h,have_geoip_hdr=yes,have_geoip_hdr=no)
@ -126,11 +127,31 @@ AC_MSG_CHECKING([whether GeoIP should be used])
AC_ARG_ENABLE(geoip,[ --enable-geoip use GeoIP (default=auto)],USE_GEOIP=$enableval, USE_GEOIP=yes)
AC_MSG_RESULT([$USE_GEOIP])
# --enable-geoip-dummy=/usr/lib/libGeoIP.so
AC_MSG_CHECKING([whether a GeoIP dummy library should be used])
AC_ARG_ENABLE(geoip_dummy,
[ --enable-geoip-dummy=FILE use dummy GeoIP lib based on FILE (default=no)],
use_geoip_dummy="$enableval", use_geoip_dummy=no)
AC_MSG_RESULT([$use_geoip_dummy])
if test "x$USE_GEOIP" != "xno"; then
if test "x$have_geoip_hdr" = "xyes";then
AC_DEFINE_UNQUOTED(USE_GEOIP,1,Define if we should use GeoIP)
if test "x$USE_GEOIP" = "xyes"; then
if test "x$use_geoip_dummy" != "xno"; then
DUMMY_LIBGEOIP_SONAME=`objdump -p "$use_geoip_dummy"|awk '$1 == "SONAME" {print $2}'`
if test "x$DUMMY_LIBGEOIP_SONAME" != x; then
DUMMY_LIBGEOIP_ORIG="$use_geoip_dummy"
GEOIP_LIB="libxqf_dummy_GeoIP.la"
AC_SUBST(DUMMY_LIBGEOIP_SONAME)
AC_SUBST(DUMMY_LIBGEOIP_ORIG)
else
AC_MSG_ERROR([$use_geoip_dummy is no valid GeoIP library])
fi
else
GEOIP_LIB="-lGeoIP"
fi
else
GEOIP_LIB="$USE_GEOIP"
fi
@ -141,6 +162,29 @@ if test "x$USE_GEOIP" != "xno"; then
fi
fi
AM_CONDITIONAL(DUMMY_LIBGEOIP, test x$DUMMY_LIBGEOIP_SONAME != x)
# --enable-geoip-dummy=/usr/lib/libGeoIP.so
AC_MSG_CHECKING([whether a GDK-Pixbuf dummy library should be used])
AC_ARG_ENABLE(pixbuf_dummy,
[ --enable-pixbuf-dummy=FILE use dummy gdk-pixbuf lib based on FILE (default=no)],
use_pixbuf_dummy="$enableval", use_pixbuf_dummy=no)
AC_MSG_RESULT([$use_pixbuf_dummy])
if test "x$use_pixbuf_dummy" != "xno"; then
DUMMY_LIBGDKPIXBUF_SONAME=`objdump -p "$use_pixbuf_dummy"|awk '$1 == "SONAME" {print $2}'`
if test "x$DUMMY_LIBGDKPIXBUF_SONAME" != x; then
DUMMY_LIBGDKPIXBUF_ORIG="$use_pixbuf_dummy"
GDK_PIXBUF_LIBS="libxqf_dummy_gdk_pixbuf.la"
AC_SUBST(DUMMY_LIBGDKPIXBUF_SONAME)
AC_SUBST(DUMMY_LIBGDKPIXBUF_ORIG)
else
AC_MSG_ERROR([$use_pixbuf_dummy is no valid library])
fi
AC_SUBST(GDK_PIXBUF_LIBS)
fi
AM_CONDITIONAL(DUMMY_LIBGDKPIXBUF, test x$DUMMY_LIBGDKPIXBUF_SONAME != x)
dnl check if user wants bzip2 compression instead of gzip
COMPRESSION="-DCOMPRESSOR_GZIP"
AC_ARG_ENABLE(bzip2,[ --enable-bzip2 use bzip2 for data compression])

View File

@ -16,12 +16,25 @@ INCLUDES = -I$(top_srcdir)/intl \
qstatcfgdir = $(pkgdatadir)
qstatcfg_DATA = qstat.cfg
EXTRA_DIST = qstat.cfg games.xml games.c
EXTRA_DIST = qstat.cfg games.xml games.c $(noinst_SCRIPTS)
bin_PROGRAMS = xqf @XQFRCON@
EXTRA_PROGRAMS = xqf-rcon gamesxml2c
bin_PROGRAMS = xqf
if BUILD_XQFRCON
bin_PROGRAMS += xqf-rcon
endif
xqf_LDADD = @INTLLIBS@ $(top_builddir)/src/zip/libunzip.a $(top_builddir)/src/tga/libtga.a $(GTK_LIBS) $(GDK_PIXBUF_LIBS) -lz $(GEOIP_LIB) @PACKAGE_LIBS@
EXTRA_PROGRAMS = gamesxml2c
xqf_LDADD = $(INTLLIBS) \
$(top_builddir)/src/zip/libunzip.a \
$(top_builddir)/src/tga/libtga.a \
$(GTK_LIBS) \
$(GEOIP_LIB) \
$(PACKAGE_LIBS) \
$(GDK_PIXBUF_LIBS) \
-lz
xqf_LDFLAGS = #-Wl,-rpath,\$$ORIGIN
xqf_rcon_LDADD = @INTLLIBS@ $(GLIB_LIBS) $(XQFRCON_LIBS) @PACKAGE_LIBS@
xqf_rcon_SOURCES = \
@ -115,6 +128,7 @@ i18n.h \
loadpixmap.h \
splash.h
noinst_SCRIPTS = gensyms.pl
noinst_PROGRAMS = test_utils
test_utils_SOURCES = test_utils.c \
utils.c utils.h \
@ -125,6 +139,35 @@ test_utils_LDADD = $(xqf_LDADD)
gamesxml2c_LDFLAGS = $(shell xml2-config --libs)
gamesxml2c_CFLAGS = $(shell xml2-config --cflags)
pkglib_LTLIBRARIES =
if DUMMY_LIBGEOIP
pkglib_LTLIBRARIES += libxqf_dummy_GeoIP.la
endif
if DUMMY_LIBGDKPIXBUF
pkglib_LTLIBRARIES += libxqf_dummy_gdk_pixbuf.la
endif
libxqf_dummy_gdk_pixbuf.c:
$(top_srcdir)/src/gensyms.pl -x gdk_pixbuf_new_from_file,gdk_pixbuf_render_pixmap_and_mask,gdk_pixbuf_unref /opt/gnome/lib/libgdk_pixbuf.so -o $(top_srcdir)/src/libxqf_dummy_gdk_pixbuf.c || rm $(top_srcdir)/src/libxqf_dummy_gdk_pixbuf.c
test -s $(top_srcdir)/src/libxqf_dummy_gdk_pixbuf.c
libxqf_dummy_gdk_pixbuf_la_SOURCES = libxqf_dummy_gdk_pixbuf_stubs.c
nodist_libxqf_dummy_gdk_pixbuf_la_SOURCES = libxqf_dummy_gdk_pixbuf.c
libxqf_dummy_gdk_pixbuf_la_LDFLAGS = -nostdlib -shared -Wl,-f,libgdk_pixbuf.so.2
libxqf_dummy_gdk_pixbuf_la_LIBADD =
libxqf_dummy_GeoIP.c:
$(top_srcdir)/src/gensyms.pl -x GeoIP_new,GeoIP_open $(DUMMY_LIBGEOIP_ORIG) -o $(top_srcdir)/src/libxqf_dummy_GeoIP.c || rm $(top_srcdir)/src/libxqf_dummy_GeoIP.c
test -s $(top_srcdir)/src/libxqf_dummy_GeoIP.c
libxqf_dummy_GeoIP_la_SOURCES = libxqf_dummy_GeoIP_stubs.c
nodist_libxqf_dummy_GeoIP_la_SOURCES = libxqf_dummy_GeoIP.c
libxqf_dummy_GeoIP_la_LDFLAGS = -nostdlib -shared -Wl,-f,$(DUMMY_LIBGEOIP_SONAME)
libxqf_dummy_GeoIP_la_LIBADD =
CLEANFILES = $(nodist_libxqf_dummy_gdk_pixbuf_la_SOURCES) $(nodist_libxqf_dummy_GeoIP_la_SOURCES)
gamelist: gamesxml2c
$(top_builddir)/src/gamesxml2c $(top_srcdir)/src/games.xml > $(top_srcdir)/src/games.c

106
xqf/src/gensyms.pl Executable file
View File

@ -0,0 +1,106 @@
#!/usr/bin/perl -w
# Generate stub functions for library symbols
# Copyright (C) 2005 Ludwig Nussel <l-n@users.sourceforge.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
use strict;
use Getopt::Long;
my $except = [];
my %versions;
my $versfile;
my $outfile;
my $weak;
Getopt::Long::Configure("no_ignore_case");
GetOptions (
"x=s@" => $except,
"v=s" => \$versfile,
"o=s" => \$outfile,
"weak" => \$weak,
) or exit(1);
if(!$outfile)
{
print STDERR "no output file specified\n";
exit(1);
}
$except = { map { $_ => 1 } split(/,/,join(',',@{$except}))};
$except->{'_init'} = 1;
$except->{'_fini'} = 1;
open (OUT, '>', $outfile) or die;
print OUT "static void segv(void) { char* die = 0; ++*die; }\n";
foreach my $file (@ARGV)
{
open (IN, "/usr/bin/nm $file|");
while(<IN>)
{
my ($addr, $type, $sym) = split(/ +/);
next unless ($type eq 'T' || $type eq 'W');
chomp $sym;
next if (exists($except->{$sym}));
my ($ver, $at);
if($sym =~ /(.*?)(\@\@?)(.*)/)
{
$sym = $1;
$at = $2;
$ver = $3;
}
if($ver)
{
my $vsym = sprintf "SEGV_%08X_%s",int(rand(0xffffffff)), $sym;
push @{$versions{$ver}}, $vsym;
print OUT "__asm__(\".symver $vsym,$sym$at$ver\");\n";
print OUT "void $vsym() { segv(); }\n" unless $weak;
print OUT "void $vsym() __attribute__ ((weak, alias (\"segv\")));\n" if $weak;
}
else
{
print OUT "void $sym() { segv(); }\n" unless $weak;
print OUT "void $sym() __attribute__ ((weak, alias (\"segv\")));\n" if $weak;
}
}
close IN;
}
close OUT;
if(scalar keys %versions)
{
if(!$versfile)
{
print STDERR "no version file specified but versioned symbols found\n";
exit(1);
}
open (OUT, '>', $versfile) or die;
foreach my $ver (keys %versions)
{
print OUT "$ver {\n local:\n";
foreach my $sym (@{$versions{$ver}})
{
print OUT " $sym;\n";
}
print OUT "};\n";
}
close OUT;
}

View File

@ -0,0 +1,33 @@
/* XQF - Quake server browser and launcher
* Dummy functions for GeoIP
* Copyright (C) 2005 Ludwig Nussel <l-n@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include <GeoIP.h>
const char GeoIP_country_code[247][3];
const char * GeoIP_country_name[247];
GEOIP_API GeoIP* GeoIP_new(int flags)
{
return 0;
}
GEOIP_API GeoIP* GeoIP_open(const char * filename, int flags)
{
return 0;
}

View File

@ -0,0 +1,35 @@
/* XQF - Quake server browser and launcher
* Dummy functions for gdk pixbuf
* Copyright (C) 2005 Ludwig Nussel <l-n@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include <stddef.h>
void *gdk_pixbuf_new_from_file (const char *filename)
{
return NULL;
}
void gdk_pixbuf_render_pixmap_and_mask(void *pixbuf,
void **pixmap_return, void **mask_return,
int alpha_threshold)
{
*pixmap_return = NULL;
*mask_return = NULL;
}
void gdk_pixbuf_unref(void *p) {};