forked from ProcursusTeam/Procursus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbash.mk
105 lines (95 loc) · 3.58 KB
/
bash.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
ifneq ($(PROCURSUS),1)
$(error Use the main Makefile)
endif
STRAPPROJECTS += bash
BASH_VERSION := 5.0
DEB_BASH_V ?= $(BASH_VERSION).$(BASH_SUB_V)-2
# When built with SSH_SOURCE_BASHRC, bash will source ~/.bashrc when
# it's non-interactively from sshd. This allows the user to set
# environment variables prior to running the command (e.g. PATH). The
# /bin/bash that ships with macOS defines this, and without it, some
# things (e.g. git+ssh) will break if the user sets their default shell to
# Homebrew's bash instead of /bin/bash.
bash-setup: setup
wget -q -nc -P $(BUILD_SOURCE) https://ftpmirror.gnu.org/bash/bash-$(BASH_VERSION).tar.gz{,.sig} \
https://ftpmirror.gnu.org/bash/bash-$(BASH_VERSION)-patches/bash50-00{1..9}{,.sig} \
https://ftpmirror.gnu.org/bash/bash-$(BASH_VERSION)-patches/bash50-0{10..17}{,.sig}
$(call PGP_VERIFY,bash-$(BASH_VERSION).tar.gz)
$(call PGP_VERIFY,bash50-001)
$(call PGP_VERIFY,bash50-002)
$(call PGP_VERIFY,bash50-003)
$(call PGP_VERIFY,bash50-004)
$(call PGP_VERIFY,bash50-005)
$(call PGP_VERIFY,bash50-006)
$(call PGP_VERIFY,bash50-007)
$(call PGP_VERIFY,bash50-008)
$(call PGP_VERIFY,bash50-009)
$(call PGP_VERIFY,bash50-010)
$(call PGP_VERIFY,bash50-011)
$(call PGP_VERIFY,bash50-012)
$(call PGP_VERIFY,bash50-013)
$(call PGP_VERIFY,bash50-014)
$(call PGP_VERIFY,bash50-015)
$(call PGP_VERIFY,bash50-016)
$(call PGP_VERIFY,bash50-017)
$(call EXTRACT_TAR,bash-$(BASH_VERSION).tar.gz,bash-$(BASH_VERSION),bash)
mkdir -p $(BUILD_STAGE)/bash/bin
mkdir -p $(BUILD_PATCH)/bash-$(BASH_VERSION)
find $(BUILD_SOURCE) -name 'bash50*' -not -name '*.sig' -exec cp '{}' $(BUILD_PATCH)/bash-$(BASH_VERSION)/ \;
$(call DO_PATCH,bash-$(BASH_VERSION),bash,-p0)
$(SED) -i 's/ENOEXEC)/ENOEXEC \&\& i != EPERM)/' $(BUILD_WORK)/bash/execute_cmd.c
ifneq ($(wildcard $(BUILD_WORK)/bash/.build_complete),)
bash:
@echo "Using previously built bash."
else
bash: bash-setup ncurses readline
@# TODO: This is kinda messy, clean up
cd $(BUILD_WORK)/bash && ./configure -C \
--host=$(GNU_HOST_TRIPLE) \
--prefix=/usr \
--disable-nls \
--with-installed-readline=$(BUILD_BASE)/usr/lib \
CFLAGS="$(CFLAGS) -DSSH_SOURCE_BASHRC" \
ac_cv_c_stack_direction=-1 \
ac_cv_func_mmap_fixed_mapped=yes \
ac_cv_func_setvbuf_reversed=no \
ac_cv_func_strcoll_works=yes \
ac_cv_func_working_mktime=yes \
ac_cv_prog_cc_g=no \
ac_cv_rl_version=8.0 \
ac_cv_type_getgroups=gid_t \
bash_cv_dev_fd=absent \
bash_cv_dup2_broken=no \
bash_cv_func_ctype_nonascii=no \
bash_cv_func_sigsetjmp=present \
bash_cv_func_strcoll_broken=yes \
bash_cv_job_control_missing=present \
bash_cv_must_reinstall_sighandlers=no \
bash_cv_sys_named_pipes=present \
bash_cv_sys_siglist=yes \
gt_cv_int_divbyzero_sigfpe=no \
ac_cv_sys_interpreter=no
+$(MAKE) -C $(BUILD_WORK)/bash \
TERMCAP_LIB=-lncursesw
+$(MAKE) -C $(BUILD_WORK)/bash install \
DESTDIR="$(BUILD_STAGE)/bash"
ln -s ../usr/bin/bash $(BUILD_STAGE)/bash/bin/bash
ln -s ../usr/bin/bash $(BUILD_STAGE)/bash/bin/sh
ln -s bash $(BUILD_STAGE)/bash/usr/bin/sh
touch $(BUILD_WORK)/bash/.build_complete
endif
bash-package: BASH_SUB_V=$(shell find $(BUILD_PATCH)/bash-$(BASH_VERSION) -type f | $(WC) -l)
bash-package: bash-stage
# bash.mk Package Structure
rm -rf $(BUILD_DIST)/bash
mkdir -p $(BUILD_DIST)/bash/usr
# bash.mk Prep bash
cp -a $(BUILD_STAGE)/bash/usr/{bin,include,lib} $(BUILD_DIST)/bash/usr
cp -a $(BUILD_STAGE)/bash/bin $(BUILD_DIST)/bash
# bash.mk Sign
$(call SIGN,bash,general.xml)
# bash.mk Make .debs
$(call PACK,bash,DEB_BASH_V)
# bash.mk Build cleanup
rm -rf $(BUILD_DIST)/bash
.PHONY: bash bash-package