forked from ProcursusTeam/Procursus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
grep.mk.template
53 lines (44 loc) · 3.73 KB
/
grep.mk.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
ifneq ($(PROCURSUS),1)
$(error Use the main Makefile)
endif
STRAPPROJECTS += grep ### In this case, STRAPPROJECTS is the variable used. Most tools are unneeded in the bootstrap and would instead the SUBPROJECTS variable.
GREP_VERSION := 3.4 ### For most tools, all it takes to update is changing this version number and recompiling the package.
DEB_GREP_V ?= $(GREP_VERSION) ### This is the version number put into the package's control file. Just in case we need to increment the version before a new one is released by the maintainers. See it used on line 48.
grep-setup: setup
wget -q -nc -P $(BUILD_SOURCE) https://ftpmirror.gnu.org/grep/grep-$(GREP_VERSION).tar.xz{,.sig} ### Tarball to download. If available, always download the .sig or .asc file with it. See line 11. ### The main setup stage downloads all tarballs. This target should always be required by the (tool)-setup target. This is also usually where any edits to files being built should be performed.
$(call PGP_VERIFY,grep-$(GREP_VERSION).tar.xz) ### Verifies the downloaded tarball against the sig file downloaded. This stage can be bypassed by passing `NO_PGP=1` when making.
### In the case you downloaded a .asc file, the above line would look like this:
### $(call PGP_VERIFY,grep-$(GREP_VERSION).tar.xz,asc)
$(call EXTRACT_TAR,grep-$(GREP_VERSION).tar.xz,grep-$(GREP_VERSION),grep) ### Extracts tarball.
ifneq ($(wildcard $(BUILD_WORK)/grep/.build_complete),) ### On a successful build of a tool, a .build_complete file should be made in it's build work directory. (See line 33) This prevents it from being unnecessarily built again. You can rebuild a package by running `make rebuild-(tool)`.
grep:
@echo "Using previously built grep."
else
grep: grep-setup pcre ### The (tool) target is where the actual building happens.
cd $(BUILD_WORK)/grep && ./configure -C \
--host=$(GNU_HOST_TRIPLE) \
--prefix=/usr \
--disable-dependency-tracking \
--disable-nls \
--with-packager="$(DEB_MAINTAINER)"
+$(MAKE) -C $(BUILD_WORK)/grep
+$(MAKE) -C $(BUILD_WORK)/grep install \
DESTDIR=$(BUILD_STAGE)/grep ### On the completion of a successful build, always install files to a package's own directory in $(BUILD_STAGE).
### If what you're building includes a shared library, also install to $(BUILD_BASE)
### +$(MAKE) -C $(BUILD_WORK)/grep install \
DESTDIR=$(BUILD_BASE)
touch $(BUILD_WORK)/grep/.build_complete ### Explained on line 16.
endif
grep-package: grep-stage ### (tool)-stage should always be required by the (tool)-package target.
# grep.mk Package Structure
rm -rf $(BUILD_DIST)/grep
mkdir -p $(BUILD_DIST)/grep
# grep.mk Prep grep
cp -a $(BUILD_STAGE)/grep/usr $(BUILD_DIST)/grep
# grep.mk Sign
$(call SIGN,grep,general.xml) ### This signs the package with ldid. If your tool needs different entitlements than usual, place it's own entitlements file in build_info, and reflect said file here.
# grep.mk Make .debs
$(call PACK,grep,DEB_GREP_V) ### This is where the deb is packaged, DEB_GREP_V being the variable made for the deb version on line 8.
# grep.mk Build cleanup
rm -rf $(BUILD_DIST)/grep
.PHONY: grep grep-package