Re: Clearsilver on Mac OS X

Brandon Long <[email protected]>
Newsgroups gmane.text.clearsilver.general
Organization Fiction L Networks
Message-ID <20070330190219.GA28950@bl1>
Attached again is the patch for macosx for clearsilver 0.10.4

It'll get the C code to compile (which is what the below error is).  It
will also make some changes to the Makefile for java so that java will
compile, though you may need to edit rules.mk manually for the right
java paths.

diff -Nru clearsilver-0.10.4/cgi/cgiwrap.c clearsilver-0.10.4-macosx/cgi/cgiwrap.c
--- clearsilver-0.10.4/cgi/cgiwrap.c	Tue Mar 28 16:12:37 2006
+++ clearsilver-0.10.4-macosx/cgi/cgiwrap.c	Tue Nov 28 08:41:42 2006
@@ -11,7 +11,9 @@
 
 #include "cs_config.h"
 
+#if HAVE_FEATURES_H
 #include <features.h>
+#endif
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
diff -Nru clearsilver-0.10.4/configure.in clearsilver-0.10.4-macosx/configure.in
--- clearsilver-0.10.4/configure.in	Sun Mar 12 16:05:26 2006
+++ clearsilver-0.10.4-macosx/configure.in	Tue Nov 28 08:39:10 2006
@@ -26,7 +26,7 @@
 AC_HEADER_DIRENT
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(fcntl.h stdarg.h varargs.h limits.h strings.h sys/ioctl.h sys/time.h unistd.h)
+AC_CHECK_HEADERS(fcntl.h stdarg.h varargs.h limits.h strings.h sys/ioctl.h sys/time.h unistd.h features.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
diff -Nru clearsilver-0.10.4/cs_config.h.in clearsilver-0.10.4-macosx/cs_config.h.in
--- clearsilver-0.10.4/cs_config.h.in	Thu Jun 30 18:49:22 2005
+++ clearsilver-0.10.4-macosx/cs_config.h.in	Tue Nov 28 09:41:43 2006
@@ -74,6 +74,9 @@
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
+/* Define to 1 if you have the <features.h> header file. */
+#undef HAVE_FEATURES_H
+
 /* Define to 1 if you have the `gettimeofday' function. */
 #undef HAVE_GETTIMEOFDAY
 
diff -Nru clearsilver-0.10.4/java-jni/Makefile clearsilver-0.10.4-macosx/java-jni/Makefile
--- clearsilver-0.10.4/java-jni/Makefile	Mon Aug  7 13:05:13 2006
+++ clearsilver-0.10.4-macosx/java-jni/Makefile	Tue Nov 28 10:03:33 2006
@@ -8,6 +8,9 @@
 include $(NEOTONIC_ROOT)/rules.mk
 
 NEO_UTIL_SO = libclearsilver-jni.so
+ifeq ($(OSTYPE),Darwin)
+NEO_UTIL_SO = libclearsilver-jni.jnilib
+endif
 NEO_UTIL_JAVA_SRC = HDF.java CS.java # CGI.java
 NEO_UTIL_JAVA_CLASS = $(NEO_UTIL_JAVA_SRC:%.java=%)
 NEO_UTIL_JAVA_CLASSFILES = $(NEO_UTIL_JAVA_SRC:%.java=%.class)
@@ -19,7 +22,12 @@
 CFLAGS += $(JAVA_INCLUDE_PATH)
 DLIBS += -lneo_cgi -lneo_cs -lneo_utl
 LIBS += $(DLIBS)
+ifneq ($(OSTYPE),Darwin)
 LDFLAGS += -Wl,-soname=$(NEO_UTIL_SO)
+JAVA_LDSHARED = $(LDSHARED)
+else
+JAVA_LDSHARED = MACOSX_DEPLOYMENT_TARGET=10.3 $(LDSHARED)
+endif
 
 TARGETS = org_clearsilver_HDF.h org_clearsilver_CS.h $(NEO_UTIL_SO)
 
diff -Nru clearsilver-0.10.4/python/setup.py clearsilver-0.10.4-macosx/python/setup.py
--- clearsilver-0.10.4/python/setup.py	Tue Nov 14 22:54:32 2006
+++ clearsilver-0.10.4-macosx/python/setup.py	Tue Nov 28 09:02:25 2006
@@ -31,7 +31,7 @@
 if not os.path.exists("../rules.mk"):
   raise "You need to run configure first to generate the rules.mk file!"
 
-make_vars = {}
+make_vars = { 'NEOTONIC_ROOT' : '..' }
 rules = open("../rules.mk").read()
 for line in string.split(rules, "\n"):
   parts = string.split(line, '=', 1)
@@ -78,7 +78,12 @@
     if var[:2] == "$(" and var[-1] == ")":
       var = variables.get(var[2:-1], "")
     return var
-  return re.sub('(\$\([^\)]*\))', replace_var, var)
+  while 1:
+    new_var = re.sub('(\$\([^\)]*\))', replace_var, var)
+    if new_var == var: break
+    var = new_var
+  return var.strip()
+
 
 def expand_vars(vlist, vars):
   nlist = []
diff -Nru clearsilver-0.10.4/rules.mk.in clearsilver-0.10.4-macosx/rules.mk.in
--- clearsilver-0.10.4/rules.mk.in	Fri Dec  2 03:25:19 2005
+++ clearsilver-0.10.4-macosx/rules.mk.in	Tue Nov 28 09:51:41 2006
@@ -105,6 +105,10 @@
 ifeq ($(OSNAME),SunOS)
 LDSHARED   = ld -G -fPIC
 endif
+ifeq ($(OSTYPE),Darwin)
+LDSHARED   = $(CC) -bundle -flat_namespace -undefined suppress $(PICFLG)
+CPPLDSHARED   = $(CPP) -bundle -flat_namespace -undefined suppress $(PICFLG)
+endif
 
 ## --------------win32 options
 

Brandon

On 03/30/07 Matthew Hixson uttered the following other thing:
> I see that some people have gotten Clearsilver installed and running  
> on Mac OS X, but I can't find directions on how to get it to  
> compile.  Its available through Darwin Ports, but I'd like to avoid  
> installing that just to get Clearsilver compiled.
>    What I'm needing is the JNI library for use with Java.  I'm on OS  
> X 10.4.9.  I've configured with this:
> 
> ./configure --prefix=/usr/local --disable-python --disable-ruby -- 
> with-java=/usr
> 
> Configure runs successfully, but make fails with:
> 
> Manifying blib/man3/ClearSilver.3pm
> /usr/bin/javah -classpath clearsilver.jar -jni org.clearsilver.HDF
> /usr/bin/javah -classpath clearsilver.jar -jni org.clearsilver.CS
> gcc -g -O2 -Wall -I..  -fPIC -I/System/Library/Frameworks/ 
> JavaVM.framework/Versions/CurrentJDK/Headers -o j_neo_util.o -c  
> j_neo_util.c
> gcc -g -O2 -Wall -I..  -fPIC -I/System/Library/Frameworks/ 
> JavaVM.framework/Versions/CurrentJDK/Headers -o j_neo_cs.o -c j_neo_cs.c
> make[1]: *** No rule to make target `../libs/libneo_cgi.a', needed by  
> `libclearsilver-jni.so'.  Stop.
> make: *** [cs] Error 2
> 
> 
> Anyone have a patch or directions on how to get this to compile?
>    Thanks for your time,
>     -M@
> 
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 

-- 
  "The family seems to have two predominant functions:  to provide
   warmth and love in time of need and to drive each other insane."
          -- Donald G. Smith  
	                          http://www.fiction.net/blong/
macosx.patch (text/plain, 3.6 KB)
diff -Nru clearsilver-0.10.4/cgi/cgiwrap.c clearsilver-0.10.4-macosx/cgi/cgiwrap.c
--- clearsilver-0.10.4/cgi/cgiwrap.c	Tue Mar 28 16:12:37 2006
+++ clearsilver-0.10.4-macosx/cgi/cgiwrap.c	Tue Nov 28 08:41:42 2006
@@ -11,7 +11,9 @@
 
 #include "cs_config.h"
 
+#if HAVE_FEATURES_H
 #include <features.h>
+#endif
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
diff -Nru clearsilver-0.10.4/configure.in clearsilver-0.10.4-macosx/configure.in
--- clearsilver-0.10.4/configure.in	Sun Mar 12 16:05:26 2006
+++ clearsilver-0.10.4-macosx/configure.in	Tue Nov 28 08:39:10 2006
@@ -26,7 +26,7 @@
 AC_HEADER_DIRENT
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(fcntl.h stdarg.h varargs.h limits.h strings.h sys/ioctl.h sys/time.h unistd.h)
+AC_CHECK_HEADERS(fcntl.h stdarg.h varargs.h limits.h strings.h sys/ioctl.h sys/time.h unistd.h features.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
diff -Nru clearsilver-0.10.4/cs_config.h.in clearsilver-0.10.4-macosx/cs_config.h.in
--- clearsilver-0.10.4/cs_config.h.in	Thu Jun 30 18:49:22 2005
+++ clearsilver-0.10.4-macosx/cs_config.h.in	Tue Nov 28 09:41:43 2006
@@ -74,6 +74,9 @@
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
+/* Define to 1 if you have the <features.h> header file. */
+#undef HAVE_FEATURES_H
+
 /* Define to 1 if you have the `gettimeofday' function. */
 #undef HAVE_GETTIMEOFDAY
 
diff -Nru clearsilver-0.10.4/java-jni/Makefile clearsilver-0.10.4-macosx/java-jni/Makefile
--- clearsilver-0.10.4/java-jni/Makefile	Mon Aug  7 13:05:13 2006
+++ clearsilver-0.10.4-macosx/java-jni/Makefile	Tue Nov 28 10:03:33 2006
@@ -8,6 +8,9 @@
 include $(NEOTONIC_ROOT)/rules.mk
 
 NEO_UTIL_SO = libclearsilver-jni.so
+ifeq ($(OSTYPE),Darwin)
+NEO_UTIL_SO = libclearsilver-jni.jnilib
+endif
 NEO_UTIL_JAVA_SRC = HDF.java CS.java # CGI.java
 NEO_UTIL_JAVA_CLASS = $(NEO_UTIL_JAVA_SRC:%.java=%)
 NEO_UTIL_JAVA_CLASSFILES = $(NEO_UTIL_JAVA_SRC:%.java=%.class)
@@ -19,7 +22,12 @@
 CFLAGS += $(JAVA_INCLUDE_PATH)
 DLIBS += -lneo_cgi -lneo_cs -lneo_utl
 LIBS += $(DLIBS)
+ifneq ($(OSTYPE),Darwin)
 LDFLAGS += -Wl,-soname=$(NEO_UTIL_SO)
+JAVA_LDSHARED = $(LDSHARED)
+else
+JAVA_LDSHARED = MACOSX_DEPLOYMENT_TARGET=10.3 $(LDSHARED)
+endif
 
 TARGETS = org_clearsilver_HDF.h org_clearsilver_CS.h $(NEO_UTIL_SO)
 
diff -Nru clearsilver-0.10.4/python/setup.py clearsilver-0.10.4-macosx/python/setup.py
--- clearsilver-0.10.4/python/setup.py	Tue Nov 14 22:54:32 2006
+++ clearsilver-0.10.4-macosx/python/setup.py	Tue Nov 28 09:02:25 2006
@@ -31,7 +31,7 @@
 if not os.path.exists("../rules.mk"):
   raise "You need to run configure first to generate the rules.mk file!"
 
-make_vars = {}
+make_vars = { 'NEOTONIC_ROOT' : '..' }
 rules = open("../rules.mk").read()
 for line in string.split(rules, "\n"):
   parts = string.split(line, '=', 1)
@@ -78,7 +78,12 @@
     if var[:2] == "$(" and var[-1] == ")":
       var = variables.get(var[2:-1], "")
     return var
-  return re.sub('(\$\([^\)]*\))', replace_var, var)
+  while 1:
+    new_var = re.sub('(\$\([^\)]*\))', replace_var, var)
+    if new_var == var: break
+    var = new_var
+  return var.strip()
+
 
 def expand_vars(vlist, vars):
   nlist = []
diff -Nru clearsilver-0.10.4/rules.mk.in clearsilver-0.10.4-macosx/rules.mk.in
--- clearsilver-0.10.4/rules.mk.in	Fri Dec  2 03:25:19 2005
+++ clearsilver-0.10.4-macosx/rules.mk.in	Tue Nov 28 09:51:41 2006
@@ -105,6 +105,10 @@
 ifeq ($(OSNAME),SunOS)
 LDSHARED   = ld -G -fPIC
 endif
+ifeq ($(OSTYPE),Darwin)
+LDSHARED   = $(CC) -bundle -flat_namespace -undefined suppress $(PICFLG)
+CPPLDSHARED   = $(CPP) -bundle -flat_namespace -undefined suppress $(PICFLG)
+endif
 
 ## --------------win32 options
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.