-
Notifications
You must be signed in to change notification settings - Fork 0
/
dub-prebuild
executable file
·81 lines (64 loc) · 1.87 KB
/
dub-prebuild
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
#!/bin/sh
mkdir -p "$1" "$2"
BUILD_DIR=$(cd "$1" && pwd)
CACHE_DIR=$(cd "$2" && pwd)
ARCHIVES=$CACHE_DIR/archives
TOOLCHAIN=$BUILD_DIR/toolchain
PREFIX=/app/opt
CACHE_PREFIX=$CACHE_DIR/opt
mkdir -p $ARCHIVES $TOOLCHAIN $CACHE_PREFIX
if [ ! -e $PREFIX ]; then
ln -s $CACHE_PREFIX $PREFIX
fi
LIBEVENT_ARCHIVE_PATH=https://github.com/downloads/libevent/libevent
LIBEVENT_ARCHIVE=libevent-2.0.21-stable
LIBEVENT_DIR=$TOOLCHAIN/$LIBEVENT_ARCHIVE
LIBEVENT_VERSION=libevent_pthreads-2.0.so.5.1.9
LIBEV_ARCHIVE_PATH=http://dist.schmorp.de/libev
LIBEV_ARCHIVE=libev-4.15
LIBEV_DIR=$TOOLCHAIN/$LIBEV_ARCHIVE
LIBEV_VERSION=libev.so.4.0.0
echo "dub-prebuild "
# Build libevent
if [ ! -f $PREFIX/lib/$LIBEVENT_VERSION ]; then
echo " + Compile libevent"
cd $ARCHIVES
# download source
if [ ! -f $LIBEVENT_ARCHIVE.tar.gz ]; then
rm -f libevent-*.tar.gz
curl -L --retry 3 "$LIBEVENT_ARCHIVE_PATH/$LIBEVENT_ARCHIVE.tar.gz" -o $LIBEVENT_ARCHIVE.tar.gz
fi
# extract
mkdir -p $LIBEVENT_DIR
cd $LIBEVENT_DIR/..
rm -rf $LIBEVENT_DIR
tar xzf $ARCHIVES/$LIBEVENT_ARCHIVE.tar.gz
# configure and compile
cd $LIBEVENT_DIR
./configure --prefix=$PREFIX
make all install
fi
# Build libev
if [ ! -f $PREFIX/lib/$LIBEV_VERSION ]; then
echo " + Compile libev"
cd $ARCHIVES
# download source
if [ ! -f $LIBEV_ARCHIVE.tar.gz ]; then
rm -f libev-*.tar.gz
curl -L --retry 3 "$LIBEV_ARCHIVE_PATH/$LIBEV_ARCHIVE.tar.gz" -o $LIBEV_ARCHIVE.tar.gz
fi
# extract
mkdir -p $LIBEV_DIR
cd $LIBEV_DIR/..
rm -rf $LIBEV_DIR
tar xzf $ARCHIVES/$LIBEV_ARCHIVE.tar.gz
# configure and compile
cd $LIBEV_DIR
./configure --prefix=$PREFIX
make all install
fi
# Copy compiled libs to app
cp -R $CACHE_PREFIX $BUILD_DIR/opt
# Extra build to resolve initial deps
echo " + Resolving dependencies"
dub -q build