Skip to content

Commit 2a12ea8

Browse files
benlaurieAlCutter
authored andcommitted
Reproducible build using gclient.
1 parent 879395c commit 2a12ea8

25 files changed

+461
-18
lines changed

DEPS

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
deps = {
2+
"gflags": "https://github.com/gflags/gflags.git@v2.1.2",
3+
"glog": "https://github.com/google/glog.git@v0.3.4",
4+
"gperftools": "https://github.com/gperftools/gperftools.git@gperftools-2.4",
5+
"googlemock": "https://github.com/google/googlemock.git@release-1.7.0",
6+
"googlemock/gtest": "https://github.com/google/googletest.git@release-1.7.0",
7+
"json-c": "https://github.com/json-c/json-c.git@json-c-0.12-20140410",
8+
"ldns": "git://git.nlnetlabs.nl/ldns@release-1.6.17",
9+
"leveldb": "https://github.com/google/leveldb.git@v1.18",
10+
"libevent": "https://github.com/libevent/libevent.git@release-2.0.22-stable",
11+
"libevhtp": "https://github.com/ellzey/libevhtp.git@ba4c44eed1fb7a5cf8e4deb236af4f7675cc72d5",
12+
"openssl": "https://github.com/benlaurie/openssl.git@fd5d2ba5e09f86e9ccf797dddd2d09ac8e197e35", # 1.0.2-freebsd
13+
"protobuf/gtest": "https://github.com/google/googletest.git@release-1.5.0",
14+
"protobuf": "https://github.com/google/protobuf.git@v2.6.1",
15+
# Randomly chosen github mirror
16+
"sqlite3-export": "http://repo.or.cz/sqlite-export.git",
17+
"sqlite3": "http://repo.or.cz/sqlite.git@version-3.8.10.1",
18+
"tcmalloc": "https://github.com/gperftools/gperftools.git@gperftools-2.4"
19+
}
20+
21+
# Can't use deps_os for this because it doesn't know about freebsd :/
22+
deps_overrides = {
23+
"freebsd10": {
24+
"googlemock": "https://github.com/AlCutter/googlemock-fbsd.git@1.7.0",
25+
"googlemock/gtest": "https://github.com/AlCutter/googletest-fbsd.git@1.7.0",
26+
"protobuf/gtest": "https://github.com/benlaurie/googletest.git@1.5.0-fix",
27+
"protobuf": "https://github.com/benlaurie/protobuf.git@2.6.1-fix",
28+
"glog": "https://github.com/benlaurie/glog.git@0.3.4-fix",
29+
"ldns": "https://github.com/benlaurie/ldns.git@1.6.17-fix",
30+
},
31+
"darwin": {
32+
"ldns": "https://github.com/benlaurie/ldns.git@1.6.17-fix",
33+
}
34+
}
35+
36+
make_os = {
37+
"freebsd10": "gmake",
38+
"darwin": "gnumake"
39+
}
40+
41+
import os
42+
import sys
43+
44+
print "Host platform is %s" % sys.platform
45+
if sys.platform in deps_overrides:
46+
print "Have %d overrides for platform" % len(deps_overrides[sys.platform])
47+
deps.update(deps_overrides[sys.platform])
48+
if sys.platform in make_os:
49+
make = make_os[sys.platform]
50+
else:
51+
make = "make"
52+
print "Using make %s" % make
53+
54+
here = os.getcwd()
55+
install = os.path.join(here, "install")
56+
57+
hooks = [
58+
{
59+
"name": "deps",
60+
"pattern": ".",
61+
"action": [ make, "-f", os.path.join(here, "certificate-transparency/build.gclient"), "INSTALL_DIR=%s"%install],
62+
},
63+
]

Makefile.am

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ BUILT_SOURCES = \
1717

1818
BUILD_VERSION = `git describe --abbrev=0 --dirty --always --tags`
1919

20+
AM_TESTS_ENVIRONMENT = \
21+
export LD_LIBRARY_PATH=$(LIBRARY_PATH);
22+
2023
.PHONY: cpp/version.cc
2124
cpp/version.o: \
2225
CXXFLAGS+=-DBUILD_VERSION="\"$(BUILD_VERSION)\""
@@ -92,7 +95,7 @@ TESTS = \
9295
cpp/util/thread_pool_test
9396

9497
all-local:
95-
$(MAKE) -C python
98+
$(MAKE) -C python PROTOC=$(PROTOC)
9699

97100
clean-local:
98101
$(MAKE) -C python clean
@@ -101,7 +104,7 @@ if HAVE_ANT
101104
endif
102105

