You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2014/07/31 23:09:59 UTC

git commit: refs/heads/master - Add setup_env.sh for projects depending on Lucy

Repository: lucy
Updated Branches:
  refs/heads/master 2e5f018c1 -> 7c12c6dc2


Add setup_env.sh for projects depending on Lucy


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/7c12c6dc
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/7c12c6dc
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/7c12c6dc

Branch: refs/heads/master
Commit: 7c12c6dc210c0c962e9d27587c1f34ce40a81d09
Parents: 2e5f018
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Thu Jul 31 22:59:45 2014 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Thu Jul 31 22:59:45 2014 +0200

----------------------------------------------------------------------
 devel/bin/setup_env.sh | 77 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/7c12c6dc/devel/bin/setup_env.sh
----------------------------------------------------------------------
diff --git a/devel/bin/setup_env.sh b/devel/bin/setup_env.sh
new file mode 100644
index 0000000..eb389bb
--- /dev/null
+++ b/devel/bin/setup_env.sh
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Set up the following environment variables to build a Lucy project with
+# an uninstalled Lucy source tree. Useful for development.
+#
+# - LIBRARY_PATH
+# - LD_LIBRARY_PATH
+# - CLOWNFISH_INCLUDE
+# - PERL5LIB
+#
+# Usage: source setup_env.sh [path to lucy]
+
+contains() {
+    string="$1"
+    substring="$2"
+    test "${string#*$substring}" != "$string"
+}
+
+add_to_path() {
+    path="$1"
+    dir="$2"
+    if [ -z "$path" ]; then
+        echo "$dir"
+    elif ! contains ":$path:" ":$dir:"; then
+        echo "$dir:$path"
+    else
+        echo "$path"
+    fi
+}
+
+if [ -n "$1" ]; then
+    base_dir="$1"
+elif [ -n "$BASH_SOURCE" ]; then
+    # Only works with bash.
+    script_dir=`dirname "$BASH_SOURCE"`
+    base_dir=`cd "$script_dir/../.." && pwd`
+else
+    echo "Usage: source setup_env.sh path_to_lucy_source"
+    return 1 2>/dev/null || exit 1
+fi
+
+if [ ! -d "$base_dir/c" ] || [ ! -d "$base_dir/perl" ]
+then
+    echo "Doesn't look like a Lucy source directory: $base_dir"
+    return 1 2>/dev/null || exit 1
+fi
+
+export LIBRARY_PATH=`add_to_path "$LIBRARY_PATH" "$base_dir/c"`
+export CLOWNFISH_INCLUDE=`add_to_path "$CLOWNFISH_INCLUDE" "$base_dir/core"`
+export PERL5LIB=`add_to_path "$PERL5LIB" "$base_dir/perl/blib/arch"`
+export PERL5LIB=`add_to_path "$PERL5LIB" "$base_dir/perl/blib/lib"`
+
+case `uname` in
+    MINGW*|CYGWIN*)
+        export PATH=`add_to_path "$PATH" "$base_dir/c"`
+	;;
+    Darwin*)
+        ;;
+    *)
+        export LD_LIBRARY_PATH=`add_to_path "$LD_LIBRARY_PATH" "$base_dir/c"`
+esac
+