Skip to content

Commit 06f80e9

Browse files
committed
separate script for deps
1 parent 63d03ea commit 06f80e9

File tree

2 files changed

+180
-0
lines changed

2 files changed

+180
-0
lines changed

sources.wasm/ncurses.sh

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#!/bin/bash
2+
3+
. ${CONFIG:-config}
4+
5+
# --disable-database --enable-termcap
6+
7+
NCOPTS="--enable-ext-colors --enable-ext-mouse --prefix=$PREFIX --disable-echo --without-pthread \
8+
--without-tests --without-tack --without-progs --without-manpages \
9+
--disable-db-install --without-cxx --without-cxx-binding --enable-pc-files \
10+
--with-pkg-config-libdir=$PREFIX/lib/pkgconfig \
11+
--with-termlib --enable-termcap --disable-database"
12+
13+
14+
export NCURSES=${NCURSES:-"ncurses-6.1"}
15+
export URL_NCURSES=${URL_NCURSES:-"URL https://ftp.NCURSES.org/source/$NCURSES.tar.gz"}
16+
export HASH_NCURSES=${HASH_NCURSES:-"URL_HASH SHA256=aa057eeeb4a14d470101eff4597d5833dcef5965331be3528c08d99cebaa0d17"}
17+
18+
19+
20+
if true
21+
then
22+
23+
wget -q -c $URL_NCURSES && tar xfz $NCURSES.tar.gz
24+
25+
pushd $NCURSES
26+
[ -f $NCURSES.done ] || patch -p1 < $ROOT/support/__EMSCRIPTEN__.deps/ncurses-6.1_emscripten.patch
27+
touch $NCURSES.done
28+
popd
29+
30+
31+
cd $ROOT
32+
33+
if [ -f devices/emsdk/usr/lib/libncursesw.a ]
34+
then
35+
echo "
36+
* ncursesw already built
37+
" 1>&2
38+
else
39+
mkdir -p build/ncurses/
40+
41+
# build wide char
42+
rm -rf build/ncurses/*
43+
44+
pushd build/ncurses
45+
make clean
46+
CC=clang CFLAGS="-fpic -Wno-unused-command-line-argument" $ROOT/src/ncurses-6.1/configure \
47+
$NCOPTS --enable-widec && make && make install
48+
49+
popd
50+
fi
51+
52+
53+
54+
if false #[ -f ../devices/emsdk/usr/lib/libncurses.a ]
55+
then
56+
echo "
57+
* skiping [ncurses] or already built
58+
" 1>&2
59+
else
60+
rm -rf ../build/ncurses/*
61+
pushd ../build/ncurses
62+
63+
CC=clang CFLAGS="-fpic -Wno-unused-command-line-argument" $ROOT/src/ncurses-6.1/configure \
64+
$NCOPTS && make && make install
65+
66+
CFLAGS="-fpic -Wno-unused-command-line-argument" emconfigure \
67+
$ROOT/src/ncurses-6.1/configure \
68+
$NCOPTS
69+
70+
if patch -p1 < $ROOT/support/__EMSCRIPTEN__.deps/ncurses-6.1_emscripten_make.patch
71+
then
72+
emmake make clean
73+
if emmake make
74+
then
75+
emmake make install
76+
fi
77+
fi
78+
popd
79+
fi
80+
81+
82+
if [ -f ../devices/emsdk/usr/lib/libncursesw.a ]
83+
then
84+
echo "
85+
* ncursesw already built
86+
" 1>&2
87+
else
88+
# build wide char
89+
pushd ../build/ncurses
90+
91+
CFLAGS="-fpic -Wno-unused-command-line-argument" emconfigure \
92+
$ROOT/src/ncurses-6.1/configure $NCOPTS --enable-widec
93+
94+
if patch -p1 < $SDKROOT/support/__EMSCRIPTEN__.deps/ncurses-6.1_emscripten_makew.patch
95+
then
96+
emmake make clean
97+
if emmake make
98+
then
99+
emmake make install
100+
fi
101+
fi
102+
popd
103+
fi
104+
105+
fi
106+

sources.wasm/openssl.sh

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/bin/bash
2+
3+
. ${CONFIG:-config}
4+
5+
export OPENSSL="openssl-1.1.1s"
6+
export URL_OPENSSL=${URL_OPENSSL:-"URL https://ftp.openssl.org/source/$OPENSSL.tar.gz"}
7+
export HASH_OPENSSL="URL_HASH SHA256=c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa"
8+
9+
. scripts/emsdk-fetch.sh
10+
11+
if [ -f openssl.patched ]
12+
then
13+
echo "
14+
already patched for $PREFIX
15+
"
16+
else
17+
wget -c $URL_OPENSSL
18+
tar xvfz $OPENSSL.tar.gz
19+
pushd $OPENSSL
20+
patch -p1 <<END
21+
--- openssl-1.1.1n/Configurations/10-main.conf 2022-03-15 14:37:47.000000000 +0000
22+
+++ openssl-1.1.1n-fixed/Configurations/10-main.conf 2022-04-05 10:48:27.348576840 +0000
23+
@@ -657,7 +657,8 @@
24+
},
25+
"linux-generic64" => {
26+
inherit_from => [ "linux-generic32" ],
27+
- bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
28+
+ bn_ops => "SIXTY_FOUR_BIT RC4_CHAR",
29+
+ lib_cppflags => add("-DBN_DIV2W"),
30+
},
31+
32+
"linux-ppc" => {
33+
diff -urN openssl-1.1.1n/crypto/rand/rand_unix.c openssl-1.1.1n-fixed/crypto/rand/rand_unix.c
34+
--- openssl-1.1.1n/crypto/rand/rand_unix.c 2022-04-05 10:54:21.980130409 +0000
35+
+++ openssl-1.1.1n-fixed/crypto/rand/rand_unix.c 2022-04-05 09:27:47.960526811 +0000
36+
@@ -369,7 +369,7 @@
37+
* Note: Sometimes getentropy() can be provided but not implemented
38+
* internally. So we need to check errno for ENOSYS
39+
*/
40+
-# if defined(__GNUC__) && __GNUC__>=2 && defined(__ELF__) && !defined(__hpux)
41+
+# if defined(__EMSCRIPTEN__)
42+
extern int getentropy(void *buffer, size_t length) __attribute__((weak));
43+
44+
if (getentropy != NULL) {
45+
END
46+
47+
touch ../openssl.patched
48+
popd
49+
fi
50+
51+
if [ -f $PREFIX/lib/libssl.a ]
52+
then
53+
echo "
54+
already built in $PREFIX/lib/libssl.a
55+
"
56+
else
57+
pushd $OPENSSL
58+
emconfigure ./Configure linux-generic64 \
59+
no-asm \
60+
no-engine \
61+
no-hw \
62+
no-weak-ssl-ciphers \
63+
no-dtls \
64+
no-shared \
65+
no-dso \
66+
-DPEDANTIC \
67+
--prefix="$PREFIX" --openssldir=/home/web_user
68+
69+
sed -i 's|^CROSS_COMPILE.*$|CROSS_COMPILE=|g' Makefile
70+
emmake make build_generated libssl.a libcrypto.a
71+
cp -r include/openssl "$PREFIX/include"
72+
cp libcrypto.a libssl.a "$PREFIX/lib"
73+
popd
74+
fi

0 commit comments

Comments
 (0)