103106
%.pb.h %.pb.cc: %.proto
104-
$(AM_V_GEN)protoc $^ --cpp_out=.
107+
$(AM_V_GEN)$(PROTOC) $^ --cpp_out=.
105108

106109
cpp/gtest-all.cc: $(GTEST_DIR)/src/gtest-all.cc
107110
$(AM_V_at)cp $^ $@

README.md

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Build CT server C++ code:
4949
./configure GTEST_DIR=../gmock-1.7.0/gtest GMOCK_DIR=../gmock-1.7.0 \
5050
CPPFLAGS="-I../libevhtp-1.2.10 -I../libevhtp-1.2.10/evthr \
5151
-I../libevhtp-1.2.10/htparse" LDFLAGS=-L../libevhtp-1.2.10
52-
make check
52+
make check
5353

5454
Build and test Java code:
5555

@@ -61,13 +61,56 @@ Build and test Python code:
6161

6262
Best and test Go code:
6363

64-
go test -v ./go/...
64+
go test -v ./go/...
6565

6666

6767
## Dependencies ##
6868

6969
- A working C++11 compiler.
7070

71+
- autoconf/automake etc.
72+
- cmake
73+
- git
74+
- GNU make
75+
- libtool
76+
- Tcl
77+
- pkgconf
78+
- python27
79+
- [depot_tools](https://www.chromium.org/developers/how-tos/install-depot-tools)
80+
81+
## Building with gclient ##
82+
83+
This is the recommended method for all platforms as it gives you a reproducible
84+
build.
85+
86+
Known to work on FreeBSD 10, OS X (10.10) [tested with XCode + brew installation
87+
of above deps], and Ubuntu 14.04.
88+
89+
```bash
90+
mkdir ct # or whatever directory you prefer
91+
cd ct
92+
gclient config git@github.com:google/certificate-transparency.git
93+
gclient sync
94+
# substitute gmake or gnumake below if that's that your platform calls it:
95+
make -C certificate-transparency check
96+
```
97+
98+
If you're trying to clone from a branch on the CT repo then you'll need to
99+
substitute the following command for the `gclient config` command above,
100+
replacing `branch` as appropriate
101+
102+
```bash
103+
gclient config --name="certificate-transparency" git@github.com:google/certificate-transparency.git@branch
104+
```
105+
106+
To run any of the built binaries you'll need to:
107+
108+
```bash
109+
export LD_LIBRARY_PATH=/path/to/ct/install/lib'
110+
```
111+
112+
## Old Method ##
113+
71114
- [OpenSSL](https://www.openssl.org/source/), at least 1.0.0q,
72115
preferably 1.0.1l or 1.0.2 (and up)
73116
@@ -96,9 +139,9 @@ If you are on FreeBSD, you may need to apply the patch in gtest.patch
96139
to the gtest subdirectory of gmock.
97140
98141
- [protobuf](https://github.com/google/protobuf) (tested with 2.5.0)
99-
- [gflags](https://code.google.com/p/gflags/) (tested with 1.6
142+
- [gflags](https://github.com/gflags/gflags) (tested with 1.6
100143
and 2.0)
101-
- [glog](https://code.google.com/p/google-glog/) (tested with 0.3.1)
144+
- [glog](https://github.com/google/glog) (tested with 0.3.1)
102145
103146
Make sure to install glog **after** gflags, to avoid linking errors.
104147

build.gclient

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# TODO(pphaneuf): Make this be good.
2+
3+
.PHONY: configure-ct openssl protobuf libevent libevhtp gflags glog ldns sqlite3 leveldb json-c tcmalloc
4+
5+
all: configure-ct
6+
7+
tcmalloc:
8+
$(MAKE) -C tcmalloc -f ../certificate-transparency/build/Makefile.tcmalloc
9+
10+
openssl:
11+
make -C openssl -f `pwd`/certificate-transparency/build/Makefile.openssl INSTALL_DIR=$(INSTALL_DIR)
12+
13+
# TODO(alcutter): convert the remaining scripts to Makefiles
14+
protobuf:
15+
certificate-transparency/build/rebuild_protobuf
16+
17+
libevent:
18+
certificate-transparency/build/rebuild_libevent
19+
20+
libevhtp:
21+
certificate-transparency/build/rebuild_libevhtp
22+
23+
gflags:
24+
$(MAKE) -C gflags -f ../certificate-transparency/build/Makefile.gflags
25+
26+
glog:
27+
$(MAKE) -C glog -f ../certificate-transparency/build/Makefile.glog
28+
29+
ldns:
30+
$(MAKE) -C ldns -f ../certificate-transparency/build/Makefile.ldns
31+
32+
sqlite3:
33+
$(MAKE) -C sqlite3 -f ../certificate-transparency/build/Makefile.sqlite3
34+
35+
leveldb:
36+
$(MAKE) -C leveldb -f ../certificate-transparency/build/Makefile.leveldb
37+
38+
json-c:
39+
certificate-transparency/build/rebuild_json-c
40+
41+
configure-ct: tcmalloc openssl protobuf libevent libevhtp gflags glog ldns sqlite3 leveldb json-c
42+
certificate-transparency/build/configure-ct INSTALL_DIR=$(INSTALL_DIR)

build/Makefile.gflags

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
all: make
2+
3+
make: build/Makefile
4+
# INSTALL says to run make test, but there's no such target
5+
cd build && $(MAKE) && $(MAKE) install
6+
7+
build/Makefile: build
8+
cd build && cmake -DCMAKE_CXX_FLAGS:STRING=-fPIC -DCMAKE_INSTALL_PREFIX=`pwd`/../../install ..
9+
10+
build:
11+
mkdir build

build/Makefile.glog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
all: Makefile
2+
$(MAKE)
3+
# FIXME: for now, install even though checks fail on FreeBSD
4+
# make check
5+
$(MAKE) install
6+
7+
Makefile: configure
8+
./configure --with-gflags=`pwd`/../gflags --prefix=`pwd`/../install
9+
10+
configure: configure.ac
11+
autoreconf -i

build/Makefile.ldns

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
LIBTOOLIZE_TEST=$(shell libtoolize --version >/dev/null 2>&1 && echo found)
2+
LIBTOOLIZE_BIN=libtoolize
3+
ifneq ("$(LIBTOOLIZE_TEST)","found")
4+
LIBTOOLIZE_BIN=glibtoolize
5+
endif
6+
INSTALL_DIR=$(shell pwd)/../install
7+
8+
all: Makefile
9+
$(MAKE)
10+
# FIXME: skip test for now, requires dig, which FreeBSD doesn't have.
11+
# make test
12+
$(MAKE) install
13+
14+
Makefile: configure
15+
CPPFLAGS="-I$(INSTALL_DIR)/include" LDFLAGS="-L$(INSTALL_DIR)/lib" ./configure --prefix=$(INSTALL_DIR) --with-ssl=$(INSTALL_DIR)
16+
17+
configure:
18+
$(LIBTOOLIZE_BIN) -c --install
19+
autoreconf --install

build/Makefile.leveldb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#GNUMAKE_BIN=gnumake
2+
#GNUMAKE_TEST=$(shell $GNUMAKE_BIN --version >/dev/null 2>&1 && echo found)
3+
#ifneq ("$(GNUMAKE_TEST)","found")
4+
#GNUMAKE_BIN=gmake
5+
#endif
6+
#GNUMAKE_TEST=$(shell $GNUMAKE_BIN --version >/dev/null 2>&1 && echo found)
7+
#ifneq ("$(GNUMAKE_TEST)","found")
8+
#GNUMAKE_BIN=make
9+
#endif
10+
11+
12+
all:
13+
$(MAKE)
14+
cp lib* ../install/lib
15+
mkdir -p ../install/include/leveldb
16+
cp include/leveldb/*.h ../install/include/leveldb

build/Makefile.openssl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
all: $(INSTALL_DIR)/bin/openssl
2+
3+
$(INSTALL_DIR)/bin/openssl: Makefile
4+
$(MAKE)
5+
$(MAKE) test
6+
$(MAKE) install
7+
8+
Makefile: config Configure Makefile.org
9+
# Force a 64 bit build on MacOS
10+
KERNEL_BITS=64 ./config --openssldir=$(INSTALL_DIR) shared
11+
# just to be sure we don't have dregs left over
12+
$(MAKE) clean

build/Makefile.sqlite3

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
all: install
2+
3+
install: Makefile manifest
4+
$(MAKE)
5+
$(MAKE) sqlite3.c
6+
# FIXME: test fails on FreeBSD at least
7+
#$(MAKE) test
8+
#$(MAKE) install DESTDIR=`pwd`/../install
9+
$(MAKE) install
10+
11+
Makefile: Makefile.in configure
12+
# Tcl doesn't install locally
13+
CFLAGS="-fPIC" LDFLAGS="-fPIC" ./configure --prefix=`pwd`/../install --disable-tcl
14+
15+
manifest:
16+
../sqlite3-export/create-fossil-manifest

0 commit comments

Comments
 (0)