Skip to content

Commit

Permalink
separate script for deps
Browse files Browse the repository at this point in the history
  • Loading branch information
pmp-p committed Feb 13, 2023
1 parent 63d03ea commit 06f80e9
Show file tree
Hide file tree
Showing 2 changed files with 180 additions and 0 deletions.
106 changes: 106 additions & 0 deletions sources.wasm/ncurses.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#!/bin/bash

. ${CONFIG:-config}

# --disable-database --enable-termcap

NCOPTS="--enable-ext-colors --enable-ext-mouse --prefix=$PREFIX --disable-echo --without-pthread \
--without-tests --without-tack --without-progs --without-manpages \
--disable-db-install --without-cxx --without-cxx-binding --enable-pc-files \
--with-pkg-config-libdir=$PREFIX/lib/pkgconfig \
--with-termlib --enable-termcap --disable-database"


export NCURSES=${NCURSES:-"ncurses-6.1"}
export URL_NCURSES=${URL_NCURSES:-"URL https://ftp.NCURSES.org/source/$NCURSES.tar.gz"}
export HASH_NCURSES=${HASH_NCURSES:-"URL_HASH SHA256=aa057eeeb4a14d470101eff4597d5833dcef5965331be3528c08d99cebaa0d17"}



if true
then

wget -q -c $URL_NCURSES && tar xfz $NCURSES.tar.gz

pushd $NCURSES
[ -f $NCURSES.done ] || patch -p1 < $ROOT/support/__EMSCRIPTEN__.deps/ncurses-6.1_emscripten.patch
touch $NCURSES.done
popd


cd $ROOT

if [ -f devices/emsdk/usr/lib/libncursesw.a ]
then
echo "
* ncursesw already built
" 1>&2
else
mkdir -p build/ncurses/

# build wide char
rm -rf build/ncurses/*

pushd build/ncurses
make clean
CC=clang CFLAGS="-fpic -Wno-unused-command-line-argument" $ROOT/src/ncurses-6.1/configure \
$NCOPTS --enable-widec && make && make install

popd
fi



if false #[ -f ../devices/emsdk/usr/lib/libncurses.a ]
then
echo "
* skiping [ncurses] or already built
" 1>&2
else
rm -rf ../build/ncurses/*
pushd ../build/ncurses

CC=clang CFLAGS="-fpic -Wno-unused-command-line-argument" $ROOT/src/ncurses-6.1/configure \
$NCOPTS && make && make install

CFLAGS="-fpic -Wno-unused-command-line-argument" emconfigure \
$ROOT/src/ncurses-6.1/configure \
$NCOPTS

if patch -p1 < $ROOT/support/__EMSCRIPTEN__.deps/ncurses-6.1_emscripten_make.patch
then
emmake make clean
if emmake make
then
emmake make install
fi
fi
popd
fi


if [ -f ../devices/emsdk/usr/lib/libncursesw.a ]
then
echo "
* ncursesw already built
" 1>&2
else
# build wide char
pushd ../build/ncurses

CFLAGS="-fpic -Wno-unused-command-line-argument" emconfigure \
$ROOT/src/ncurses-6.1/configure $NCOPTS --enable-widec

if patch -p1 < $SDKROOT/support/__EMSCRIPTEN__.deps/ncurses-6.1_emscripten_makew.patch
then
emmake make clean
if emmake make
then
emmake make install
fi
fi
popd
fi

fi

74 changes: 74 additions & 0 deletions sources.wasm/openssl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/bin/bash

. ${CONFIG:-config}

export OPENSSL="openssl-1.1.1s"
export URL_OPENSSL=${URL_OPENSSL:-"URL https://ftp.openssl.org/source/$OPENSSL.tar.gz"}
export HASH_OPENSSL="URL_HASH SHA256=c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa"

. scripts/emsdk-fetch.sh

if [ -f openssl.patched ]
then
echo "
already patched for $PREFIX
"
else
wget -c $URL_OPENSSL
tar xvfz $OPENSSL.tar.gz
pushd $OPENSSL
patch -p1 <<END
--- openssl-1.1.1n/Configurations/10-main.conf 2022-03-15 14:37:47.000000000 +0000
+++ openssl-1.1.1n-fixed/Configurations/10-main.conf 2022-04-05 10:48:27.348576840 +0000
@@ -657,7 +657,8 @@
},
"linux-generic64" => {
inherit_from => [ "linux-generic32" ],
- bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
+ bn_ops => "SIXTY_FOUR_BIT RC4_CHAR",
+ lib_cppflags => add("-DBN_DIV2W"),
},
"linux-ppc" => {
diff -urN openssl-1.1.1n/crypto/rand/rand_unix.c openssl-1.1.1n-fixed/crypto/rand/rand_unix.c
--- openssl-1.1.1n/crypto/rand/rand_unix.c 2022-04-05 10:54:21.980130409 +0000
+++ openssl-1.1.1n-fixed/crypto/rand/rand_unix.c 2022-04-05 09:27:47.960526811 +0000
@@ -369,7 +369,7 @@
* Note: Sometimes getentropy() can be provided but not implemented
* internally. So we need to check errno for ENOSYS
*/
-# if defined(__GNUC__) && __GNUC__>=2 && defined(__ELF__) && !defined(__hpux)
+# if defined(__EMSCRIPTEN__)
extern int getentropy(void *buffer, size_t length) __attribute__((weak));
if (getentropy != NULL) {
END

touch ../openssl.patched
popd
fi

if [ -f $PREFIX/lib/libssl.a ]
then
echo "
already built in $PREFIX/lib/libssl.a
"
else
pushd $OPENSSL
emconfigure ./Configure linux-generic64 \
no-asm \
no-engine \
no-hw \
no-weak-ssl-ciphers \
no-dtls \
no-shared \
no-dso \
-DPEDANTIC \
--prefix="$PREFIX" --openssldir=/home/web_user

sed -i 's|^CROSS_COMPILE.*$|CROSS_COMPILE=|g' Makefile
emmake make build_generated libssl.a libcrypto.a
cp -r include/openssl "$PREFIX/include"
cp libcrypto.a libssl.a "$PREFIX/lib"
popd
fi

0 comments on commit 06f80e9

Please sign in to comment.