aboutsummaryrefslogtreecommitdiff
path: root/build-gnunet.sh
blob: b2337c772b873cde7c4f03059aea48d7dfb0280e (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
#!/bin/sh

die() {
  printf "%s\n" "$1"
  exit 1
}

SYSROOT=$(pwd)/gnunet/sysroot
mkdir -p "$SYSROOT"

# Build libgpg-error
LIBGPG_ERROR_TBZ2=libgpg-error-1.11.tar.bz2
LIBGPG_ERROR_SRCDIR=libgpg-error-1.11
LIBGPG_ERROR_URL=ftp://ftp.gnupg.org/gcrypt/libgpg-error/$LIBGPG_ERROR_TBZ2
if ! [ -f "downloads/$LIBGPG_ERROR_TBZ2" ]; then
  wget -P downloads "$LIBGPG_ERROR_URL" ||
    die "Unable to download $LIBGPG_ERROR_TBZ2"
fi

pushd gnunet
tar -jxf "../downloads/$LIBGPG_ERROR_TBZ2" ||
  die "Unable to extract $LIBGPG_ERROR_TBZ2"
cd "$LIBGPG_ERROR_SRCDIR"
# Build libgpg-error first using build system tools to produce generated
# header files.
./configure ||
  die "Unable to configure libgpg-error"
make ||
  die "Unable to make libgpg-error"
# Build again with emscripten, keeping generated files fresh so make won't
# rebuild them.
emconfigure ./configure --prefix="$SYSROOT" ||
  die "Unable to emconfigure libgpg-error"
touch src/mkerrcodes.h
touch src/mkerrcodes
touch src/code-from-errno.h
touch src/gpg-error.def
emmake make install ||
  die "Unable to emmake libgpg-error"
popd

# Build libgcrypt
pushd gnunet
git clone git://git.gnupg.org/libgcrypt.git ||
  die "Unable to clone libgcrypt git repository"
cd libgcrypt
./autogen.sh ||
  die "Uanble to autogen libgcrypt"
emconfigure ./configure --prefix="$SYSROOT" \
  --with-gpg-error-prefix="$SYSROOT" ||
  die "Unable to emconfigure libgcrypt"
emmake make install ||
  die "Unable to emmake libgcrypt"
popd

# vim: set expandtab ts=2 sw=2: