Skip to contentSkip to conversation

Enable compliation under Darwin

PATCH In review Roy Marples 2 participants 3 messages Apr 5, 2006 – Apr 7, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Enable compliation under Darwin

Hi List!

Attached is a patch we use in Gentoo (well, the only patch) that allows compilation on on ppc-macos (Darwin). I don't have this platform myself, but our ppc-macos users seem to need it, so I'm submitting it for upstream inclusion.

Thanks!

Signature · 2 lines
Roy Marples <[email protected]...>
Gentoo Linux Developer
plugin/down-root/Makefile renamed from plugin/down-root/Makefile.orig +12 -1
@@ -7,11 +7,22 @@
 
 CC_FLAGS=-O2 -Wall
 
+ifeq ($(USERLAND),Darwin)
+	LIBNAME=dylib
+else
+	LIBNAME=so
+endif
+
+lib : down-root.$(LIBNAME)
+
 down-root.so : down-root.o
 	gcc ${CC_FLAGS} -fPIC -shared -Wl,-soname,openvpn-down-root.so -o openvpn-down-root.so down-root.o -lc
 
+down-root.dylib : down-root.o
+	gcc ${CC_FLAGS} -dynamiclib -install_name openvpn-down-root.dylib -o openvpn-down-root.dylib down-root.o -lc
+
 down-root.o : down-root.c
 	gcc ${CC_FLAGS} -fPIC -c ${INCLUDE} down-root.c
 
 clean :
-	rm -f *.o *.so
+	rm -f *.o *.so *.dylib
#1 lore raw
Quoted 16 lines · Roy Marples
plugin/down-root/Makefile renamed from plugin/down-root/Makefile.orig +8 -0
@@ -7,11 +7,22 @@
 
 CC_FLAGS=-O2 -Wall
 
+ifeq ($(USERLAND),Darwin)
+	LIBNAME=dylib
+else
+	LIBNAME=so
+endif
+
+lib : down-root.$(LIBNAME)
+
 down-root.so : down-root.o
 	gcc ${CC_FLAGS} -fPIC -shared -Wl,-soname,openvpn-down-root.so -o openvpn-down-root.so down-root.o -lc

plugin/down-root/Makefile line 28

Quoted 10 lines
plugin/down-root/Makefile renamed from plugin/down-root/Makefile.orig +4 -1
 
+down-root.dylib : down-root.o
+	gcc ${CC_FLAGS} -dynamiclib -install_name openvpn-down-root.dylib -o openvpn-down-root.dylib down-root.o -lc
+
 down-root.o : down-root.c
 	gcc ${CC_FLAGS} -fPIC -c ${INCLUDE} down-root.c
 
 clean :
-	rm -f *.o *.so
+	rm -f *.o *.so *.dylib

According to the Fink porting documents[1], this is not the right way to link loadable modules on Mac OS X. The module should properly end with ".so", and the compiler flags should include "-bundle" and not "-dynamiclib", which should only be used when linking a shared library.

[1] http://fink.sf.net/doc/porting/shared.php?phpLang=en#lib-and-mod

	Cheers,

	-- Johnny Lam <[email protected]...>
#2 lore raw
Quoted 10 lines · Johnny Lam

According to the Fink porting documents[1], this is not the right way to link loadable modules on Mac OS X. The module should properly end with ".so", and the compiler flags should include "-bundle" and not "-dynamiclib", which should only be used when linking a shared library.

[1] http://fink.sf.net/doc/porting/shared.php?phpLang=en#lib-and-mod

	Cheers,

	-- Johnny Lam <[email protected]...>

I've forward this to our ppc-macos team. Their initial response was that the document is out of date, but they'll get back with a definite answer.

Thanks

Signature · 2 lines
Roy Marples <[email protected]...>
Gentoo Linux Developer