summaryrefslogtreecommitdiffstats
path: root/contrib/build/build.sh
blob: 99a4b437964c0d2ddfbfffc404a6b5db9c9e1deb (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
#!/bin/sh
##
## Toggle between library and non-library builds. Fix messed up libtool environment
## Build and run haveged-devel sample
##
case "$1" in
nolib)
    sed -i.bak -e '/^##libtool_start##/,/^##libtool_end##/s,^,##,g' ../../configure.ac
    sed -i.bak -e '/^####nolibtool_start##/,/^####nolibtool_end##/s,^##,,g' \
        -e '/^##libtool_start##/,/^##libtool_end##/s,^,##,g' ../../src/Makefile.am
    cp nolib.spec ../../haveged.spec
;;
lib)
    sed -i.bak -e '/^####libtool_start##/,/^####libtool_end##/s,^##,,g' ../../configure.ac
    sed -i.bak -e '/^##nolibtool_start##/,/^##nolibtool_end##/s,^,##,g' \
        -e '/^####libtool_start##/,/^####libtool_end##/s,^##,,g' ../../src/Makefile.am
    cp lib.spec ../../haveged.spec
;;
new)
    cd ../..
    make distclean
    rm -rf autom4te.cache
    libtoolize --force --install
    autoreconf --force
    ./configure
;;
sample)
    echo "gcc -o havege_sample -DUSE_SOURCE -I../../src -Wall havege_sample.c ../../src/.libs/libhavege.a"
    gcc -o havege_sample -DUSE_SOURCE -I../../src -Wall havege_sample.c ../../src/.libs/libhavege.a
    echo "./havege_sample > /dev/null"
    ./havege_sample > /dev/null
;;

*)
    echo "usage: build [new|nolib|lib|sample]";
;;
esac