couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woh...@apache.org
Subject couch-collate commit: updated refs/heads/1994-merge-rcouch to 3a8f260
Date Sat, 19 Apr 2014 02:32:34 GMT
Repository: couchdb-couch-collate
Updated Branches:
  refs/heads/1994-merge-rcouch 985a7f80c -> 3a8f260a2


Support Windows build, use official ICU src (for now)

COUCHDB-1994


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-collate/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-collate/commit/3a8f260a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-collate/tree/3a8f260a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-collate/diff/3a8f260a

Branch: refs/heads/1994-merge-rcouch
Commit: 3a8f260a246928e20048bcdbe69a078f1d306865
Parents: 985a7f8
Author: Joan Touzet <wohali@apache.org>
Authored: Fri Apr 18 22:31:03 2014 -0400
Committer: Joan Touzet <wohali@apache.org>
Committed: Fri Apr 18 22:31:03 2014 -0400

----------------------------------------------------------------------
 .gitattributes      |  2 ++
 .gitignore          |  3 ++
 build_icu.ps1       | 71 ++++++++++++++++++++++++++++++++++++++++++++++++
 build_icu.sh        |  2 +-
 rebar.config.script | 43 ++++++++++++++++++++++++-----
 5 files changed, 113 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-collate/blob/3a8f260a/.gitattributes
----------------------------------------------------------------------
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..1135ec5
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,2 @@
+* -text
+

