configure: support --prefix, --libdir

Support --prefix, --libdir as a conventional way of specifying the default
installation directories. libdir is required to be a subdirectory of prefix
at this time.

Change-Id: If45d9e3129efcde83c05b7766accc9017988e715
This commit is contained in:
John Koleszar 2010-05-26 15:57:42 -04:00
parent c3c870ed74
commit 670af3aa59
3 changed files with 36 additions and 18 deletions

View File

@ -442,7 +442,13 @@ process_common_cmdline() {
disable builtin_libc
alt_libc="${optval}"
;;
--libc)
--prefix=*)
prefix="${optval}"
;;
--libdir=*)
libdir="${optval}"
;;
--libc|--prefix|--libdir)
die "Option ${opt} requires argument"
;;
--help|-h) show_help
@ -463,6 +469,18 @@ process_cmdline() {
done
}
post_process_common_cmdline() {
prefix="${prefix:-/usr/local}"
prefix="${prefix%/}"
libdir="${libdir:-${prefix}/lib}"
libdir="${libdir%/}"
if [ "${libdir#${prefix}}" == "${libdir}" ]; then
die "Libdir ${libdir} must be a subdirectory of ${prefix}"
fi
}
post_process_cmdline() {
true;
}
@ -880,8 +898,8 @@ process_toolchain() {
}
print_config_mk() {
prefix=$1
makefile=$2
local prefix=$1
local makefile=$2
shift 2
for cfg; do
upname="`toupper $cfg`"
@ -892,8 +910,8 @@ print_config_mk() {
}
print_config_h() {
prefix=$1
header=$2
local prefix=$1
local header=$2
shift 2
for cfg; do
upname="`toupper $cfg`"
@ -924,6 +942,7 @@ process() {
else
echo "# ${self} $@" > ${logfile}
fi
post_process_common_cmdline
post_process_cmdline
process_toolchain
process_detect

7
configure vendored
View File

@ -8,7 +8,6 @@
## file in the root of the source tree.
##
#source_path="`dirname \"$0\"`"
source_path=${0%/*}
. "${source_path}/build/make/configure.sh"
@ -369,11 +368,11 @@ process_targets() {
fi
enabled child || cat <<EOF >> config.mk
ifeq (\$(MAKECMDGOALS),dist)
DESTDIR?=${DIST_DIR}
DIST_DIR?=${DIST_DIR}
else
DESTDIR?=/usr/local
DIST_DIR?=\$(DESTDIR)${prefix}
endif
DIST_DIR?=\$(DESTDIR)
LIBSUBDIR=${libdir##${prefix}/}
EOF
enabled child || echo "CONFIGURE_ARGS?=${CONFIGURE_ARGS}" >> config.mk

18
libs.mk
View File

@ -65,11 +65,11 @@ endif
# tree to locations in the source/build trees.
INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx/%
INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx_ports/%
INSTALL_MAPS += lib/% %
INSTALL_MAPS += $(LIBSUBDIR)/% %
INSTALL_MAPS += src/% $(SRC_PATH_BARE)/%
ifeq ($(CONFIG_MSVS),yes)
INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),lib/$(p)/% $(p)/Release/%)
INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),lib/$(p)/% $(p)/Debug/%)
INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Release/%)
INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Debug/%)
endif
# If this is a universal (fat) binary, then all the subarchitectures have
@ -103,14 +103,14 @@ INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder_compat.h
INSTALL-LIBS-$(CONFIG_ENCODERS) += include/vpx/vpx_encoder.h
ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
ifeq ($(CONFIG_MSVS),yes)
INSTALL-LIBS-yes += $(foreach p,$(VS_PLATFORMS),lib/$(p)/$(CODEC_LIB).lib)
INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(foreach p,$(VS_PLATFORMS),lib/$(p)/$(CODEC_LIB)d.lib)
INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),lib/$(p)/vpx.dll)
INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),lib/$(p)/vpx.exp)
INSTALL-LIBS-yes += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB).lib)
INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB)d.lib)
INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.dll)
INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.exp)
endif
else
INSTALL-LIBS-yes += lib/libvpx.a
INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += lib/libvpx_g.a
INSTALL-LIBS-yes += $(LIBSUBDIR)/libvpx.a
INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(LIBSUBDIR)/libvpx_g.a
endif
CODEC_SRCS=$(call enabled,CODEC_SRCS)