Rework installation script of C library * Install Clownfish headers. * Don't install C headers. They can be generated with cfc from the Clownfish headers. * Absolutify prefix. * Add quotes in case prefix contains spaces. * Rework pkg-config file.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/25d26dcb Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/25d26dcb Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/25d26dcb Branch: refs/heads/master Commit: 25d26dcb6c0a63c15f2b6b753f32c496aa12cc0c Parents: e6d3b01 Author: Nick Wellnhofer <[email protected]> Authored: Wed Jan 22 23:41:46 2014 +0100 Committer: Nick Wellnhofer <[email protected]> Committed: Wed Jan 22 23:50:05 2014 +0100 ---------------------------------------------------------------------- c/install.sh | 65 +++++++++++++++++++++++++++++++++---------------------- c/lucy.pc.in | 27 ----------------------- 2 files changed, 39 insertions(+), 53 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/25d26dcb/c/install.sh ---------------------------------------------------------------------- diff --git a/c/install.sh b/c/install.sh index 106c84d..673f8da 100755 --- a/c/install.sh +++ b/c/install.sh @@ -53,19 +53,27 @@ if [ -z "$prefix" ]; then exit 1 fi -case $(uname) in +if ! mkdir -p "$prefix"; then + echo "Can't create directory: $prefix" + exit 1 +fi + +prefix=`cd "$prefix" && pwd` + +# Install libraries. +case `uname` in Darwin*) lib_file=liblucy.$version.dylib if [ ! -f $lib_file ]; then echo "$lib_file not found. Did you run make?" exit 1 fi - mkdir -p $prefix/lib - cp $lib_file $prefix/lib + mkdir -p "$prefix/lib" + cp $lib_file "$prefix/lib" install_name=$prefix/lib/liblucy.$major_version.dylib - ln -sf $lib_file $install_name - ln -sf $lib_file $prefix/lib/liblucy.dylib - install_name_tool -id $install_name $prefix/lib/$lib_file + ln -sf $lib_file "$install_name" + ln -sf $lib_file "$prefix/lib/liblucy.dylib" + install_name_tool -id "$install_name" "$prefix/lib/$lib_file" ;; *) lib_file=liblucy.so.$version @@ -73,29 +81,34 @@ case $(uname) in echo "$lib_file not found. Did you run make?" exit 1 fi - mkdir -p $prefix/lib - cp $lib_file $prefix/lib + mkdir -p "$prefix/lib" + cp $lib_file "$prefix/lib" soname=liblucy.so.$major_version - ln -sf $lib_file $prefix/lib/$soname - ln -sf $soname $prefix/lib/liblucy.so + ln -sf $lib_file "$prefix/lib/$soname" + ln -sf $soname "$prefix/lib/liblucy.so" ;; esac -mkdir -p $prefix/include -cp autogen/include/cfish_hostdefs.h $prefix/include -cp autogen/include/cfish_parcel.h $prefix/include -cp autogen/include/lucy_parcel.h $prefix/include -cp -R autogen/include/Clownfish $prefix/include -cp -R autogen/include/Lucy $prefix/include -cp -R autogen/include/LucyX $prefix/include +# Install Clownfish header files. +for src in `find ../core -name '*.cf[hp]'`; do + file=${src#../core/} + dest=$prefix/share/clownfish/include/$file + dir=`dirname "$dest"` + mkdir -p "$dir" + cp $src "$dest" +done + +# Install man pages. +cp -R autogen/man "$prefix" -cp -R autogen/man $prefix +# Create pkg-config file. +mkdir -p "$prefix/lib/pkgconfig" +cat <<EOF >"$prefix/lib/pkgconfig/lucy.pc" +Name: Apache Lucy +Description: Full-text search for dynamic languages +Version: $version +URL: http://lucy.apache.org/ +Requires: clownfish +Libs: -L$prefix/lib -llucy -lcfish +EOF -# create pkg-config file -# some platforms require .bak extension for temp file -cp lucy.pc.in lucy.pc -sed -i.bak "s,@version@,$version,g" lucy.pc -sed -i.bak "s,@prefix@,$prefix,g" lucy.pc -rm lucy.pc.bak -mkdir -p $prefix/lib/pkgconfig -cp lucy.pc $prefix/lib/pkgconfig http://git-wip-us.apache.org/repos/asf/lucy/blob/25d26dcb/c/lucy.pc.in ---------------------------------------------------------------------- diff --git a/c/lucy.pc.in b/c/lucy.pc.in deleted file mode 100644 index e4a81fd..0000000 --- a/c/lucy.pc.in +++ /dev/null @@ -1,27 +0,0 @@ -# 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. - -prefix=@prefix@ -libdir=${prefix}/lib -includedir=${prefix}/include - - -Name: lucy -Version: @version@ -URL: http://lucy.apache.org/ -Description: lucy - Apache Lucy C library -Requires: -Libs: -L${libdir} -llucy -Cflags: -I${includedir}