http://git-wip-us.apache.org/repos/asf/couchdb-couch-collate/blob/3a8f260a/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index eae0096..e08b336 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,6 @@ ebin
 t/*.beam
 .dists
 .libs
+*.pdb
+*~
+priv

http://git-wip-us.apache.org/repos/asf/couchdb-couch-collate/blob/3a8f260a/build_icu.ps1
----------------------------------------------------------------------
diff --git a/build_icu.ps1 b/build_icu.ps1
new file mode 100644
index 0000000..465d756
--- /dev/null
+++ b/build_icu.ps1
@@ -0,0 +1,71 @@
+param([switch]$clean)
+
+$ICU_ZIP = "icu4c-4_8_1-Win32-msvc10.zip"
+$ICU_URL="http://download.icu-project.org/files/icu4c/4.8.1"
+
+$DISTDIR="${pwd}\.dists"
+$STATICLIBS="${pwd}\.libs"
+$ICUDIR="${STATICLIBS}\icu"
+
+#
+# improved remove-item -recurse -force
+# thanks to http://serverfault.com/questions/199921/powershell-remove-force
+#
+function rmrf($directory = $(throw "Required parameter missing")) {
+    if ((test-path $directory) -and -not
+            (gi $directory | ? { $_.PSIsContainer })) {
+        throw ("rmrf called on non-directory.");
+    }
+
+    $finished = $false;
+    $attemptsLeft = 3;
+
+    do {
+        if (test-path $directory) {
+            rm $directory -recurse -force 2>&1 | out-null
+        }
+        if (test-path $directory) {
+            Start-Sleep -Milliseconds 500
+            $attemptsLeft = $attemptsLeft - 1
+        } else {
+            $finished = $true
+        }
+    } while (-not $finished -and $attemptsLeft -gt 0)
+
+    if (test-path $directory) {
+        throw ("Unable to fully remove directory " + $directory)
+    }
+}
+
+
+#
+# main
+#
+if ($clean -eq $true) {
+    write-host "==> icu (clean)"
+    rmrf($STATICLIBS)
+    rmrf($DISTDIR)
+} else {
+    write-host "==> icu (binary-download)"
+    rmrf($STATICLIBS)
+    rmrf($DISTDIR)
+    md $STATICLIBS -ea silentlycontinue > $null
+    md $DISTDIR -ea silentlycontinue > $null
+
+    # download the zip
+    $source = "${ICU_URL}/${ICU_ZIP}"
+    $dest = "${DISTDIR}\${ICU_ZIP}"
+    if (-not (test-path $dest)) {
+        write-host "==> Fetch ${ICU_ZIP} to ${dest}"
+        $wc = New-Object System.Net.WebClient
+        $wc.DownloadFile($source, $dest)
+    }
+
+    # unpack the zip
+    $shell = new-object -com shell.application
+    $zip = $shell.NameSpace($dest)
+    foreach($item in $zip.items())
+    {
+        $shell.Namespace($STATICLIBS).copyhere($item)
+    }
+}

http://git-wip-us.apache.org/repos/asf/couchdb-couch-collate/blob/3a8f260a/build_icu.sh
----------------------------------------------------------------------
diff --git a/build_icu.sh b/build_icu.sh
index 04304e6..7c1e6db 100755
--- a/build_icu.sh
+++ b/build_icu.sh
@@ -20,7 +20,7 @@ DISTDIR=$CORE_TOP/.dists
 # icu sources
 ICU_VER=4.4.2
 ICU_DISTNAME=icu4c-4_4_2-src.tgz
-ICU_SITE=http://dl.refuge.io
+ICU_SITE=http://download.icu-project.org/files/icu4c/4.4.2
 ICUDIR=$STATICLIBS/icu
 
 

http://git-wip-us.apache.org/repos/asf/couchdb-couch-collate/blob/3a8f260a/rebar.config.script
----------------------------------------------------------------------
diff --git a/rebar.config.script b/rebar.config.script
index 3a52869..90f079f 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -42,10 +42,15 @@ IsDarwin = case os:type() of
     _ -> false
 end,
 
+IsWindows = case os:type() of
+    {win32, nt} -> true;
+    _ -> false
+end,
+
 UseSystemIcu = IsDarwin andalso os:getenv("USE_STATIC_ICU") /= "1",
 
-PortEnv = case {UseSystemIcu, BuildStatic} of
-    {true, _} ->
+PortEnv = case {UseSystemIcu, BuildStatic, IsWindows} of
+    {true, _, false} ->
         CFLAGS = GetFlag1("ICU_CFLAGS",
                          "-Iplatform/osx/icu -I/usr/include -fPIC"),
         LDFLAGS = GetFlag1("ICU_LDFLAGS",
@@ -55,8 +60,7 @@ PortEnv = case {UseSystemIcu, BuildStatic} of
             {"CFLAGS", "$DRV_CFLAGS " ++ CFLAGS},
             {"LDFLAGS", LDFLAGS}
         ];
-
-    {_, true} ->
+    {_, true, false} ->
         CFLAGS = GetFlag1("ICU_CFLAGS", "-I.libs/icu/include"),
         LDFLAGS = GetFlag1("ICU_LDFLAGS", ".libs/icu/lib/libicui18n.a " ++
                                           ".libs/icu/lib/libicuuc.a " ++
@@ -67,7 +71,9 @@ PortEnv = case {UseSystemIcu, BuildStatic} of
             {"CFLAGS", "$DRV_CFLAGS " ++ CFLAGS},
             {"LDFLAGS", "-lstdc++ -fPIC $DRV_LDFLAGS " ++ LDFLAGS}
         ];
-    {_, false} ->
+    {_, true, true} ->
+        throw("Static builds not supported on Windows.");
+    {_, false, false} ->
         ICUCFLAGS = GetFlag("ICU_CFLAGS", "--cflags"),
         ICUCXXFLAGS = GetFlag("ICU_CXXFLAGS", "--cxxflags"),
         ICULDFLAGS = GetFlag("ICU_LDFLAGS", "--ldflags"),
@@ -77,6 +83,18 @@ PortEnv = case {UseSystemIcu, BuildStatic} of
             {"CFLAGS",  ICUCFLAGS ++  " $CFLAGS " ++ ICUINCPATH},
             {"CXXFLAGS", ICUCXXFLAGS ++ " $CXXFLAGS " ++ ICUINCPATH},
             {"LDFLAGS",  ICULDFLAGS ++ " $LDFLAGS"}
+        ];
+    {_, false, true} ->
+        ICUCFLAGS = "",
+        ICUCXXFLAGS = "",
+        ICUINCPATH = "/I.libs\\icu\\include",
+        ICULDFLAGS = ".libs\\icu\\lib\\icuin.lib " ++
+                ".libs\\icu\\lib\\icuuc.lib " ++
+                ".libs\\icu\\lib\\icudt.lib",
+        [
+            {"CFLAGS",  ICUCFLAGS ++  " $CFLAGS " ++ ICUINCPATH},
+            {"CXXFLAGS", ICUCXXFLAGS ++ " $CXXFLAGS " ++ ICUINCPATH},
+            {"LDFLAGS",  ICULDFLAGS ++ " $LDFLAGS"}
         ]
 end,
 
@@ -84,7 +102,18 @@ PortInfo = [{port_env, PortEnv},
             {port_specs, [
                 {filename:join(["priv", Arch, "couch_collate.so"]),
                     ["c_src/*.c"]}]},
-            {pre_hooks, [{compile, "./build_icu.sh"}]},
-            {post_hooks, [{clean, "./build_icu.sh clean"}]}],
+            {pre_hooks, [
+                {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin)",
+                    compile, "./build_icu.sh"},
+                {"(win32|win64)", compile,
+                    "powershell ./build_icu.ps1"}
+            ]},
+            {post_hooks, [
+                {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin)",
+                    clean, "./build_icu.sh clean"},
+                {"(win32|win64)", clean,
+                    "powershell ./build_icu.ps1 -clean"}
+            ]}
+           ],
 
 lists:keymerge(1,lists:keysort(1, PortInfo), lists:keysort(1, CONFIG)).


Mime
View raw message