aerospike / aerospike-client-c

Aerospike C Client
Other
98 stars 103 forks source link

ability to set an install dir: #82

Closed sandym closed 6 years ago

sandym commented 6 years ago

make install INSTALL_PREFIX=/myproject/dependencies

If not set, it will install at the hardcoded path. But this make it easier to manage project dependencies.

BrianNichols commented 6 years ago

That script references platform variable before it's set. The following corrected script will be included in the next C client release.

#!/bin/bash
# Install libraries and header files.
set -e

if [ $# -ne 1 ]
then
  echo "Usage: install <target dir>"
  exit 1
fi

targetDir=$1
cd `dirname $0`/..

platform=`./pkg/platform`

if [ $? -ne 0 ]
then
  echo "Invalid platform."
  exit 1
fi

if [ "$platform" = "mac" ]
then
  # Mac OS X does not have /usr or /opt, so use /usr/local instead.
  installDir=/usr/local
  luaDir=/usr/local
else
  installDir=/usr
  luaDir=/opt
fi

if [ -n "$INSTALL_PREFIX" ]
then
  # Install dir might not require sudo, so do not enforce that requirement.
  installDir=$INSTALL_PREFIX
  luaDir=$INSTALL_PREFIX
else
  if [ $EUID -ne 0 ]
  then
    echo "This script requires root or sudo privileges."
    exit 1
  fi
fi

# Install header files.
rm -rf $installDir/include/{aerospike,citrusleaf}
mkdir -p $installDir/include
mkdir -p $installDir/lib

echo cp -r $targetDir/include/{aerospike,citrusleaf} $installDir/include
cp -r $targetDir/include/{aerospike,citrusleaf} $installDir/include
chmod -R g-w,o-w $installDir/include/{aerospike,citrusleaf}

# Install libraries.
echo cp $targetDir/lib/libaerospike.* $installDir/lib
cp $targetDir/lib/libaerospike.* $installDir/lib
chmod g-w,o-w $installDir/lib/libaerospike.*

# Install Lua files.
mkdir -p $luaDir/aerospike/client/sys/udf/lua
mkdir -p $luaDir/aerospike/client/usr/udf/lua

echo cp modules/lua-core/src/{aerospike.lua,as.lua,stream_ops.lua} $luaDir/aerospike/client/sys/udf/lua
cp modules/lua-core/src/{aerospike.lua,as.lua,stream_ops.lua} $luaDir/aerospike/client/sys/udf/lua
chmod g-w,o-w $luaDir/aerospike/client/sys/udf/lua/* $luaDir/aerospike/client/sys/udf/lua/*
sandym commented 6 years ago

Thanks, will greatly help with automated builds

BrianNichols commented 6 years ago

C client 4.3.14 released today.

https://www.aerospike.com/download/client/c/4.3.14/