summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKees Cook <kees@debian.org>2012-06-06 10:37:50 -0400
committerPaul Moore <pmoore@redhat.com>2012-06-06 10:37:50 -0400
commit5f2ce3772b366ee24dcfb301da510f5e662df0f2 (patch)
tree5437739634f77ed43a53bf17ba3d790b8ced9803
parente67459dff15011590d7a60b1c567e08e78979ad1 (diff)
downloadlibseccomp-5f2ce3772b366ee24dcfb301da510f5e662df0f2.tar.gz
build: provide a build-time mechanism to update library install path
Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Paul Moore <pmoore@redhat.com>
-rwxr-xr-xconfigure22
-rw-r--r--install.mk2
-rw-r--r--libseccomp.pc.in2
3 files changed, 22 insertions, 4 deletions
diff --git a/configure b/configure
index 9753559..6b226a1 100755
--- a/configure
+++ b/configure
@@ -23,6 +23,7 @@
# configuration defaults
opt_prefix="/usr/local"
+opt_libexecdir=""
opt_sysinc_seccomp="yes"
# output files
@@ -52,6 +53,7 @@ Options:
-h, --help display this help and exit
* installation configuration
--prefix=PREFIX installation base [/usr/local]
+ --libexecdir=DIR library directory [/usr/local/lib]
EOF
}
@@ -60,6 +62,7 @@ function msg_summary() {
CONFIGURATION SUMMARY
libseccomp version: ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_MICRO}
installation base: $opt_prefix
+ library directory: $opt_libexecdir
use system includes: $opt_sysinc_seccomp
EOF
}
@@ -159,7 +162,7 @@ verify_deps getopt
# parse the command line options
opt_str="$@"
-opt=$(getopt -n "$0" --options "h" --longoptions "help,prefix:" -- "$@")
+opt=$(getopt -n "$0" --options "h" --longoptions "help,prefix:,libexecdir:" -- "$@")
eval set -- "$opt"
while [[ $# -gt 0 ]]; do
case "$1" in
@@ -167,6 +170,10 @@ while [[ $# -gt 0 ]]; do
opt_prefix="$2"
shift 2
;;
+ --libexecdir)
+ opt_libexecdir="$2"
+ shift 2
+ ;;
-h|--help)
msg_usage
exit 0
@@ -185,6 +192,13 @@ if [[ ! -d $opt_prefix ]]; then
msg_error "install prefix ($opt_prefix) is not a directory"
exit 1
fi
+if [[ -z $opt_libexecdir ]]; then
+ opt_libexecdir="$opt_prefix/lib"
+fi
+if [[ ! -d $opt_libexecdir ]]; then
+ msg_error "libexecdir ($opt_libexecdir) is not a directory"
+ exit 1
+fi
#
# automatic configuration
@@ -209,9 +223,12 @@ echo "VERSION_RELEASE=$VERSION_RELEASE" >> ./version_info.mk
# generate the pkg-config metadata
INSTALL_PREFIX="$opt_prefix"
+INSTALL_LIBDIR="$opt_libexecdir"
rm -f ./libseccomp.pc
cat ./libseccomp.pc.in | \
- tmpl_filter INSTALL_PREFIX | tmpl_filter VERSION_RELEASE \
+ tmpl_filter INSTALL_PREFIX | \
+ tmpl_filter INSTALL_LIBDIR | \
+ tmpl_filter VERSION_RELEASE \
>> ./libseccomp.pc
#
@@ -224,6 +241,7 @@ cnf_header
# output the configuration files
cnf_mk_entry "CONF_INSTALL_PREFIX" "$opt_prefix"
+cnf_mk_entry "CONF_INSTALL_LIBDIR" "$opt_libexecdir"
cnf_entry "CONF_SYSINC_SECCOMP" "$opt_sysinc_seccomp"
# configuration footer
diff --git a/install.mk b/install.mk
index 74e4b8a..e202ea3 100644
--- a/install.mk
+++ b/install.mk
@@ -20,10 +20,10 @@
#
INSTALL_PREFIX ?= $(CONF_INSTALL_PREFIX)
+INSTALL_LIB_DIR ?= $(CONF_INSTALL_LIBDIR)
INSTALL_SBIN_DIR ?= $(INSTALL_PREFIX)/sbin
INSTALL_BIN_DIR ?= $(INSTALL_PREFIX)/bin
-INSTALL_LIB_DIR ?= $(INSTALL_PREFIX)/lib
INSTALL_INC_DIR ?= $(INSTALL_PREFIX)/include
INSTALL_MAN_DIR ?= $(INSTALL_PREFIX)/share/man
diff --git a/libseccomp.pc.in b/libseccomp.pc.in
index dc7390a..c195831 100644
--- a/libseccomp.pc.in
+++ b/libseccomp.pc.in
@@ -20,8 +20,8 @@
#
prefix=%%INSTALL_PREFIX%%
+libdir=%%INSTALL_LIBDIR%%
includedir=${prefix}/include
-libdir=${prefix}/lib
Name: libseccomp
Description: The enhanced seccomp library