couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject [24/41] support static build
Date Tue, 11 Feb 2014 08:07:26 GMT
http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/9e429fd2/patches/js/patch-configure_in
----------------------------------------------------------------------
diff --git a/patches/js/patch-configure_in b/patches/js/patch-configure_in
new file mode 100644
index 0000000..94194d4
--- /dev/null
+++ b/patches/js/patch-configure_in
@@ -0,0 +1,56 @@
+--- configure.in.orig	2012-06-13 21:24:15.000000000 +0200
++++ configure.in	2012-06-13 21:29:10.000000000 +0200
+@@ -1038,17 +1038,6 @@
+     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
+     MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
+ 
+-    case "$PBBUILD" in
+-      *xcodebuild*)
+-        changequote(,)
+-        XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
+-        changequote([,])
+-        if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ;
then
+-          HAS_XCODE_2_1=1;
+-        fi
+-      ;;
+-    esac
+-
+     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
+     dnl it has moved into /usr/bin.
+     MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
+@@ -1056,8 +1045,6 @@
+ esac
+ 
+ AC_SUBST(GCC_VERSION)
+-AC_SUBST(XCODEBUILD_VERSION)
+-AC_SUBST(HAS_XCODE_2_1)
+ 
+ dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
+ dnl that a universal binary is being produced.
+@@ -4656,6 +4643,12 @@
+ 
+ dnl Setup default CPU arch for arm target
+ case "$target_cpu" in
++  armv5*)
++    MOZ_ARM_ARCH=armv5
++  ;;
++  armv6*)
++    MOZ_ARM_ARCH=armv6
++  ;;
+   arm*)
+     MOZ_ARM_ARCH=armv7
+   ;;
+@@ -4716,6 +4709,13 @@
+   esac
+ else
+   case "$target_cpu" in
++    armv6*)
++      if test "$GNU_CC"; then
++        CFLAGS="$CFLAGS -march=armv6j -mthumb-interwork -msoft-float"
++        CXXFLAGS="$CXXFLAGS -march=armv6j -mthumb-interwork -msoft-float"
++        ASFLAGS="$ASFLAGS -march=armv6j -mthumb-interwork -msoft-float"
++      fi
++      ;;
+     arm*)
+       if test "$GNU_CC"; then
+         CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork -msoft-float"

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/9e429fd2/patches/js/patch-jscntxt_h
----------------------------------------------------------------------
diff --git a/patches/js/patch-jscntxt_h b/patches/js/patch-jscntxt_h
new file mode 100644
index 0000000..2df18be
--- /dev/null
+++ b/patches/js/patch-jscntxt_h
@@ -0,0 +1,10 @@
+--- jscntxt.h.orig	2011-10-08 12:18:14.000000000 +0200
++++ jscntxt.h	2011-10-08 12:18:18.000000000 +0200
+@@ -44,6 +44,7 @@
+  * JS execution context.
+  */
+ #include <string.h>
++#include <sys/types.h>
+ 
+ /* Gross special case for Gecko, which defines malloc/calloc/free. */
+ #ifdef mozilla_mozalloc_macro_wrappers_h

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/9e429fd2/patches/js/patch-jsprf_cpp
----------------------------------------------------------------------
diff --git a/patches/js/patch-jsprf_cpp b/patches/js/patch-jsprf_cpp
new file mode 100644
index 0000000..29a51e7
--- /dev/null
+++ b/patches/js/patch-jsprf_cpp
@@ -0,0 +1,11 @@
+--- jsprf.cpp.orig	2011-03-31 12:11:03.000000000 +0200
++++ jsprf.cpp	2011-03-31 12:11:09.000000000 +0200
+@@ -58,6 +58,8 @@
+ */
+ #ifdef HAVE_VA_COPY
+ #define VARARGS_ASSIGN(foo, bar)        VA_COPY(foo,bar)
++#elif defined(va_copy)
++#define VARARGS_ASSIGN(foo, bar)        va_copy(foo,bar)
+ #elif defined(HAVE_VA_LIST_AS_ARRAY)
+ #define VARARGS_ASSIGN(foo, bar)        foo[0] = bar[0]
+ #else

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/9e429fd2/rebar.config.script
----------------------------------------------------------------------
diff --git a/rebar.config.script b/rebar.config.script
index 2b187b6..5a75a3d 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -68,41 +68,86 @@ GetFlag = fun(Name, Default) ->
     end,
 
 
