summaryrefslogtreecommitdiff
path: root/build.mk
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2022-02-11 15:18:39 +0100
committerMarc Vertes <mvertes@free.fr>2022-02-11 15:18:39 +0100
commita70f04dec341ea17772bdebf03867e590126aa5e (patch)
tree0ca9215195902d3686a0780a5a30aa0ac3ca82d4 /build.mk
parentd6a67e794841f6b219b7d65dc964f745b63be6a0 (diff)
Add linux source build. Detect inflate command.
Diffstat (limited to 'build.mk')
-rw-r--r--build.mk19
1 files changed, 15 insertions, 4 deletions
diff --git a/build.mk b/build.mk
index 02b364e..0fcceaf 100644
--- a/build.mk
+++ b/build.mk
@@ -2,18 +2,29 @@
#
# TODO:
# - rules for pre-req dependencies
-# - rules to build and maintain patches
+# - rules to build patches from .orig
# - rules to run tests before installing
# - build and run in chroot
+# - detect inflate command
+#
+# Done:
+# - rules to apply patches
#
arc ?= $(notdir $(url))
configure_cmd ?= ./configure
build_cmd ?= make
-inflate_cmd ?= gunzip
install_cmd ?= sudo make install
uninstall_cmd ?= sudo make uninstall
+ifeq ($(suffix $(arc)), .gz)
+ inflate_cmd ?= gzip -cd
+else ifeq ($(suffix $(arc)), .xz)
+ inflate_cmd ?= xz -cd
+else ifeq ($(suffix $(arc)), .bz2)
+ inflate_cmd ?= bzip2 -cd
+endif
+
ifdef git_url
fetch_cmd = git clone --depth=1 $(git_url)
extract_cmd = :
@@ -25,7 +36,7 @@ else
endif
clean:
- rm -rf .install .build .configure .extract .fetch $(dir)
+ rm -rf .install .build .patched .configure .extract .fetch $(dir)
debug:
@echo arc = $(arc)
@@ -55,7 +66,7 @@ fetch: .fetch
@touch $@
.patched: .extract
- cd $(dir) && for f in ../*.patch; do patch -p1 < $$f || break; done
+ for f in $$(ls *.patch); do (cd $(dir) && patch -p1 < ../$$f) || break; done
@touch $@
.extract: .fetch