aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-08-11 12:19:54 +0000
committermerakor <cem@ckyln.com>2020-08-11 12:19:54 +0000
commit945f667f619272ce50ab7cb3676874587eeb870c (patch)
treecbfb9d8ea3670b5c66c446baf653436969176c82
parent64895a191efc05047831b9c71306561e62d30510 (diff)
downloadcpt-945f667f619272ce50ab7cb3676874587eeb870c.tar.gz
pkg_build(): use .build.cpt so that the build files can be modified
Change originally on `kiss` by Dylan Araps FossilOrigin-Name: 36b6acd745cc6d542c7e4e70e7fe19b421541ac8392ac9baa7db0c2be3ff6ad4
-rw-r--r--src/cpt-lib6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cpt-lib b/src/cpt-lib
index de17cc4..092a515 100644
--- a/src/cpt-lib
+++ b/src/cpt-lib
@@ -717,6 +717,10 @@ pkg_build() {
read -r build_version _ < "$repo_dir/version"
+ # Copy the build file to the build directory to users to modify it
+ # temporarily at runtime.
+ cp -f "$repo_dir/build" "$mak_dir/$pkg/.build.cpt"
+
# Install built packages to a directory under the package name
# to avoid collisions with other packages.
mkdir -p "$pkg_dir/$pkg/$pkg_db"
@@ -731,7 +735,7 @@ pkg_build() {
# Call the build script, log the output to the terminal
# and to a file. There's no PIPEFAIL in POSIX shelll so
# we must resort to tricks like killing the script ourselves.
- { "$repo_dir/build" "$pkg_dir/$pkg" "$build_version" "$sys_arch" 2>&1 || {
+ { ./.build.cpt "$pkg_dir/$pkg" "$build_version" "$sys_arch" 2>&1 || {
log "$pkg" "Build failed"
log "$pkg" "Log stored to $log_dir/$pkg-$time-$pid"
run_hook build-fail "$pkg" "$pkg_dir/$pkg"