Commit 670af3aa authored by John Koleszar's avatar John Koleszar

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
parent c3c870ed
...@@ -442,7 +442,13 @@ process_common_cmdline() { ...@@ -442,7 +442,13 @@ process_common_cmdline() {
disable builtin_libc disable builtin_libc
alt_libc="${optval}" alt_libc="${optval}"
;; ;;
--libc) --prefix=*)
prefix="${optval}"
;;
--libdir=*)
libdir="${optval}"
;;
--libc|--prefix|--libdir)
die "Option ${opt} requires argument" die "Option ${opt} requires argument"
;; ;;
--help|-h) show_help --help|-h) show_help
...@@ -463,6 +469,18 @@ process_cmdline() { ...@@ -463,6 +469,18 @@ process_cmdline() {
done 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() { post_process_cmdline() {
true; true;
} }
...@@ -880,8 +898,8 @@ process_toolchain() { ...@@ -880,8 +898,8 @@ process_toolchain() {
} }
print_config_mk() { print_config_mk() {
prefix=$1 local prefix=$1
makefile=$2 local makefile=$2
shift 2 shift 2
for cfg; do for cfg; do
upname="`toupper $cfg`" upname="`toupper $cfg`"
...@@ -892,8 +910,8 @@ print_config_mk() { ...@@ -892,8 +910,8 @@ print_config_mk() {
} }
print_config_h() { print_config_h() {
prefix=$1 local prefix=$1
header=$2 local header=$2
shift 2 shift 2
for cfg; do for cfg; do
upname="`toupper $cfg`" upname="`toupper $cfg`"
...@@ -924,6 +942,7 @@ process() { ...@@ -924,6 +942,7 @@ process() {
else else
echo "# ${self} $@" > ${logfile} echo "# ${self} $@" > ${logfile}
fi fi
post_process_common_cmdline
post_process_cmdline post_process_cmdline
process_toolchain process_toolchain
process_detect process_detect
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
## file in the root of the source tree. ## file in the root of the source tree.
## ##
#source_path="`dirname \"$0\"`" #source_path="`dirname \"$0\"`"
source_path=${0%/*} source_path=${0%/*}
. "${source_path}/build/make/configure.sh" . "${source_path}/build/make/configure.sh"
...@@ -369,11 +368,11 @@ process_targets() { ...@@ -369,11 +368,11 @@ process_targets() {
fi fi
enabled child || cat <<EOF >> config.mk enabled child || cat <<EOF >> config.mk
ifeq (\$(MAKECMDGOALS),dist) ifeq (\$(MAKECMDGOALS),dist)
DESTDIR?=${DIST_DIR} DIST_DIR?=${DIST_DIR}
else else
DESTDIR?=/usr/local DIST_DIR?=\$(DESTDIR)${prefix}
endif endif
DIST_DIR?=\$(DESTDIR) LIBSUBDIR=${libdir##${prefix}/}
EOF EOF
enabled child || echo "CONFIGURE_ARGS?=${CONFIGURE_ARGS}" >> config.mk enabled child || echo "CONFIGURE_ARGS?=${CONFIGURE_ARGS}" >> config.mk
......
...@@ -65,11 +65,11 @@ endif ...@@ -65,11 +65,11 @@ endif
# tree to locations in the source/build trees. # tree to locations in the source/build trees.
INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx/% INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx/%
INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx_ports/% INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx_ports/%
INSTALL_MAPS += lib/% % INSTALL_MAPS += $(LIBSUBDIR)/% %
INSTALL_MAPS += src/% $(SRC_PATH_BARE)/% INSTALL_MAPS += src/% $(SRC_PATH_BARE)/%
ifeq ($(CONFIG_MSVS),yes) ifeq ($(CONFIG_MSVS),yes)
INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),lib/$(p)/% $(p)/Release/%) INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Release/%)
INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),lib/$(p)/% $(p)/Debug/%) INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Debug/%)
endif endif
# If this is a universal (fat) binary, then all the subarchitectures have # 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 ...@@ -103,14 +103,14 @@ INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder_compat.h
INSTALL-LIBS-$(CONFIG_ENCODERS) += include/vpx/vpx_encoder.h INSTALL-LIBS-$(CONFIG_ENCODERS) += include/vpx/vpx_encoder.h
ifeq ($(CONFIG_EXTERNAL_BUILD),yes) ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
ifeq ($(CONFIG_MSVS),yes) ifeq ($(CONFIG_MSVS),yes)
INSTALL-LIBS-yes += $(foreach p,$(VS_PLATFORMS),lib/$(p)/$(CODEC_LIB).lib) INSTALL-LIBS-yes += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB).lib)
INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(foreach p,$(VS_PLATFORMS),lib/$(p)/$(CODEC_LIB)d.lib) INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(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),$(LIBSUBDIR)/$(p)/vpx.dll)
INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),lib/$(p)/vpx.exp) INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.exp)
endif endif
else else
INSTALL-LIBS-yes += lib/libvpx.a INSTALL-LIBS-yes += $(LIBSUBDIR)/libvpx.a
INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += lib/libvpx_g.a INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(LIBSUBDIR)/libvpx_g.a
endif endif
CODEC_SRCS=$(call enabled,CODEC_SRCS) CODEC_SRCS=$(call enabled,CODEC_SRCS)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment