This repository has been archived by the owner on Aug 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plan.sh
107 lines (94 loc) · 3.42 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
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
106
107
pkg_name=readline6
_distname=readline
pkg_origin=core
_base_version=6.3
pkg_version=${_base_version}.8
pkg_maintainer="The Habitat Maintainers <humans@habitat.sh>"
pkg_description="\
The GNU Readline library provides a set of functions for use by applications \
that allow users to edit command lines as they are typed in.\
"
pkg_upstream_url="http://tiswww.case.edu/php/chet/readline/rltop.html"
pkg_license=('GPL-3.0')
_url_base="http://ftp.gnu.org/gnu/${_distname}"
pkg_source="${_url_base}/${_distname}-${_base_version}.tar.gz"
pkg_shasum="56ba6071b9462f980c5a72ab0023893b65ba6debb4eeb475d7a563dc65cafd43"
pkg_dirname="${_distname}-${_base_version}"
pkg_deps=(
core/glibc
core/ncurses
)
pkg_build_deps=(
core/coreutils
core/diffutils
core/patch
core/make
core/gcc
core/bison
core/grep
)
pkg_include_dirs=(include)
pkg_lib_dirs=(lib)
do_begin() {
# The maintainer of Readline only releases these patches to fix serious
# issues, so any new official patches will be part of this build, which will
# be reflected in the "tiny" or "patch" number of the version coordinate. In
# other words, given 6 patches, the version of this Readline package would be
# `MAJOR.MINOR.6`.
# Source a file containing an array of patch URLs and an array of patch file
# shasums
source "${PLAN_CONTEXT}/readline-patches.sh"
}
do_download() {
do_default_download
# Download all patch files, providing the corresponding shasums so we can
# skip re-downloading if already present and verified
for i in $(seq 0 $((${#_patch_files[@]} - 1))); do
p="${_patch_files[$i]}"
download_file "$p" "$(basename "$p")" "${_patch_shasums[$i]}"
done; unset i p
}
do_verify() {
do_default_verify
# Verify all patch files against their shasums
for i in $(seq 0 $((${#_patch_files[@]} - 1))); do
verify_file "$(basename "${_patch_files[$i]}")" "${_patch_shasums[$i]}"
done; unset i
}
do_prepare() {
do_default_prepare
# Apply all patch files to the extracted source
for p in "${_patch_files[@]}"; do
build_line "Applying patch $(basename "$p")"
patch -p0 -i "${HAB_CACHE_SRC_PATH}/$(basename "$p")"
done
# This patch is to make sure that `libncurses' is among the `NEEDED'
# dependencies of `libreadline.so' and `libhistory.so'. Failing to do that,
# applications linking against Readline are forced to explicitly link against
# libncurses as well; in addition, this trick doesn't work when using GNU
# ld's `--as-needed'.
#
# Thanks to:
# https://github.com/NixOS/nixpkgs/blob/release-15.09/pkgs/development/libraries/readline/link-against-ncurses.patch
build_line "Applying patch link-against-ncurses.patch"
patch -p1 -i "${PLAN_CONTEXT}/link-against-ncurses.patch"
}
do_install() {
do_default_install
# An empty `bin/` directory gets made, which we don't need and is confusing
rm -rf "${pkg_prefix:?}/bin"
}
# ----------------------------------------------------------------------------
# **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/bison
core/grep
)
fi