summaryrefslogtreecommitdiff
path: root/thirdparty/gnupg/build_gnupg.sh
blob: e125b684fa7c5d8e5a0967667106570b9ce542dd (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
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env sh

# ----------------------------------------------------------
# Compile gnupg binary, to distribute with Bitmask bundles.
# ----------------------------------------------------------
# You will need to import the keys for the gnupg developers into your keyring,
# see https://www.gnupg.org/download/integrity_check.html
# and https://www.gnupg.org/signature_key.html

# For osx specific details, see:
# http://macgpg.sourceforge.net/docs/howto-build-gpg-osx.txt.asc
# osx doesn't allow to build static binaries, see:
# http://stackoverflow.com/questions/5259249/creating-static-mac-os-x-c-build

set -e
set -x

gnupg_version="gnupg-1.4.20"
url="ftp://ftp.gnupg.org/gcrypt/gnupg/$gnupg_version.tar.bz2"

platform='unknown'
unamestr=`uname`
if [[ "$unamestr" == 'Linux' ]]; then
   platform='linux'
elif [[ "$unamestr" == 'Darwin' ]]; then
   platform='osx'
fi

function prepare_source()
{
    wget -c $url -O $gnupg_version.tar.bz2;
    wget -c $url.sig -O $gnupg_version.tar.bz2.sig;
    #gpg --verify $gnupg_version.tar.bz2.sig $gnupg_version.tar.bz2;
    tar -xjf $gnupg_version.tar.bz2;
    cd $gnupg_version;
}


function build_static_gpg()
{
    ./configure CFLAGS="-static";
    make;
}

function build_gpg()
{
    ./configure;
    make;
}

function copy_to_builddir()
{
    mkdir -p ~/leap_thirdparty_build
    cp g10/gpg ~/leap_thirdparty_build
}

function main()
{
    if [[ $platform == 'linux' ]]; then
        (prepare_source; build_static_gpg; copy_to_builddir)
    elif [[ $platform == 'osx' ]]; then
        (prepare_source; build_gpg; copy_to_builddir)
    fi

}

main "$@"