wok view bash/receipt @ rev 24768
libwebkit: bison 3 fix
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Mar 19 12:46:44 2022 +0000 (2022-03-19) |
parents | 71360a13cd94 |
children | d79ed38ace18 |
line source
1 # SliTaz package receipt.
3 PACKAGE="bash"
4 VERSION="5.1.16"
5 BASEVERSION="${VERSION%.*}"
6 CATEGORY="system-tools"
7 TAGS="shell"
8 SHORT_DESC="The GNU bourne SHell."
9 MAINTAINER="pankso@slitaz.org"
10 LICENSE="GPL3"
11 WEB_SITE="https://www.gnu.org/software/bash/"
13 TARBALL="$PACKAGE-$BASEVERSION.tar.gz"
14 WGET_URL="$GNU_MIRROR/$PACKAGE/$TARBALL"
16 BASHCHECKURL="https://raw.githubusercontent.com/hannob/bashcheck/master/bashcheck"
17 BASHCHECK="$(basename $BASHCHECKURL)"
19 BASHPATCHES="$(for i in $(seq 1 ${VERSION##*.}); do printf "bash${BASEVERSION/./}-%03d " $i; done)"
20 EXTRA_SOURCE_FILES="$BASHCHECK $BASHPATCHES"
22 DEPENDS="libtinfo"
23 BUILD_DEPENDS="bison texinfo"
25 # What is the latest version available today?
26 current_version()
27 {
28 wget -O - ${WGET_URL%/*} 2>/dev/null | \
29 sed "/alpha/d;/doc/d;/$PACKAGE-/!d;/tar/!d;s|.*$PACKAGE-\\(.*\\).tar.*\".*|\\1|" | sort -Vr | sed q
30 }
32 patch_bash()
33 {
34 for i in $BASHPATCHES
35 do
36 if [ ! -s "$SOURCES_REPOSITORY/$i" ]
37 then
38 echo "Downloading $i"
39 busybox wget -O "$SOURCES_REPOSITORY/$i" \
40 http://ftp.gnu.org/gnu/bash/bash-$BASEVERSION-patches/$i
41 fi
42 echo "Apply $i ..."
43 patch -p0 < $SOURCES_REPOSITORY/$i
44 done
45 }
47 # Rules to compile & install the temporary toolchain.
48 cook_tmp_toolchain()
49 {
50 patch_bash &&
51 ./configure --without-bash-malloc &&
52 make &&
53 make install
54 }
56 # Rules to configure and make the package.
57 compile_rules()
58 {
59 # Patch and then build.
60 patch_bash
62 # Skip tests that can not run while cross-compiling.
63 cat > config.cache << "EOF"
64 ac_cv_func_mmap_fixed_mapped=yes
65 ac_cv_func_strcoll_works=yes
66 ac_cv_func_working_mktime=yes
67 bash_cv_func_sigsetjmp=present
68 bash_cv_getcwd_malloc=yes
69 bash_cv_job_control_missing=present
70 bash_cv_printf_a_format=yes
71 bash_cv_sys_named_pipes=present
72 bash_cv_ulimit_maxfds=yes
73 bash_cv_under_sys_siglist=yes
74 bash_cv_unusable_rtsigs=no
75 gt_cv_int_divbyzero_sigfpe=yes
76 EOF
78 ./configure \
79 --cache-file=config.cache \
80 --bindir=/bin \
81 --enable-history \
82 --enable-alias \
83 --disable-nls \
84 --without-bash-malloc \
85 --disable-help-builtin \
86 --with-installed-readline=no \
87 $CONFIGURE_ARGS &&
88 make &&
89 # Bash doesn't care about DESTDIR in environment variable.
90 make install DESTDIR=$DESTDIR
91 }
93 # Rules to gen a SliTaz package suitable for Tazpkg.
94 genpkg_rules()
95 {
96 mkdir $fs/etc
98 cook_copy_folders bin
100 # Configuration files.
101 cp $stuff/example.bashrc $fs/etc/bashrc
102 }
104 testsuite()
105 {
106 [ -s "$SOURCES_REPOSITORY/$BASHCHECK" ] ||
107 busybox wget --no-check-certificate \
108 -O "$SOURCES_REPOSITORY/$BASHCHECK" \
109 $BASHCHECKURL
110 $DESTDIR/bin/bash $SOURCES_REPOSITORY/$BASHCHECK $DESTDIR/bin/bash | \
111 tee bashcheck.log
112 grep Vulnerable bashcheck.log &&
113 echo "ERROR: Vulnerable"
114 }
116 post_install()
117 {
118 mkdir -p "$1/etc/skel"
119 cp -a "$1/etc/bashrc" "$1/etc/skel/.bashrc"
121 # Exit function in non-interactive mode (when user can't answer question)
122 ! tty -s && return
124 echo
125 echo -n 'Do you want to set Bash to default (y/N) ? : '
126 read -t 30 answer
127 [ "$answer" != 'y' ] &&
128 return
130 echo
131 echo 'Setting bash as default shell for all users'
132 sed -i 's|:/bin/[ckz]*sh$|:/bin/bash|' "$1/etc/passwd"
134 echo 'Creating ~/.bashrc file for all users'
135 for i in $(awk -F: '$7=="/bin/bash"{print $6}' "$1/etc/passwd")
136 do
137 [ -e "$1$i/.bashrc" ] && continue
138 cp "$1/etc/bashrc" "$1$i/.bashrc"
139 chown $(stat -c%U:%G "$1$i") "$1$i/.bashrc"
140 done
141 }
144 pre_remove()
145 {
146 echo
147 echo 'Setting sh as default shell for all users'
148 sed -i 's|:/bin/bash$|:/bin/sh|' "$1/etc/passwd"
149 [ -f "$1/etc/skel/.bashrc" ] &&
150 rm "$1/etc/skel/.bashrc"
151 }