aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--helpers/cpt-configure22
-rw-r--r--lib.rc2
-rw-r--r--src/cpt-lib.in15
3 files changed, 37 insertions, 2 deletions
diff --git a/helpers/cpt-configure b/helpers/cpt-configure
new file mode 100644
index 0000000..6978924
--- /dev/null
+++ b/helpers/cpt-configure
@@ -0,0 +1,22 @@
+#!/bin/sh -e
+# Wrapper for calling autoconf-generated ./configure scripts
+. cpt-lib
+
+set -- \
+ "--prefix=$CPT_PKG_PREFIX" \
+ "--libdir=$CPT_PKG_LIBDIR" \
+ "--sysconfdir=$CPT_PKG_ETCDIR" \
+ "--bindir=$CPT_PKG_BINDIR" \
+ "--sbindir=$CPT_PKG_SBINDIR" \
+ "--mandir=$CPT_PKG_MANDIR" \
+ "--infodir=$CPT_PKG_INFODIR" \
+ "--localstatedir=$CPT_PKG_LOCALSTATEDIR" \
+ "$@"
+
+
+[ "$CPT_CROSS_TRIPLET" ] &&
+ set -- "$@" \
+ "--host=$CPT_CROSS_TRIPLET" \
+ "--with-sysroot=$CPT_ROOT$CPT_PKG_PREFIX"
+
+"${configure_file:-./configure}" "$@"
diff --git a/lib.rc b/lib.rc
index 1be638a..e4cb856 100644
--- a/lib.rc
+++ b/lib.rc
@@ -53,7 +53,7 @@ PHONY() {
getbin() {
# Function to get all executables
- find src contrib \( -name cpt -o -name 'cpt-*' \) ! -name '*.in' ! -name '*.did'
+ find src contrib helpers \( -name cpt -o -name 'cpt-*' \) ! -name '*.in' ! -name '*.did'
}
# Phony targets
diff --git a/src/cpt-lib.in b/src/cpt-lib.in
index 2af31fb..1f9ca83 100644
--- a/src/cpt-lib.in
+++ b/src/cpt-lib.in
@@ -385,6 +385,7 @@ as_root() {
CPT_PID="$CPT_PID" \
CPT_PROMPT="$CPT_PROMPT" \
CPT_ROOT="$CPT_ROOT" \
+ CPT_CROSS_TRIPLET="$CPT_CROSS_TRIPLET" \
CPT_TMPDIR="$CPT_TMPDIR" \
"$@"
@@ -1835,7 +1836,7 @@ create_cache() {
mkdir -p "${cac_dir:=${CPT_CACHE:=${XDG_CACHE_HOME:-$HOME/.cache}/cpt}}" \
"${src_dir:=$cac_dir/sources}" \
"${log_dir:=$cac_dir/logs}" \
- "${bin_dir:=$cac_dir/bin}"
+ "${bin_dir:=$cac_dir/$CPT_CROSS_TRIPLET${CPT_CROSS_TRIPLET:+-}bin}"
# Set the location to the repository and package database.
pkg_db=var/db/cpt/installed
@@ -1917,6 +1918,18 @@ create_cache() {
colory="\033[1;33m" colorb="\033[1;36m" colre="\033[m"
fi
+ # Set default package directories so that they can be parsed from package
+ # helpers
+ # TODO Document
+ : "${CPT_PKG_PREFIX:=/usr}" \
+ "${CPT_PKG_ETCDIR:=/etc}" \
+ "${CPT_PKG_LIBDIR:=$CPT_PKG_PREFIX/lib}" \
+ "${CPT_PKG_BINDIR:=$CPT_PKG_PREFIX/bin}" \
+ "${CPT_PKG_SBINDIR:=$CPT_PKG_PREFIX/bin}" \
+ "${CPT_PKG_MANDIR:=/usr/share/man}" \
+ "${CPT_PKG_INFODIR:=/usr/share/info}" \
+ "${CPT_PKG_LOCALSTATEDIR:=/var}"
+
}
# If the library is being called with its own name, run arguments.