-JSLIBS = GetFlag("JS_LIBS", "-lmozjs185"),
-JSCFLAGS = GetFlag("JS_CFLAGS", "-I/usr/include/js"),
-
-{CFLAGS, LDFLAGS}  = case os:type() of
-    {unix, darwin} ->
-        {"-DXP_UNIX " ++ JSCFLAGS, JSLIBS};
-    {unix, _} ->
-        {"-DXP_UNIX " ++ JSCFLAGS, JSLIBS ++ " -lm"};
+
+PortEnv = case os:getenv("COUCHDB_STATIC") of
+    "1" ->
+        {ok, Cwd} = file:get_cwd(),
+        IncJs = filename:join([Cwd, ".libs", "js", "include"]),
+        IncNspr= filename:join([Cwd, ".libs", "nsprpub", "include"]),
+        StaticJs = filename:join([Cwd, ".libs", "js", "lib",
+                                 "libjs_static.a"]),
+        StaticNspr = filename:join([Cwd, ".libs", "nsprpub", "lib",
+                                    "libnspr4.a"]),
+
+
+        CFLAGS = GetFlag("JS_CFLAGS", "-I" ++ IncJs ++
+                                      " -I" ++ IncNspr ++ " -DXP_UNIX -Wall"),
+        LDFLAGS = GetFlag("JS_LIBS", StaticJs ++ " " ++ StaticNspr),
+
+        {CFLAGS1, LDFLAGS1} = case os:getenv("WITHOUT_CURL") of
+            "1" -> {"-DWITHOUT_CURL " ++ CFLAGS, LDFLAGS};
+            _ -> {CFLAGS, LDFLAGS ++ " -lcurl"}
+        end,
+
+        [
+            {"CFLAGS", "$CFLAGS -Wall -c -g -O2 " ++ CFLAGS1},
+            {"LDFLAGS", "$LDFLAGS " ++ LDFLAGS1 ++ " -lstdc++"},
+            {"linux.*", "LDFLAGS", "$LDFLAGS " ++ LDFLAGS1 ++
+                                   " -lstdc++ -lpthread -lm"},
+
+            %% Prevent the make->gmake transition from infecting
+            %% MAKEFLAGS with bad flags that confuse gmake
+            {"freebsd.*", "MAKEFLAGS", ""},
+            {"freebsd.*","LDFLAGS", "$LDFLAGS " ++ LDFLAGS1 ++
+                                     " -lstdc++ -lpthread"}
+        ];
     _ ->
-        {"-DXP_WIN " ++ JSCFLAGS, JSLIBS}
+        JSLIBS = GetFlag("JS_LIBS", "-lmozjs185"),
+
+        {CFLAGS, LDFLAGS}  = case os:type() of
+            {unix, darwin} ->
+                JSCFLAGS = GetFlag("JS_CFLAGS", "-I/usr/local/include/js"),
+                {"-DXP_UNIX " ++ JSCFLAGS, JSLIBS};
+            {unix, linux} ->
+                %% generally linux install in /usr/include
+                JSCFLAGS = GetFlag("JS_CFLAGS", "-I/usr/include/js"),
+                {"-DXP_UNIX " ++ JSCFLAGS, JSLIBS ++ " -lm"};
+            {unix, _} ->
+                %% most likely a bsd
+                JSCFLAGS = GetFlag("JS_CFLAGS", "-I/usr/local/include/js"),
+                {"-DXP_UNIX " ++ JSCFLAGS, JSLIBS ++ " -lm"};
+            _ ->
+                JSCFLAGS = GetFlag("JS_CFLAGS", "-I/usr/include/js"),
+                {"-DXP_WIN " ++ JSCFLAGS, JSLIBS}
+        end,
+
+        {CFLAGS1, LDFLAGS1} = case os:getenv("WITHOUT_CURL") of
+            "1" -> {"-DWITHOUT_CURL " ++ CFLAGS, LDFLAGS};
+            _ -> {CFLAGS, LDFLAGS ++ " -lcurl"}
+        end,
+
+        [
+            {"CFLAGS",  "$CFLAGS -Wall -c -g -O2 " ++ CFLAGS1},
+            {"LDFLAGS", "$LDFLAGS " ++ LDFLAGS1}
+        ]
 end,
 
-{CFLAGS1, LDFLAGS1} = case os:getenv("WITHOUT_CURL") of
-    "1" -> {"-DWITHOUT_CURL " ++ CFLAGS, LDFLAGS};
-    _ -> {CFLAGS, LDFLAGS ++ " -lcurl"}
-end,
+PortSpecs0 = [{filename:join(["priv", CouchJSName]), ["c_src/couch_js/*.c"]}],
 
-PortSpecs0 = case os:type() of
+PortSpecs = case os:type() of
     {win32, _} ->
-        [{filename:join(["priv", "couchspawnkillable"]),
+        PortSpecs0 ++ [{filename:join(["priv", "couchspawnkillable"]),
             ["c_src/spawnkillable/*.c"]}];
     _ ->
         {ok, _} = file:copy("priv/couchspawnkillable.sh",
                             "priv/couchspawnkillable"),
         os:cmd("chmod +x priv/couchspawnkillable"),
-        []
+        PortSpecs0
     end,
 
-PortEnv = [{port_env, [
-            {"CFLAGS",  "$CFLAGS -Wall -c -g -O2 " ++ CFLAGS1},
-            {"LDFLAGS", "$LDFLAGS " ++ LDFLAGS1}]},
-
-           {port_specs, [
-            {filename:join(["priv", CouchJSName]),
-            ["c_src/couch_js/*.c"]}] ++ PortSpecs0}
-],
+PortInfo = [{port_env, PortEnv},
+            {port_specs, PortSpecs},
+            {pre_hooks, [{compile, "./build_spidermonkey.sh"}]},
+            {post_hooks, [{clean, "./build_spidermonkey.sh clean"}]}],
 
-lists:keymerge(1,lists:keysort(1, PortEnv), lists:keysort(1, CONFIG)).
+lists:keymerge(1,lists:keysort(1, PortInfo), lists:keysort(1, CONFIG)).


Mime
View raw message