blob: 86995037384d26397fde59025553253effe9475d (
plain)
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
|
#!/bin/sh
. ./config.sh
BINUTILS_URL=https://ftp.gnu.org/gnu/binutils/$BINUTILS_PKG
GCC_URL=https://ftp.gnu.org/gnu/gcc/gcc-"$GCC_VERSION"/"$GCC_PKG"
FLEX_URL=https://github.com/westes/flex/releases/download/v$FLEX_VERSION/$FLEX_PKG
ZLIB_URL=http://zlib.net/"$ZLIB_PKG"
BZIP2_URL=https://sourceware.org/pub/bzip2/$BZIP2_PKG
BASH_URL=https://ftp.gnu.org/gnu/bash/"$BASH_PKG"
COREUTILS_URL=https://ftp.gnu.org/gnu/coreutils/"$COREUTILS_PKG"
E2FSPROGS_URL=https://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v"$E2FSPROGS_VERSION"/"$E2FSPROGS_PKG"
PKGCONFIGLITE_URL=http://downloads.sourceforge.net/project/pkgconfiglite/"$PKGCONFIGLITE_VERSION"/"$PKGCONFIGLITE_PKG"
LIBUUID_URL=http://downloads.sourceforge.net/project/libuuid/"$LIBUUID_PKG"
UTIL_LINUX_URL=https://www.kernel.org/pub/linux/utils/util-linux/v$UTIL_LINUX_MAJOR_VERSION/"$UTIL_LINUX_PKG"
GRUB_URL=https://ftp.gnu.org/gnu/grub/"$GRUB_PKG"
SHADOW_URL=https://github.com/shadow-maint/shadow/releases/download/"$SHADOW_VERSION"/"$SHADOW_PKG"
SED_URL=https://ftp.gnu.org/gnu/sed/"$SED_PKG"
GMP_URL=https://ftp.gnu.org/gnu/gmp/"$GMP_PKG"
MPFR_URL=http://mpfr.org/mpfr-current/"$MPFR_PKG"
MPC_URL=https://ftp.gnu.org/gnu/mpc/"$MPC_PKG"
NCURSES_URL=https://ftp.gnu.org/gnu/ncurses/"$NCURSES_PKG"
VIM_URL=ftp://ftp.vim.org/pub/vim/unix/"$VIM_PKG"
GPG_ERROR_URL=ftp://ftp.gnupg.org/gcrypt/libgpg-error/"$GPG_ERROR_PKG"
GCRYPT_URL=ftp://ftp.gnupg.org/gcrypt/libgcrypt/"$GCRYPT_PKG"
MAKE_URL=ftp://ftp.gnu.org/gnu/make/"$MAKE_PKG"
GREP_URL=https://ftp.gnu.org/gnu/grep/"$GREP_PKG"
GAWK_URL=https://ftp.gnu.org/gnu/gawk/"$GAWK_PKG"
DASH_URL=http://gondor.apana.org.au/~herbert/dash/files/$DASH_PKG
LIBPCIACCESS_URL=https://www.x.org/pub/individual/lib/$LIBPCIACCESS_PKG
LIBXCRYPT_URL=https://github.com/besser82/libxcrypt/releases/download/v$LIBXCRYPT_VERSION/$LIBXCRYPT_PKG
PARTED_URL=https://ftp.gnu.org/gnu/parted/$PARTED_PKG
DMIDECODE_URL=http://download.savannah.gnu.org/releases/dmidecode/$DMIDECODE_PKG
FINDUTILS_URL=https://ftp.gnu.org/gnu/findutils/$FINDUTILS_PKG
unpack () {
if [ -d "$3" ]; then
return 0
fi
print_info "unpacking $2" &&
tar $1 $2
}
DOWNLOAD_CACHE_DIRECTORY=~/.cache/cross-hurd
CACHE_DOWNLOADS=1
CACHE_GIT=1
download () {
if [ -f $1 ]; then
return 0
fi
if [ -n "$CACHE_DOWNLOADS" ]; then
mkdir -p $DOWNLOAD_CACHE_DIRECTORY
pushd $DOWNLOAD_CACHE_DIRECTORY &&
(test -f $1 || wget $2) &&
popd &&
cp $DOWNLOAD_CACHE_DIRECTORY/$1 .
else
wget $2
fi
}
download_from_git () {
dir=$1
repo=$2
branch=$3
add_branch=""
if [ -n "$branch" ]; then
add_branch="--branch $branch"
fi
(if [ -d $dir ]; then
pushd $dir &&
git reset --hard &&
git pull &&
local git_result=$?
popd &&
return $git_result
elif [ -n "$CACHE_GIT" ]; then
mkdir -p $DOWNLOAD_CACHE_DIRECTORY &&
pushd $DOWNLOAD_CACHE_DIRECTORY &&
(if [ -d $dir ]; then
pushd $dir &&
git reset --hard &&
git pull &&
popd
else
git clone --depth=1 $repo $add_branch $dir
fi) &&
popd &&
ln -sf $DOWNLOAD_CACHE_DIRECTORY/$dir .
else
git clone --depth=1 $repo
fi)
}
download_gnumach () {
download_from_git gnumach git://git.savannah.gnu.org/hurd/gnumach.git &&
pushd gnumach &&
apply_patch $SCRIPT_DIR/patches/gnumach/50_initrd.patch 1 &&
apply_patch $SCRIPT_DIR/patches/gnumach/79_dde-debian.patch 1 &&
popd
}
download_mig () {
download_from_git mig git://git.savannah.gnu.org/hurd/mig.git
}
download_hurd () {
download_from_git hurd git://git.savannah.gnu.org/hurd/hurd.git &&
pushd hurd &&
apply_patch $SCRIPT_DIR/patches/hurd/link-rump.patch 1
popd
}
download_rumpkernel () {
download_from_git rumpkernel https://salsa.debian.org/hurd-team/rumpkernel.git
}
download_libacpica () {
download_from_git libacpica https://salsa.debian.org/hurd-team/libacpica.git
}
apply_patch() {
print_info "Using patch $1 (level: $2)"
if patch -f -Np$2 --dry-run < $1 > /dev/null 2>&1; then
patch -Np$2 < $1 || exit 1
else
echo "Cannot apply patch!"
fi
}
download_glibc () {
(if [ ! -d glibc ]; then
git clone --depth=1 git://sourceware.org/git/glibc.git
fi) &&
cd glibc &&
git reset --hard &&
git pull &&
git checkout $GLIBC_TAG &&
apply_patch $SCRIPT_DIR/patches/glibc/tg-bits_atomic.h_multiple_threads.diff 1 &&
apply_patch $SCRIPT_DIR/patches/glibc/tg-unlockpt-chroot.diff 1 &&
apply_patch $SCRIPT_DIR/patches/glibc/local-clock_gettime_MONOTONIC.diff 1 &&
apply_patch $SCRIPT_DIR/patches/glibc/submitted-AF_LINK.diff 1 &&
apply_patch $SCRIPT_DIR/patches/glibc/unsubmitted-prof-eintr.diff 1 &&
apply_patch $SCRIPT_DIR/patches/glibc/unsubmitted-getaux_at_secure.diff 1 &&
apply_patch $SCRIPT_DIR/patches/glibc/local-static_pthread_setcancelstate.diff 1 &&
apply_patch $SCRIPT_DIR/patches/glibc/tg-mach-hurd-link.diff 1 &&
cd ..
}
download_gcc () {
download $GCC_PKG $GCC_URL &&
if [ -d "$GCC_SRC" ]; then
return 0
fi
unpack zxf $GCC_PKG $GCC_SRC &&
pushd $GCC_SRC &&
apply_patch $SCRIPT_DIR/patches/gcc/hurd-amd64.diff 1 &&
apply_patch $SCRIPT_DIR/patches/gcc/hurd-multiarch.diff 1 &&
apply_patch $SCRIPT_DIR/patches/gcc/hurd-multilib-multiarch.diff 1 &&
popd
}
download_binutils () {
download $BINUTILS_PKG $BINUTILS_URL &&
if [ -d "$BINUTILS_SRC" ]; then
return 0
fi
unpack jxf $BINUTILS_PKG $BINUTILS_SRC
}
download_coreutils () {
download $COREUTILS_PKG $COREUTILS_URL &&
if [ ! -d "$COREUTILS_SRC" ]; then
unpack Jxf $COREUTILS_PKG $COREUTILS_SRC
fi
}
download_sed () {
download $SED_PKG $SED_URL &&
if [ -d "$SED_SRC" ]; then
return 0
fi
unpack xf $SED_PKG $SED_SRC
}
download_ncurses () {
download $NCURSES_PKG $NCURSES_URL &&
if [ -d "$NCURSES_SRC" ]; then
return 0
fi
unpack zxf $NCURSES_PKG $NCURSES_SRC
}
download_vim () {
download $VIM_PKG $VIM_URL &&
if [ -d "vim$VIM_BASE_VERSION" ]; then
return 0
fi
unpack jxf $VIM_PKG $VIM_SRC
}
download_gpg_error () {
download $GPG_ERROR_PKG $GPG_ERROR_URL &&
if [ -d "$GPG_ERROR_SRC" ]; then
return 0
fi
unpack jxf $GPG_ERROR_PKG $GPG_ERROR_SRC &&
pushd $GPG_ERROR_SRC &&
apply_patch $SCRIPT_DIR/patches/libgpg-error/hurd-amd64.patch 1 &&
popd
}
download_gcrypt () {
download $GCRYPT_PKG $GCRYPT_URL &&
if [ -d "$GCRYPT_SRC" ]; then
return 0
fi
unpack jxf $GCRYPT_PKG $GCRYPT_SRC
}
download_make () {
download $MAKE_PKG $MAKE_URL &&
if [ -d "$MAKE_SRC" ]; then
return 0
fi
unpack xf $MAKE_PKG $MAKE_SRC
}
download_grub () {
download $GRUB_PKG $GRUB_URL &&
if [ -d "$GRUB_SRC" ]; then
return 0
fi
unpack zxf $GRUB_PKG $GRUB_SRC
}
download_grep () {
download $GREP_PKG $GREP_URL &&
if [ -d "$GREP_SRC" ]; then
return 0
fi
unpack xf $GREP_PKG $GREP_SRC
pushd $GREP_SRC &&
apply_patch $SCRIPT_DIR/patches/grep/gnulib-hurd-x86_64.patch 1 &&
popd
}
download_gawk () {
download $GAWK_PKG $GAWK_URL &&
if [ -d "$GAWK_SRC" ]; then
return 0
fi
unpack xf $GAWK_PKG $GAWK_SRC
}
download_dash () {
download $DASH_PKG $DASH_URL &&
if [ -d $DASH_SRC ]; then
return 0
fi
unpack xf $DASH_PKG $DASH_SRC
pushd $DASH_SRC &&
apply_patch $SCRIPT_DIR/patches/dash/dash-path-max.patch 1 &&
popd
}
download_libpciaccess () {
download $LIBPCIACCESS_PKG $LIBPCIACCESS_URL &&
if [ -d $LIBPCIACCESS_SRC ]; then
return 0
fi
unpack xf $LIBPCIACCESS_PKG $LIBPCIACCESS_SRC
}
download_libxcrypt () {
download $LIBXCRYPT_PKG $LIBXCRYPT_URL &&
if [ -d $LIBXCRYPT_SRC ]; then
return 0
fi
unpack xf $LIBXCRYPT_PKG $LIBXCRYPT_SRC
}
download_parted () {
download $PARTED_PKG $PARTED_URL &&
if [ -d $PARTED_SRC ]; then
return 0
fi
unpack xf $PARTED_PKG $PARTED_SRC
}
download_dmidecode () {
download $DMIDECODE_PKG $DMIDECODE_URL &&
if [ -d $DMIDECODE_SRC ]; then
return 0
fi
unpack xf $DMIDECODE_PKG $DMIDECODE_SRC
}
download_findutils () {
download $FINDUTILS_PKG $FINDUTILS_URL &&
if [ -d $FINDUTILS_SRC ]; then
return 0
fi
unpack xf $FINDUTILS_PKG $FINDUTILS_SRC
}
|