forked from ProcursusTeam/Procursus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
coreutils.mk
72 lines (61 loc) · 2.92 KB
/
coreutils.mk
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
ifneq ($(PROCURSUS),1)
$(error Use the main Makefile)
endif
STRAPPROJECTS += coreutils
COREUTILS_VERSION := 8.32
DEB_COREUTILS_V ?= $(COREUTILS_VERSION)-4
ifeq ($(shell [ "$(CFVER_WHOLE)" -lt 1600 ] && echo 1),1)
COREUTILS_CONFIGURE_ARGS += ac_cv_func_rpmatch=no
endif
coreutils-setup: setup
wget -q -nc -P $(BUILD_SOURCE) https://ftpmirror.gnu.org/coreutils/coreutils-$(COREUTILS_VERSION).tar.xz{,.sig}
$(call PGP_VERIFY,coreutils-$(COREUTILS_VERSION).tar.xz)
$(call EXTRACT_TAR,coreutils-$(COREUTILS_VERSION).tar.xz,coreutils-$(COREUTILS_VERSION),coreutils)
mkdir -p $(BUILD_WORK)/coreutils/{su,rev,bsdcp}
wget -q -nc -P $(BUILD_WORK)/coreutils/su \
https://raw.githubusercontent.com/coolstar/netbsd-ports-ios/trunk/usr.bin/su/su.c \
https://raw.githubusercontent.com/coolstar/netbsd-ports-ios/trunk/usr.bin/su/suutil.{c,h}
wget -q -nc -P $(BUILD_WORK)/coreutils/rev \
https://opensource.apple.com/source/text_cmds/text_cmds-88/rev/rev.c
wget -q -nc -P $(BUILD_WORK)/coreutils/bsdcp \
https://opensource.apple.com/source/file_cmds/file_cmds-272.250.1/cp/{{cp,utils}.c,extern.h} \
https://opensource.apple.com/source/Libc/Libc-1353.41.1/gen/get_compat.h
ifneq ($(wildcard $(BUILD_WORK)/coreutils/.build_complete),)
coreutils:
@echo "Using previously built coreutils."
else
coreutils: coreutils-setup gettext
cd $(BUILD_WORK)/coreutils/su && $(CC) $(CFLAGS) su.c suutil.c -o su -DBSD4_4 -D'__RCSID(x)='
cd $(BUILD_WORK)/coreutils/rev && $(CC) $(CFLAGS) rev.c -o rev -D'__FBSDID(x)='
cd $(BUILD_WORK)/coreutils/bsdcp && $(CC) $(CFLAGS) -I. cp.c utils.c -o bsdcp -D'__FBSDID(x)='
cd $(BUILD_WORK)/coreutils && ./configure -C \
--host=$(GNU_HOST_TRIPLE) \
--prefix=/usr \
--without-gmp \
$(COREUTILS_CONFIGURE_ARGS)
+$(MAKE) -C $(BUILD_WORK)/coreutils
+$(MAKE) -C $(BUILD_WORK)/coreutils install \
DESTDIR=$(BUILD_STAGE)/coreutils
cp $(BUILD_WORK)/coreutils/{su/su,rev/rev,bsdcp/bsdcp} $(BUILD_STAGE)/coreutils/usr/bin
touch $(BUILD_WORK)/coreutils/.build_complete
endif
coreutils-package: coreutils-stage
# coreutils.mk Package Structure
rm -rf $(BUILD_DIST)/coreutils
mkdir -p $(BUILD_DIST)/coreutils/{etc/profile.d,bin,usr/sbin}
# coreutils.mk Prep coreutils
cp -a $(BUILD_STAGE)/coreutils/usr $(BUILD_DIST)/coreutils
ln -s /usr/bin/chown $(BUILD_DIST)/coreutils/usr/sbin
ln -s /usr/bin/chown $(BUILD_DIST)/coreutils/bin
ln -s /usr/bin/chroot $(BUILD_DIST)/coreutils/usr/sbin
ln -s /usr/bin/{cat,chgrp,cp,date,dd,dir,echo,false,kill,ln,ls,mkdir,mknod,mktemp,mv,pwd,readlink,rm,rmdir,sleep,stty,su,touch,true,uname,vdir} $(BUILD_DIST)/coreutils/bin
cp $(BUILD_INFO)/coreutils.sh $(BUILD_DIST)/coreutils/etc/profile.d
# coreutils.mk Sign
$(call SIGN,coreutils,general.xml)
# coreutils.mk Permissions
$(FAKEROOT) chmod u+s $(BUILD_DIST)/coreutils/usr/bin/su
# coreutils.mk Make .debs
$(call PACK,coreutils,DEB_COREUTILS_V)
# coreutils.mk Build cleanup
rm -rf $(BUILD_DIST)/coreutils
.PHONY: coreutils coreutils-package