summaryrefslogtreecommitdiff
path: root/tools/nightly
blob: c5b96acb30d9ff68fe20dbb8755d922ac53dd774 (plain) (blame)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/bash -e
#
# The buildbot script is only intended to run on Debian amd64
#

WWW=${HOME}/www/

# the cross-toolchain repo doesn't have gcc-defaults, so we have
# to specify the suffix.
CROSS_VERSION_SUFFIX=-4.9
BUILD=x86_64-linux-gnu

ALL_HOSTS=(
    x86_64-linux-gnu
    i586-linux-gnu
# x32 requires a recent kernel with appropriate flags.
# On Debian, boot with 'syscall.x32=y' on the kernel command line
# (see GRUB_CMDLINE_LINUX in /etc/default/grub)
    #x86_64-linux-gnux32
# Cross arches can be built by enabling multiarch, then installing from the
# toolchain repo at http://toolchains.secretsauce.net/
# Executables can be run via qemu-user, but tests that require gdb fail
# (NYI: implement configure with GDB=/bin/true)
# Bug 762073 notes impossible coinstallation of mips, mipsel, and powerpc.
# dpkg-divert can only fix *one* of them.
    #aarch64-linux-gnu
    #arm-linux-gnueabi
    #arm-linux-gnueabihf
    #mips-linux-gnu
    #mipsel-linux-gnu
    #powerpc-linux-gnu
)

config---help() {
    set +x
    echo 'Usage: tools/nightly <list of arches>'
    echo 'Arches are:'
    echo x86_64-linux-gnu
    echo i586-linux-gnu
    echo x86_64-linux-gnux32
    echo aarch64-linux-gnu
    echo arm-linux-gnueabi
    echo arm-linux-gnueabihf
    echo mips-linux-gnu
    echo mipsel-linux-gnu
    echo powerpc-linux-gnu
    exit
}

common-config() {
    # HOST is set by the calling function
    CXX=$HOST-g++$CROSS_VERSION_SUFFIX
    EXTRA_LIBS=(
        /lib/$HOST/libc.so.6
        /lib/$HOST/libm.so.6
        /lib/$HOST/libgcc_s.so.1
        /usr/lib/$HOST/libstdc++.so.6
    )
    GDB=/bin/true
}


config-x86_64-linux-gnu () {
    CROSS_VERSION_SUFFIX='' common-config
    GDB=gdb
}

config-i586-linux-gnu () {
    # No one knows what number this is supposed to be:
    # - the lib directory is called i386-linux-gnu
    # - the 32-bit files are called i486-linux-gnu
    # - the cross-32 configury says i586
    CXX=$BUILD-'g++ -m32'
    EXTRA_LIBS=(
        /lib32/libc.so.6
        /lib32/libm.so.6
        /usr/lib32/libgcc_s.so.1
        /usr/lib32/libstdc++.so.6
    )
    GDB=gdb
}

config-x86_64-linux-gnux32 () {
    CXX=$BUILD-'g++ -mx32'
    EXTRA_LIBS=(
        /libx32/libc.so.6
        /libx32/libm.so.6
        /usr/libx32/libgcc_s.so.1
        /usr/libx32/libstdc++.so.6
    )
    GDB=gdb
}

config-aarch64-linux-gnu () {
    common-config
}

config-arm-linux-gnueabi () {
    common-config
}

config-arm-linux-gnueabihf () {
    common-config
}

config-mips-linux-gnu () {
    common-config
}

config-mipsel-linux-gnu () {
    common-config
}

config-powerpc-linux-gnu () {
    common-config
}

first=true

set -x
for HOST in ${@:-${ALL_HOSTS[@]}}
do
    config-$HOST
    mkdir -p build-$HOST
    cd build-$HOST
    ../configure --build=$BUILD --host=$HOST CXX="$CXX -Wno-deprecated-declarations -DQUIET" --prefix=/. --enable-rpath=relative GDB=$GDB
    rm -rf bin lib
    make -j3 all
    make -j3 test
    if $first
    then
        make -j3 dist
        first=false
    fi
    make -j3 bindist BUNDLED_LIBS="${EXTRA_LIBS[*]}"
    gzip -n -9 dist/*.tar
    mv dist/*.tar.gz $WWW
    cd ..
done