1#!/bin/bash -eu
2# Copyright 2017 Google Inc.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16################################################################################
17
18tar -xJf $SRC/zlib-1.2.11.tar.xz
19pushd zlib-1.2.11
20./configure --static
21make -j$(nproc)
22export ZLIB_CFLAGS="-I$(pwd)"
23export ZLIB_LIBS="-L$(pwd) -lz"
24popd
25
26tar -xzf $SRC/lcms2-2.8.tar.gz
27pushd lcms2-2.8
28./configure --disable-shared --enable-static --without-jpeg --without-tiff
29make -C src -j$(nproc)
30export LCMS2_CFLAGS="-I$(pwd)/include"
31export LCMS2_LIBS="-L$(pwd)/src -llcms2"
32popd
33
34tar -xJf $SRC/libpng-1.6.34.tar.xz
35pushd libpng-1.6.34
36./configure --disable-shared --enable-static CPPFLAGS="$ZLIB_CFLAGS" LDFLAGS="$ZLIB_LIBS"
37make -j$(nproc)
38export LIBPNG_CFLAGS="-I$(pwd)"
39export LIBPNG_LIBS="-L$(pwd) -lpng16"
40popd
41
42tar -xzf $SRC/libxml2-2.9.7.tar.gz
43pushd libxml2-2.9.7
44./configure --disable-shared --enable-static --disable-ipv6 --without-python --without-zlib --without-lzma
45make -j$(nproc)
46export LIBXML_CFLAGS="-I$(pwd)/include"
47export LIBXML_LIBS="-L$(pwd) -lxml2"
48export XML_CFLAGS="$LIBXML_CFLAGS"
49export XML_LIBS="$LIBXML_LIBS"
50popd
51
52tar -xzf $SRC/icu4c-60_2-src.tgz
53pushd icu/source
54patch -p2 < $SRC/icu4c-ubsan.patch
55patch -p3 < $SRC/ofz3670.patch
56patch -p3 < $SRC/ofz4860.patch
57./configure --disable-shared --enable-static --with-data-packaging=static --disable-dyload --disable-strict \
58    --disable-layout --disable-samples --disable-extras --disable-icuio --disable-plugins \
59    CPPFLAGS=-DU_USE_STRTOD_L=0
60make -j$(nproc)
61export ICU_CFLAGS="-I$(pwd) -I$(pwd)/i18n -I$(pwd)/common"
62export ICU_LIBS="-L$(pwd)/lib -licui18n -licuuc -licudata"
63popd
64
65tar -xjf $SRC/boost_1_66_0.tar.bz2
66pushd boost_1_66_0
67patch -p2 < $SRC/ofz2894.patch
68patch -p2 < $SRC/ofz4303.patch
69export CPPFLAGS="-I$(pwd)"
70popd
71
72tar -xjf $SRC/mdds-1.3.1.tar.bz2
73pushd mdds-1.3.1
74./configure
75export MDDS_CFLAGS="-I$(pwd)/include"
76export MDDS_LIBS=' '
77popd
78
79pushd librevenge
80./autogen.sh
81./configure --without-docs --disable-werror --disable-shared --enable-static --disable-tests --enable-fuzzers
82make -j$(nproc)
83rvnginc=$(pwd)/inc
84rvnglib=$(pwd)/src/lib
85export REVENGE_CFLAGS="-I$(pwd)/inc"
86export REVENGE_LIBS="-L$(pwd)/src/lib -lrevenge-0.0"
87export REVENGE_STREAM_CFLAGS="-I$(pwd)/inc"
88export REVENGE_STREAM_LIBS="-L$(pwd)/src/lib -lrevenge-stream-0.0"
89export REVENGE_GENERATORS_CFLAGS="-I$(pwd)/inc"
90export REVENGE_GENERATORS_LIBS="-L$(pwd)/src/lib -lrevenge-generators-0.0"
91popd
92
93pushd libmspub
94./autogen.sh
95./configure --without-docs --disable-werror --disable-shared --enable-static --disable-tools --enable-fuzzers
96make -j$(nproc)
97popd
98
99pushd libcdr
100./autogen.sh
101./configure --without-docs --disable-werror --disable-shared --enable-static --disable-tools --enable-fuzzers --disable-tests
102make -j$(nproc)
103popd
104
105pushd libvisio
106./autogen.sh
107./configure --without-docs --disable-werror --disable-shared --enable-static --disable-tools --enable-fuzzers --disable-tests
108make -j$(nproc)
109popd
110
111pushd libzmf
112./autogen.sh
113./configure --without-docs --disable-werror --disable-shared --enable-static --disable-tools --enable-fuzzers --disable-tests
114make -j$(nproc)
115popd
116
117pushd libpagemaker
118./autogen.sh
119./configure --without-docs --disable-werror --disable-shared --enable-static --disable-tools --enable-fuzzers
120make -j$(nproc)
121popd
122
123pushd libfreehand
124./autogen.sh
125./configure --without-docs --disable-werror --disable-shared --enable-static --disable-tools --enable-fuzzers --disable-tests
126make -j$(nproc)
127popd
128
129pushd libwpd
130./autogen.sh
131./configure --without-docs --disable-werror --disable-shared --enable-static --disable-tools --enable-fuzzers
132make -j$(nproc)
133export WPD_CFLAGS=-I$(pwd)/inc
134export WPD_LIBS="-L$(pwd)/src/lib -lwpd-0.10"
135popd
136
137pushd libwpg
138./autogen.sh
139./configure --without-docs --disable-werror --disable-shared --enable-static --disable-tools --enable-fuzzers
140make -j$(nproc)
141popd
142
143pushd libstaroffice
144./autogen.sh
145./configure --without-docs --disable-werror --disable-shared --enable-static --disable-tools --enable-fuzzers
146make -j$(nproc)
147popd
148
149pushd libwps
150./autogen.sh
151./configure --without-docs --disable-werror --disable-shared --enable-static --disable-tools --enable-fuzzers
152make -j$(nproc)
153popd
154
155pushd libmwaw
156./autogen.sh
157./configure --without-docs --disable-werror --disable-shared --enable-static --disable-tools --disable-zip --enable-fuzzers
158make -C src/lib -j$(nproc)
159# Link with less parallelism to avoid memory problems on the builders
160make -j2
161popd
162
163pushd libe-book
164./autogen.sh
165./configure --without-docs --disable-werror --disable-shared --enable-static \
166    --without-tools --enable-fuzzers --without-liblangtag --disable-tests
167make -j$(nproc)
168popd
169
170pushd libabw
171./autogen.sh
172./configure --without-docs --disable-werror --disable-shared --enable-static --disable-tools --enable-fuzzers
173make -j$(nproc)
174popd
175
176pushd libetonyek
177./autogen.sh
178./configure --without-docs --disable-werror --disable-shared --enable-static \
179    --without-tools --enable-fuzzers --with-mdds=0.x --without-liblangtag --disable-tests
180make -j$(nproc)
181popd
182
183pushd libqxp
184./autogen.sh
185./configure --without-docs --disable-werror --disable-shared --enable-static --disable-tools --enable-fuzzers --disable-tests
186make -j$(nproc)
187popd
188
189cp */src/fuzz/*fuzzer $OUT
190cp */src/fuzz/*.dict $OUT
191cp *_seed_corpus.zip $OUT
192cp *.options $OUT
193