From f3030244f64699021ec0d9cd9e4b4d67244d9df1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 25 Aug 2013 14:18:14 -0400 Subject: Make common-devtools.mk unnecessary. Move devtools chroot stuff into chroot-tools --- src/Makefile | 3 +- src/abslibre-tools/Makefile | 2 - src/chroot-tools/.gitignore | 3 + src/chroot-tools/Makefile | 34 +++- src/chroot-tools/makechrootpkg.sh.patch | 275 ++++++++++++++++++++++++++++++++ src/devtools/.gitignore | 1 - src/devtools/Makefile | 76 +-------- src/devtools/lib/.gitignore | 2 - src/devtools/lib/makechrootpkg.sh.patch | 275 -------------------------------- src/fullpkg/Makefile | 2 - src/lib/Makefile | 42 +---- src/librefetch/Makefile | 2 - src/mips64el-tools/Makefile | 2 - src/toru/Makefile | 2 - 14 files changed, 325 insertions(+), 396 deletions(-) create mode 100644 src/chroot-tools/.gitignore create mode 100644 src/chroot-tools/makechrootpkg.sh.patch delete mode 100644 src/devtools/lib/.gitignore delete mode 100644 src/devtools/lib/makechrootpkg.sh.patch (limited to 'src') diff --git a/src/Makefile b/src/Makefile index 35a92a0..63f7782 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,3 +1,2 @@ -libre_execdir=$(bindir) -libre_confdir=$(sysconfdir) +pkgconfdir=$(sysconfdir) include ../common.mk diff --git a/src/abslibre-tools/Makefile b/src/abslibre-tools/Makefile index 271cc5e..2c76089 100644 --- a/src/abslibre-tools/Makefile +++ b/src/abslibre-tools/Makefile @@ -1,3 +1 @@ -libre_execdir=$(bindir) -libre_confdir=$(sysconfdir)/libretools.d include ../../common.mk diff --git a/src/chroot-tools/.gitignore b/src/chroot-tools/.gitignore new file mode 100644 index 0000000..fbb07f7 --- /dev/null +++ b/src/chroot-tools/.gitignore @@ -0,0 +1,3 @@ +makechrootpkg.sh* +!makechrootpkg.sh.patch +archroot* \ No newline at end of file diff --git a/src/chroot-tools/Makefile b/src/chroot-tools/Makefile index 27030e3..7f6a7ea 100644 --- a/src/chroot-tools/Makefile +++ b/src/chroot-tools/Makefile @@ -1,3 +1,33 @@ -libre_execdir=$(sbindir) -libre_confdir=$(sysconfdir)/libretools.d +# The makechrootpkg flow is: +# $(devtoolsdir)/*.in -> *.sh.in + *.sh.patch -> *.sh.ugly -> *.sh + +copy_files = makechrootpkg.sh.in archroot.in +libs = makechrootpkg.sh +progs = archroot +clean_files = makechrootpkg.sh.ugly* *~ include ../../common.mk + +# Copy ############################################################### + +makechrootpkg.sh.in: %.sh.in: $(devtoolsdir)/%.in + cp $< $@ + +archroot.in: $(devtoolsdir)/mkarchroot.in + cp $< $@ + +# Build ############################################################## + +makechrootpkg.sh.ugly: %.ugly: %.in %.patch Makefile + @echo "GEN $@" + @cp $*.in $@ + @patch $@ $*.patch || { rm -f -- '$@'; false; } + +makechrootpkg.sh: %: %.ugly Makefile + @echo "GEN $@" + @$(edit) <"$<" >"$@" || { rm -f -- '$@'; false; } + $(call indent,$@) || { rm -f -- '$@'; false; } + +archroot: %: %.in Makefile + @echo "GEN $@" + @$(edit) <"$<" >"$@" || { rm -f -- '$@'; false; } + @chmod 755 "$@" || { rm -f -- '$@'; false; } diff --git a/src/chroot-tools/makechrootpkg.sh.patch b/src/chroot-tools/makechrootpkg.sh.patch new file mode 100644 index 0000000..505b96a --- /dev/null +++ b/src/chroot-tools/makechrootpkg.sh.patch @@ -0,0 +1,275 @@ +--- makechrootpkg.sh.in ++++ makechrootpkg.sh.ugly +@@ -12,12 +12,7 @@ + + shopt -s nullglob + +-# So that usage conflicts between upstream and -par mkarchroot don't get hidden +-# silently in a merge. +-archroot() { +- mkarchroot "$@" +-} +- ++init_variables() { + makepkg_args='-s --noconfirm -L' + repack=false + update_first=false +@@ -28,13 +23,14 @@ + temp_chroot=false + chrootdir= + passeddir= +-declare -a install_pkgs +-declare -i ret=0 ++declare -ag install_pkgs ++declare -ig ret=0 + + copy=$USER + [[ -n $SUDO_USER ]] && copy=$SUDO_USER + [[ -z "$copy" || $copy = root ]] && copy=copy + src_owner=${SUDO_USER:-$USER} ++} + + usage() { + echo "Usage: ${0##*/} [options] -r [--] [makepkg args]" +@@ -69,6 +65,7 @@ + exit 1 + } + ++parse_options_init() { + while getopts 'hcudr:I:l:nT' arg; do + case "$arg" in + h) usage ;; +@@ -129,8 +126,20 @@ + # Note this is the same FD number as in mkarchroot + lock_open_write 9 "$copydir" \ + "Waiting for existing lock on chroot copy to be released: [$copy]" ++} ++ ++# Usage: chroot_sync $CHROOTDIR/$CHROOT [$CHROOTCOPY|$copydir] ++chroot_sync() { ++ local chrootdir=$1 ++ local copy=$2 ++ local copydir='' ++ if [[ ${copy:0:1} = / ]]; then ++ copydir=$copy ++ else ++ copydir="$chrootdir/$copy" ++ fi ++ local chroottype=$(stat -f -c %T "$chrootdir") + +-if [[ ! -d $copydir ]] || $clean_first; then + # Get a read lock on the root chroot to make + # sure we don't clone a half-updated chroot + lock_open_read 8 "$chrootdir/root" \ +@@ -152,9 +161,16 @@ + + # Drop the read lock again + lock_close 8 +-fi ++} ++ ++# Usage: chroot_install_pkgs $copydir $pkgs... ++chroot_install_pkgs() { ++ local copydir=$1 ++ shift ++ declare -i ret=0 ++ declare -a install_pkgs=("$@") ++ local pkgname + +-if [[ -n "${install_pkgs[*]}" ]]; then + for install_pkg in "${install_pkgs[@]}"; do + pkgname="${install_pkg##*/}" + cp "$install_pkg" "$copydir/$pkgname" +@@ -165,10 +181,10 @@ + rm "$copydir/$pkgname" + done + +- # If there is no PKGBUILD we have done +- [[ -f PKGBUILD ]] || exit $ret +-fi ++ return $ret ++} + ++func1() { + $update_first && archroot -u "$copydir" + + mkdir -p "$copydir/build" +@@ -230,14 +246,24 @@ + # Set target CARCH as it might be used within the PKGBUILD to select correct sources + eval $(grep '^CARCH=' "$copydir/etc/makepkg.conf") + export CARCH ++} + ++# Usage: chroot_copy_in $copydir ++# Environment: ++# - In the dirctory of a PKGBUILD ++# - $SRCDEST is set ++chroot_copy_in() { ++local copydir=$1 + # Copy PKGBUILD and sources +-cp PKGBUILD "$copydir/build/" ++for recipe in PKGBUILD SRCBUILD; do ++if [[ -f $recipe ]]; then ++cp $recipe "$copydir/build/" + ( +- source PKGBUILD +- for file in "${source[@]}"; do ++ source $recipe ++ for file in "${source[@]}" "${mksource[@]}"; do + file="${file%%::*}" + file="${file##*://*/}" ++ file="${file##*://}" + if [[ -f $file ]]; then + cp "$file" "$copydir/srcdest/" + elif [[ -f $SRCDEST/$file ]]; then +@@ -251,18 +277,30 @@ + # evaluate any bash variables used + eval file=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$file")\" + [[ -f $file ]] && cp "$file" "$copydir/build/" +- done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) ++ done < <(sed -n "s/^[[:space:]]*$i=//p" $recipe) + done + ) ++fi ++done + + chown -R nobody "$copydir"/{build,pkgdest,srcdest} ++} + ++# Usage: chroot_let_nobody_use_pacman $copydir ++chroot_let_nobody_use_pacman() { ++local copydir=$1 + cat > "$copydir/etc/sudoers.d/nobody-pacman" <"$copydir/chrootbuild" </dev/null + repo-add repo.db.tar.gz "${pkgfile##*/}" + popd >/dev/null +- fi ++ done ++} + ++# Usage: chroot_copy_out_pkgs $copydir $user ++# Environment: ++# - $PKGDEST is set ++chroot_copy_out_pkgs() { ++ local copydir=$1 ++ local src_owner=$2 ++ for pkgfile in "$copydir"/pkgdest/*.pkg.tar*; do + chown "$src_owner" "$pkgfile" + mv "$pkgfile" "$PKGDEST" ++ if [[ $PKGDEST != . ]]; then ++ ln -sf "$PKGDEST/${pkgfile##*/}" . ++ fi + done ++} + +- for l in "$copydir"/build/*-{build,check,namcap,package,package_*}.log; do ++# Usage: chroot_copy_out_pkgs $copydir $user ++chroot_copy_out_logs() { ++ local copydir=$1 ++ local src_owner=$2 ++ for l in "$copydir"/build/*.log; do + chown "$src_owner" "$l" + [[ -f $l ]] && mv "$l" . + done +-else +- # Just in case. We returned 1, make sure we fail +- ret=1 +-fi ++} + ++# Usage: chroot_copy_out_srcs $copydir $user ++# Environment: ++# - $SRCDEST is set ++chroot_copy_out_srcs() { ++local copydir=$1 ++local src_owner=$2 + for f in "$copydir"/srcdest/*; do + chown "$src_owner" "$f" + mv "$f" "$SRCDEST" + done ++} + +-if $temp_chroot; then +- stat_busy "Removing temporary directoy [$copy]" ++# Usage: chroot_delete $copydir ++chroot_delete() { ++ local chroottype=$(stat -f -c %T "$copydir") ++ stat_busy "Removing chroot copy [$copydir]" + if [[ "$chroottype" == btrfs ]]; then + btrfs subvolume delete "$copydir" >/dev/null || + die "Unable to delete subvolume $copydir" +@@ -326,8 +389,39 @@ + # remove lock file + rm --force "$copydir.lock" + stat_done +-elif (( ret != 0 )); then +- die "Build failed, check $copydir/build" +-else +- true +-fi ++} ++ ++main() { ++ init_variables ++ parse_options_init "$@" ++ if [[ ! -d $copydir ]] || $clean_first; then ++ chroot_sync "$chrootdir" "$copy" ++ fi ++ if [[ -n "${install_pkgs[*]}" ]]; then ++ chroot_install_pkgs "$copydir" "${install_pkgs[@]}" ++ ret=$? ++ # If there is no PKGBUILD we have done ++ [[ -f PKGBUILD ]] || exit $ret ++ fi ++ func1 ++ chroot_copy_in "$copydir" ++ chroot_let_nobody_use_pacman "$copydir" ++ chroot_build "$copydir" "$makepkg_args" "$run_namcap" ++ func2 ++ if chroot_build; then ++ chroot_add_to_local_repo "$copydir" "$copydir"/pkgdest/*.pkg.tar* ++ chroot_copy_out_pkgs "$copydir" "$src_owner" ++ chroot_copy_out_logs "$copydir" "$src_owner" ++ else ++ # Just in case. We returned 1, make sure we fail ++ ret=1 ++ fi ++ chroot_copy_out_srcs "$copydir" "$src_owner" ++ if $temp_chroot; then ++ chroot_delete "$copydir" ++ elif (( ret != 0 )); then ++ die "Build failed, check $copydir/build" ++ else ++ true ++ fi ++} diff --git a/src/devtools/.gitignore b/src/devtools/.gitignore index cce9a4c..097fcde 100644 --- a/src/devtools/.gitignore +++ b/src/devtools/.gitignore @@ -1,4 +1,3 @@ * -!*/ !Makefile !.gitignore diff --git a/src/devtools/Makefile b/src/devtools/Makefile index bca9780..6cae230 100644 --- a/src/devtools/Makefile +++ b/src/devtools/Makefile @@ -1,76 +1,16 @@ -topdir = ../.. -include ../../common-devtools.mk +progs = checkpkg find-libdeps finddeps lddd +copy_files = $(addsuffix .in,$(progs)) +install_files = $(DESTDIR)$(bindir)/find-libprovides +include ../../common.mk -###################################################################### - -pkglibexecdir=$(libexecdir)/libretools - -###################################################################### - -copy: \ - archroot.in \ - checkpkg.in \ - find-libdeps.in \ - finddeps.in \ - lddd.in \ - lib/makechrootpkg.sh.in - -archroot.in: $(devtoolsdir)/mkarchroot.in ; cp $< $@ -checkpkg.in: $(devtoolsdir)/checkpkg.in ; cp $< $@ -find-libdeps.in: $(devtoolsdir)/find-libdeps.in ; cp $< $@ -finddeps.in: $(devtoolsdir)/finddeps.in ; cp $< $@ -lddd.in: $(devtoolsdir)/lddd.in ; cp $< $@ -lib/makechrootpkg.sh.in: $(devtoolsdir)/makechrootpkg.in ; cp $< $@ - -###################################################################### - -build: \ - archroot \ - checkpkg \ - find-libdeps \ - finddeps \ - lddd \ - lib/makechrootpkg.sh - -indent = emacs --batch $1 \ - --eval '(setq sh-basic-offset 8)' \ - --eval '(indent-region (point-min) (point-max) nil)' \ - -f save-buffer &>/dev/null +# Build ############################################################## %: %.in Makefile @echo "GEN $@" - @$(edit) <"$<" >"$@" - @chmod 755 "$@" - -lib/makechrootpkg.sh.ugly: %.ugly: %.in %.patch Makefile - @echo "GEN $@" - @cp $*.in $@ - @patch $@ $*.patch - -lib/makechrootpkg.sh: %: %.ugly Makefile - @echo "GEN $@" - @$(edit) <"$<" >"$@" - $(call indent,$@) - -###################################################################### - -install: \ - $(DESTDIR)$(sbindir)/archroot \ - $(DESTDIR)$(bindir)/checkpkg \ - $(DESTDIR)$(bindir)/find-libdeps \ - $(DESTDIR)$(bindir)/find-libprovides \ - $(DESTDIR)$(bindir)/finddeps \ - $(DESTDIR)$(bindir)/lddd \ - $(DESTDIR)$(pkglibexecdir)/makechrootpkg.sh - -$(DESTDIR)$(sbindir)/%: % - install -Dm755 $< $@ - -$(DESTDIR)$(bindir)/%: % - install -Dm755 $< $@ + @$(edit) <"$<" >"$@" || { rm -f -- '$@'; false; } + @chmod 755 "$@" || { rm -f -- '$@'; false; } -$(DESTDIR)$(pkglibexecdir)/%: lib/% - install -Dm644 $< $@ +# Install ############################################################ $(DESTDIR)$(bindir)/find-libprovides: install -d $(@D) diff --git a/src/devtools/lib/.gitignore b/src/devtools/lib/.gitignore deleted file mode 100644 index 9e428f9..0000000 --- a/src/devtools/lib/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -!*.patch -!*.top diff --git a/src/devtools/lib/makechrootpkg.sh.patch b/src/devtools/lib/makechrootpkg.sh.patch deleted file mode 100644 index 505b96a..0000000 --- a/src/devtools/lib/makechrootpkg.sh.patch +++ /dev/null @@ -1,275 +0,0 @@ ---- makechrootpkg.sh.in -+++ makechrootpkg.sh.ugly -@@ -12,12 +12,7 @@ - - shopt -s nullglob - --# So that usage conflicts between upstream and -par mkarchroot don't get hidden --# silently in a merge. --archroot() { -- mkarchroot "$@" --} -- -+init_variables() { - makepkg_args='-s --noconfirm -L' - repack=false - update_first=false -@@ -28,13 +23,14 @@ - temp_chroot=false - chrootdir= - passeddir= --declare -a install_pkgs --declare -i ret=0 -+declare -ag install_pkgs -+declare -ig ret=0 - - copy=$USER - [[ -n $SUDO_USER ]] && copy=$SUDO_USER - [[ -z "$copy" || $copy = root ]] && copy=copy - src_owner=${SUDO_USER:-$USER} -+} - - usage() { - echo "Usage: ${0##*/} [options] -r [--] [makepkg args]" -@@ -69,6 +65,7 @@ - exit 1 - } - -+parse_options_init() { - while getopts 'hcudr:I:l:nT' arg; do - case "$arg" in - h) usage ;; -@@ -129,8 +126,20 @@ - # Note this is the same FD number as in mkarchroot - lock_open_write 9 "$copydir" \ - "Waiting for existing lock on chroot copy to be released: [$copy]" -+} -+ -+# Usage: chroot_sync $CHROOTDIR/$CHROOT [$CHROOTCOPY|$copydir] -+chroot_sync() { -+ local chrootdir=$1 -+ local copy=$2 -+ local copydir='' -+ if [[ ${copy:0:1} = / ]]; then -+ copydir=$copy -+ else -+ copydir="$chrootdir/$copy" -+ fi -+ local chroottype=$(stat -f -c %T "$chrootdir") - --if [[ ! -d $copydir ]] || $clean_first; then - # Get a read lock on the root chroot to make - # sure we don't clone a half-updated chroot - lock_open_read 8 "$chrootdir/root" \ -@@ -152,9 +161,16 @@ - - # Drop the read lock again - lock_close 8 --fi -+} -+ -+# Usage: chroot_install_pkgs $copydir $pkgs... -+chroot_install_pkgs() { -+ local copydir=$1 -+ shift -+ declare -i ret=0 -+ declare -a install_pkgs=("$@") -+ local pkgname - --if [[ -n "${install_pkgs[*]}" ]]; then - for install_pkg in "${install_pkgs[@]}"; do - pkgname="${install_pkg##*/}" - cp "$install_pkg" "$copydir/$pkgname" -@@ -165,10 +181,10 @@ - rm "$copydir/$pkgname" - done - -- # If there is no PKGBUILD we have done -- [[ -f PKGBUILD ]] || exit $ret --fi -+ return $ret -+} - -+func1() { - $update_first && archroot -u "$copydir" - - mkdir -p "$copydir/build" -@@ -230,14 +246,24 @@ - # Set target CARCH as it might be used within the PKGBUILD to select correct sources - eval $(grep '^CARCH=' "$copydir/etc/makepkg.conf") - export CARCH -+} - -+# Usage: chroot_copy_in $copydir -+# Environment: -+# - In the dirctory of a PKGBUILD -+# - $SRCDEST is set -+chroot_copy_in() { -+local copydir=$1 - # Copy PKGBUILD and sources --cp PKGBUILD "$copydir/build/" -+for recipe in PKGBUILD SRCBUILD; do -+if [[ -f $recipe ]]; then -+cp $recipe "$copydir/build/" - ( -- source PKGBUILD -- for file in "${source[@]}"; do -+ source $recipe -+ for file in "${source[@]}" "${mksource[@]}"; do - file="${file%%::*}" - file="${file##*://*/}" -+ file="${file##*://}" - if [[ -f $file ]]; then - cp "$file" "$copydir/srcdest/" - elif [[ -f $SRCDEST/$file ]]; then -@@ -251,18 +277,30 @@ - # evaluate any bash variables used - eval file=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$file")\" - [[ -f $file ]] && cp "$file" "$copydir/build/" -- done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) -+ done < <(sed -n "s/^[[:space:]]*$i=//p" $recipe) - done - ) -+fi -+done - - chown -R nobody "$copydir"/{build,pkgdest,srcdest} -+} - -+# Usage: chroot_let_nobody_use_pacman $copydir -+chroot_let_nobody_use_pacman() { -+local copydir=$1 - cat > "$copydir/etc/sudoers.d/nobody-pacman" <"$copydir/chrootbuild" </dev/null - repo-add repo.db.tar.gz "${pkgfile##*/}" - popd >/dev/null -- fi -+ done -+} - -+# Usage: chroot_copy_out_pkgs $copydir $user -+# Environment: -+# - $PKGDEST is set -+chroot_copy_out_pkgs() { -+ local copydir=$1 -+ local src_owner=$2 -+ for pkgfile in "$copydir"/pkgdest/*.pkg.tar*; do - chown "$src_owner" "$pkgfile" - mv "$pkgfile" "$PKGDEST" -+ if [[ $PKGDEST != . ]]; then -+ ln -sf "$PKGDEST/${pkgfile##*/}" . -+ fi - done -+} - -- for l in "$copydir"/build/*-{build,check,namcap,package,package_*}.log; do -+# Usage: chroot_copy_out_pkgs $copydir $user -+chroot_copy_out_logs() { -+ local copydir=$1 -+ local src_owner=$2 -+ for l in "$copydir"/build/*.log; do - chown "$src_owner" "$l" - [[ -f $l ]] && mv "$l" . - done --else -- # Just in case. We returned 1, make sure we fail -- ret=1 --fi -+} - -+# Usage: chroot_copy_out_srcs $copydir $user -+# Environment: -+# - $SRCDEST is set -+chroot_copy_out_srcs() { -+local copydir=$1 -+local src_owner=$2 - for f in "$copydir"/srcdest/*; do - chown "$src_owner" "$f" - mv "$f" "$SRCDEST" - done -+} - --if $temp_chroot; then -- stat_busy "Removing temporary directoy [$copy]" -+# Usage: chroot_delete $copydir -+chroot_delete() { -+ local chroottype=$(stat -f -c %T "$copydir") -+ stat_busy "Removing chroot copy [$copydir]" - if [[ "$chroottype" == btrfs ]]; then - btrfs subvolume delete "$copydir" >/dev/null || - die "Unable to delete subvolume $copydir" -@@ -326,8 +389,39 @@ - # remove lock file - rm --force "$copydir.lock" - stat_done --elif (( ret != 0 )); then -- die "Build failed, check $copydir/build" --else -- true --fi -+} -+ -+main() { -+ init_variables -+ parse_options_init "$@" -+ if [[ ! -d $copydir ]] || $clean_first; then -+ chroot_sync "$chrootdir" "$copy" -+ fi -+ if [[ -n "${install_pkgs[*]}" ]]; then -+ chroot_install_pkgs "$copydir" "${install_pkgs[@]}" -+ ret=$? -+ # If there is no PKGBUILD we have done -+ [[ -f PKGBUILD ]] || exit $ret -+ fi -+ func1 -+ chroot_copy_in "$copydir" -+ chroot_let_nobody_use_pacman "$copydir" -+ chroot_build "$copydir" "$makepkg_args" "$run_namcap" -+ func2 -+ if chroot_build; then -+ chroot_add_to_local_repo "$copydir" "$copydir"/pkgdest/*.pkg.tar* -+ chroot_copy_out_pkgs "$copydir" "$src_owner" -+ chroot_copy_out_logs "$copydir" "$src_owner" -+ else -+ # Just in case. We returned 1, make sure we fail -+ ret=1 -+ fi -+ chroot_copy_out_srcs "$copydir" "$src_owner" -+ if $temp_chroot; then -+ chroot_delete "$copydir" -+ elif (( ret != 0 )); then -+ die "Build failed, check $copydir/build" -+ else -+ true -+ fi -+} diff --git a/src/fullpkg/Makefile b/src/fullpkg/Makefile index 271cc5e..2c76089 100644 --- a/src/fullpkg/Makefile +++ b/src/fullpkg/Makefile @@ -1,3 +1 @@ -libre_execdir=$(bindir) -libre_confdir=$(sysconfdir)/libretools.d include ../../common.mk diff --git a/src/lib/Makefile b/src/lib/Makefile index e0067be..d7b4049 100644 --- a/src/lib/Makefile +++ b/src/lib/Makefile @@ -1,17 +1,12 @@ -include ../../common-devtools.mk - -pkglibexecdir=$(libexecdir)/libretools - -# Copy from devtools ################################################# - -copy: common.sh.in - -common.sh.in: $(devtoolsdir)/lib/common.sh ; cp $< $@ +copy_files = common.sh.in +libexecs = $(filter-out librelib,$(wildcard libre*)) +# include common.sh in libs explicitly, because it might not exist yet +# when the wildcard is performed +libs = $(sort $(wildcard *.sh) common.sh) +include ../../common.mk # Build ############################################################## -build: common.sh - common.sh: %: %.in %.top Makefile @echo "GEN $@" @{ \ @@ -20,28 +15,3 @@ common.sh: %: %.in %.top Makefile echo '_INCLUDE_COMMON_SH=true' && \ cat "$*.in" && \ echo 'fi'; } > "$@" - -# Install ############################################################ - -libexecs = $(filter-out librelib,$(wildcard libre*)) -libs = $(wildcard *.sh) - -# relative path to `/` from $(bindir) -rootdir=$(shell sed -r 's|^/||;s|[^/]+|..|g'<<<$(bindir)) - -install: \ - $(addprefix $(DESTDIR)$(bindir)/,$(libexecs) librelib) \ - $(addprefix $(DESTDIR)$(pkglibexecdir)/,$(libexecs) $(libs)) - -$(DESTDIR)$(bindir)/librelib: librelib - install -Dm755 '$<' '$@' - -$(DESTDIR)$(bindir)/%: % - install -d '$(@D)' - ln -sf '$(rootdir)$(pkglibexecdir)/$(@F)' "$@" - -$(DESTDIR)$(pkglibexecdir)/libre%: libre% - install -Dm755 '$<' '$@' - -$(DESTDIR)$(pkglibexecdir)/%.sh: %.sh - install -Dm644 '$<' '$@' diff --git a/src/librefetch/Makefile b/src/librefetch/Makefile index 271cc5e..2c76089 100644 --- a/src/librefetch/Makefile +++ b/src/librefetch/Makefile @@ -1,3 +1 @@ -libre_execdir=$(bindir) -libre_confdir=$(sysconfdir)/libretools.d include ../../common.mk diff --git a/src/mips64el-tools/Makefile b/src/mips64el-tools/Makefile index 271cc5e..2c76089 100644 --- a/src/mips64el-tools/Makefile +++ b/src/mips64el-tools/Makefile @@ -1,3 +1 @@ -libre_execdir=$(bindir) -libre_confdir=$(sysconfdir)/libretools.d include ../../common.mk diff --git a/src/toru/Makefile b/src/toru/Makefile index 271cc5e..2c76089 100644 --- a/src/toru/Makefile +++ b/src/toru/Makefile @@ -1,3 +1 @@ -libre_execdir=$(bindir) -libre_confdir=$(sysconfdir)/libretools.d include ../../common.mk -- cgit v1.2.2