From 3102dedbb8a4bf4b0263715d507e3603cf048711 Mon Sep 17 00:00:00 2001 From: w00t Date: Thu, 1 Feb 2007 12:14:54 +0000 Subject: New patch from BuildSmart for OS X support, not broken like the last one git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6473 e03df62e-2008-0410-955e-edbf42e46eb7 --- .Makefile.inc | 47 +++++++++--------- configure | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++++- make/utilities.pm | 1 + src/modes/Makefile | 1 + 4 files changed, 166 insertions(+), 25 deletions(-) diff --git a/.Makefile.inc b/.Makefile.inc index 6cde00796..ed944d491 100644 --- a/.Makefile.inc +++ b/.Makefile.inc @@ -18,6 +18,7 @@ CONPATH = $(DESTDIR)@CONFIG_DIR@ MODPATH = $(DESTDIR)@MODULE_DIR@ BINPATH = $(DESTDIR)@BINARY_DIR@ LIBPATH = $(DESTDIR)@LIBRARY_DIR@ +LIB_EXT = @LIBRARY_EXT@ MODULES = @MODULES@ STATICLIBS = @STATICLIBS@ INSTMODE = 0700 @@ -72,28 +73,28 @@ install: all @-install -d -m $(INSTMODE) $(BINPATH) @-install -d -m $(INSTMODE) $(CONPATH) @-install -d -m $(INSTMODE) ${MODPATH} - -install -m $(INSTMODE) src/libIRCDasyncdns.so $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDbase.so $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDchannels.so $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDcommand_parse.so $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDcommands.so $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDconfigreader.so $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDcull_list.so $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDdynamic.so $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDhash.so $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDhelper.so $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDinspsocket.so $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDmode.so $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDmodules.so $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDsocket.so $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDsocketengine.so $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDstring.so $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDuserprocess.so $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDusers.so $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDwildcard.so $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDxline.so $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDtimer.so $(LIBPATH) - -install -m $(INSTMODE) src/libIRCDsnomasks.so $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDasyncdns.$(LIB_EXT) $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDbase.$(LIB_EXT) $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDchannels.$(LIB_EXT) $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDcommand_parse.$(LIB_EXT) $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDcommands.$(LIB_EXT) $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDconfigreader.$(LIB_EXT) $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDcull_list.$(LIB_EXT) $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDdynamic.$(LIB_EXT) $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDhash.$(LIB_EXT) $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDhelper.$(LIB_EXT) $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDinspsocket.$(LIB_EXT) $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDmode.$(LIB_EXT) $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDmodules.$(LIB_EXT) $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDsocket.$(LIB_EXT) $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDsocketengine.$(LIB_EXT) $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDstring.$(LIB_EXT) $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDuserprocess.$(LIB_EXT) $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDusers.$(LIB_EXT) $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDwildcard.$(LIB_EXT) $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDxline.$(LIB_EXT) $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDtimer.$(LIB_EXT) $(LIBPATH) + -install -m $(INSTMODE) src/libIRCDsnomasks.$(LIB_EXT) $(LIBPATH) -install -m $(INSTMODE) src/inspircd $(BINPATH) -install -m $(INSTMODE) inspircd $(BASE) 2>/dev/null -install -m $(INSTMODE) src/cmd_admin.so $(LIBPATH) @@ -180,7 +181,7 @@ module: clean: @echo Cleaning... - @rm -rvf src/*.so src/*.o src/inspircd src/modules/*.so src/modules/*.o *~ src/*~ src/modules/*~ src/modules/extra/*~ src/modes/*~ src/modes/*.o src/modes/*.a src/modules/*/*.o src/modules/*/*.so + @rm -rvf src/*.so src/*.dylib src/*.o src/inspircd src/modules/*.so src/modules/*.o *~ src/*~ src/modules/*~ src/modules/extra/*~ src/modes/*~ src/modes/*.o src/modes/*.a src/modules/*/*.o src/modules/*/*.so @echo Completed. modclean: diff --git a/configure b/configure index db0e358e5..6b736e92e 100755 --- a/configure +++ b/configure @@ -217,6 +217,11 @@ chomp($config{MAX_DESCRIPTORS} = `sh -c \"ulimit -n\"`); # Hard FD Limit chomp($config{GCCVER} = `g++ -dumpversion | cut -c 1`); # Major GCC Version $config{_SOMAXCONN} = SOMAXCONN; # Max connections in accept queue $config{OSNAME} = $^O; # Operating System Name +$config{IS_DARWIN} = "NO"; # Is OSX? +if ($config{OSNAME} =~ /darwin/i) +{ + $config{IS_DARWIN} = "YES"; +} $config{CC} = "g++"; # C++ compiler if (defined $opt_cc) { @@ -845,8 +850,15 @@ sub getosflags { $config{LDLIBS} = "-lstdc++"; $config{FLAGS} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}"; $config{DEVELOPER} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual -g"; + $SHARED = "-Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared"; $config{MAKEPROG} = "make"; + if ($config{OSNAME} =~ /darwin/i) { + $config{FLAGS} = "-DDARWIN -frtti -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}"; + $SHARED = "-bundle -twolevel_namespace -undefined dynamic_lookup"; + $config{LDLIBS} = "-ldl -lstdc++"; + } + if ($config{OSNAME} =~ /OpenBSD/i) { $config{MAKEPROG} = "gmake"; chomp($foo = `eg++ -dumpversion | cut -c 1`); @@ -1061,6 +1073,11 @@ EOF chomp(my $revision = getrevision()); $version = "$version(r$revision)"; + my $LIBEXT = "so"; + if ($config{IS_DARWIN} eq "YES") + { + $LIBEXT = "dylib"; + } # We can actually parse any file starting with . and ending with .inc, # but right now we only parse .inspircd.inc to form './inspircd' @@ -1085,6 +1102,7 @@ EOF $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/; $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/; $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/; + $tmp =~ s/\@LIBRARY_EXT\@/$LIBEXT/; $tmp =~ s/\@MODULES\@/$modules/; $tmp =~ s/\@EXECUTABLE\@/$exe/; $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/; @@ -1261,9 +1279,19 @@ EOF print FILEHANDLE <