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/20 17:57:06 UTC

git commit: Script to set up dev environment on UNIX

Repository: lucy-clownfish
Updated Branches:
  refs/heads/master 5e3a4105c -> aeabd17af


Script to set up dev environment on UNIX

Move the script to set up the development environment form Lucy to
Clownfish. Now it can be used by other projects and it can figure out
the Clownfish directory automatically (at least with bash).


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

Branch: refs/heads/master
Commit: aeabd17af3d1b899de79f2808b175fe99d4ca8fc
Parents: 5e3a410
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sun Jul 20 17:53:39 2014 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sun Jul 20 17:53:39 2014 +0200

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


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/aeabd17a/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..8d23c3c
--- /dev/null
+++ b/devel/bin/setup_env.sh
@@ -0,0 +1,80 @@
+#!/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 Clownfish project with
+# an uninstalled Clownfish source tree. Useful for development.
+#
+# - PATH
+# - C_INCLUDE_PATH
+# - LIBRARY_PATH
+# - LD_LIBRARY_PATH
+# - CLOWNFISH_INCLUDE
+# - PERL5LIB
+#
+# Usage: source setup_env.sh [path to clownfish]
+
+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_clownfish_source"
+    return 1 2>/dev/null || exit 1
+fi
+
+if [ ! -d "$base_dir/compiler" ] || [ ! -d "$base_dir/runtime" ]
+then
+    echo "Doesn't look like a Clownfish source directory: $base_dir"
+    return 1 2>/dev/null || exit 1
+fi
+
+compiler_dir=$base_dir/compiler
+runtime_dir=$base_dir/runtime
+
+export PATH=`add_to_path "$PATH" "$compiler_dir/c"`
+export C_INCLUDE_PATH=`add_to_path "$C_INCLUDE_PATH" "$runtime_dir/perl/xs"`
+export LIBRARY_PATH=`add_to_path "$LIBRARY_PATH" "$runtime_dir/c"`
+export CLOWNFISH_INCLUDE=`add_to_path "$CLOWNFISH_INCLUDE" "$runtime_dir/core"`
+export PERL5LIB=`add_to_path "$PERL5LIB" "$compiler_dir/perl/blib/arch"`
+export PERL5LIB=`add_to_path "$PERL5LIB" "$compiler_dir/perl/blib/lib"`
+export PERL5LIB=`add_to_path "$PERL5LIB" "$runtime_dir/perl/blib/arch"`
+export PERL5LIB=`add_to_path "$PERL5LIB" "$runtime_dir/perl/blib/lib"`
+
+if [ `uname` != Darwin ]; then
+    export LD_LIBRARY_PATH=`add_to_path "$LD_LIBRARY_PATH" "$runtime_dir/c"`
+fi
+