This repository has been archived by the owner on Aug 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plan.sh
77 lines (69 loc) · 1.99 KB
/
plan.sh
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
# Disable shellcheck that would require quotes around pkg_name
# shellcheck disable=SC2209
pkg_name=bc
pkg_origin=core
pkg_version=1.07.1
pkg_maintainer="The Habitat Maintainers <humans@habitat.sh>"
pkg_description="\
bc is an arbitrary precision numeric processing language. Syntax is similar \
to C, but differs in many substantial areas. It supports interactive \
execution of statements. bc is a utility included in the POSIX P1003.2/D11 \
draft standard.\
"
pkg_upstream_url="https://www.gnu.org/software/bc/"
pkg_license=("GPL-3.0")
pkg_source="https://ftp.gnu.org/gnu/${pkg_name}/${pkg_name}-${pkg_version}.tar.gz"
pkg_shasum="62adfca89b0a1c0164c2cdca59ca210c1d44c3ffc46daf9931cf4942664cb02a"
pkg_deps=(
core/flex
core/glibc
core/ncurses
core/readline
)
pkg_build_deps=(
core/bison
core/coreutils
core/diffutils
core/gcc
core/make
core/patch
core/texinfo
)
pkg_bin_dirs=(bin)
do_prepare() {
# Both fixes here thanks to:
# http://www.linuxfromscratch.org/lfs/view/development/chapter06/bc.html
sed -i -e '/flex/s/as_fn_error/: ;; # &/' configure
cat > bc/fix-libmath_h << "EOF"
#!/bin/bash
sed -e '1 s/^/{"/' \
-e 's/$/",/' \
-e '2,$ s/^/"/' \
-e '$ d' \
-i libmath.h
sed -e '$ s/$/0}/' \
-i libmath.h
EOF
}
do_build() {
./configure \
--prefix="$pkg_prefix" \
--with-readline
make
}
do_check() {
echo "quit" | ./bc/bc -l Test/checklib.b
}
# ----------------------------------------------------------------------------
# **NOTICE:** What follows are implementation details required for building a
# first-pass, "stage1" toolchain and environment. It is only used when running
# in a "stage1" Studio and can be safely ignored by almost everyone. Having
# said that, it performs a vital bootstrapping process and cannot be removed or
# significantly altered. Thank you!
# ----------------------------------------------------------------------------
if [[ "$STUDIO_TYPE" = "stage1" ]]; then
pkg_build_deps=(
core/gcc
core/coreutils
)
fi