Skip to content

Commit

Permalink
native windows executables using gitian. win32 and win64.
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelfreitas committed Jul 9, 2014
1 parent f457d9d commit ac9e5f5
Show file tree
Hide file tree
Showing 13 changed files with 538 additions and 379 deletions.
86 changes: 0 additions & 86 deletions contrib/gitian-descriptors/README

This file was deleted.

67 changes: 67 additions & 0 deletions contrib/gitian-descriptors/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
### Gavin's notes on getting gitian builds up and running using KVM:###

These instructions distilled from:
[ https://help.ubuntu.com/community/KVM/Installation]( https://help.ubuntu.com/community/KVM/Installation)
... see there for complete details.

You need the right hardware: you need a 64-bit-capable CPU with hardware virtualization support (Intel VT-x or AMD-V). Not all modern CPUs support hardware virtualization.

You probably need to enable hardware virtualization in your machine's BIOS.

You need to be running a recent version of 64-bit-Ubuntu, and you need to install several prerequisites:

sudo apt-get install ruby apache2 git apt-cacher-ng python-vm-builder qemu-kvm

Sanity checks:

sudo service apt-cacher-ng status # Should return apt-cacher-ng is running
ls -l /dev/kvm # Should show a /dev/kvm device


Once you've got the right hardware and software:

git clone git://github.com/bitcoin/bitcoin.git
git clone git://github.com/devrandom/gitian-builder.git
mkdir gitian-builder/inputs
cd gitian-builder/inputs

# Create base images
cd gitian-builder
bin/make-base-vm --suite precise --arch i386
bin/make-base-vm --suite precise --arch amd64
cd ..

# Get inputs (see doc/release-process.md for exact inputs needed and where to get them)
...

# For further build instructions see doc/release-notes.md
...

---------------------

`gitian-builder` now also supports building using LXC. See
[ https://help.ubuntu.com/12.04/serverguide/lxc.html]( https://help.ubuntu.com/12.04/serverguide/lxc.html)
... for how to get LXC up and running under Ubuntu.

If your main machine is a 64-bit Mac or PC with a few gigabytes of memory
and at least 10 gigabytes of free disk space, you can `gitian-build` using
LXC running inside a virtual machine.

Here's a description of Gavin's setup on OSX 10.6:

1. Download and install VirtualBox from [https://www.virtualbox.org/](https://www.virtualbox.org/)

2. Download the 64-bit Ubuntu Desktop 12.04 LTS .iso CD image from
[http://www.ubuntu.com/](http://www.ubuntu.com/)

3. Run VirtualBox and create a new virtual machine, using the Ubuntu .iso (see the [VirtualBox documentation](https://www.virtualbox.org/wiki/Documentation) for details). Create it with at least 2 gigabytes of memory and a disk that is at least 20 gigabytes big.

4. Inside the running Ubuntu desktop, install:

sudo apt-get install debootstrap lxc ruby apache2 git apt-cacher-ng python-vm-builder

5. Still inside Ubuntu, tell gitian-builder to use LXC, then follow the "Once you've got the right hardware and software" instructions above:

export USE_LXC=1
git clone git://github.com/bitcoin/bitcoin.git
... etc
55 changes: 55 additions & 0 deletions contrib/gitian-descriptors/boost-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
name: "boost"
suites:
- "precise"
architectures:
- "i386"
- "amd64"
packages:
- "g++"
- "unzip"
- "pkg-config"
- "libtool"
- "faketime"
- "bsdmainutils"
- "zip"
- "libz-dev"
reference_datetime: "2011-01-30 00:00:00"
remotes: []
files:
- "boost_1_55_0.tar.bz2"
script: |
STAGING="$HOME/install"
TEMPDIR="$HOME/tmp"
export LIBRARY_PATH="$STAGING/lib"
export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
export FAKETIME=$REFERENCE_DATETIME
export TZ=UTC
# Input Integrity Check
echo "fff00023dd79486d444c8e29922f4072e1d451fc5a4d2b6075852ead7f2b7b52 boost_1_55_0.tar.bz2" | shasum -c
mkdir -p "$STAGING"
tar --warning=no-timestamp -xjf boost_1_55_0.tar.bz2
cd boost_1_55_0
GCCVERSION=$(g++ -E -dM $(mktemp --suffix=.h) | grep __VERSION__ | cut -d ' ' -f 3 | cut -d '"' -f 2)
# note: bjam with -d+2 reveals that -O3 is implied by default, no need to provide it in cxxflags
echo "using gcc : $GCCVERSION : g++
:
<cxxflags>\"-frandom-seed=boost1 -fPIC\"
;" > user-config.jam
./bootstrap.sh --without-icu
./bjam toolset=gcc threadapi=pthread threading=multi variant=release link=static runtime-link=shared --user-config=user-config.jam --without-mpi --without-python -sNO_BZIP2=1 --layout=tagged --build-type=complete --prefix="$STAGING" $MAKEOPTS -d+2 install
# post-process all generated libraries to be deterministic
# extract them to a temporary directory then re-build them deterministically
for LIB in $(find $STAGING -name \*.a); do
rm -rf $TEMPDIR && mkdir $TEMPDIR && cd $TEMPDIR
ar xv $LIB | cut -b5- > /tmp/list.txt
rm $LIB
ar crsD $LIB $(cat /tmp/list.txt)
done
#
cd "$STAGING"
find | sort | zip -X@ $OUTDIR/boost-linux${GBUILD_BITS}-1.55.0-gitian-r1.zip
86 changes: 86 additions & 0 deletions contrib/gitian-descriptors/boost-win.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
name: "boost"
suites:
- "precise"
architectures:
- "amd64"
packages:
- "mingw-w64"
- "g++-mingw-w64"
- "faketime"
- "zip"
reference_datetime: "2011-01-30 00:00:00"
remotes: []
files:
- "boost_1_55_0.tar.bz2"
- "boost-mingw-gas-cross-compile-2013-03-03.patch"
script: |
# Defines
export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
export FAKETIME=$REFERENCE_DATETIME
export TZ=UTC
INDIR=$HOME/build
TEMPDIR=$HOME/tmp
# Input Integrity Check
echo "fff00023dd79486d444c8e29922f4072e1d451fc5a4d2b6075852ead7f2b7b52 boost_1_55_0.tar.bz2" | shasum -c
echo "d2b7f6a1d7051faef3c9cf41a92fa3671d905ef1e1da920d07651a43299f6268 boost-mingw-gas-cross-compile-2013-03-03.patch" | shasum -c
for BITS in 32 64; do # for architectures
#
INSTALLPREFIX=$HOME/staging${BITS}
BUILDDIR=$HOME/build${BITS}
if [ "$BITS" == "32" ]; then
HOST=i686-w64-mingw32
else
HOST=x86_64-w64-mingw32
fi
#
mkdir -p $INSTALLPREFIX $BUILDDIR
cd $BUILDDIR
#
tar --warning=no-timestamp -xjf $INDIR/boost_1_55_0.tar.bz2
cd boost_1_55_0
GCCVERSION=$($HOST-g++ -E -dM $(mktemp --suffix=.h) | grep __VERSION__ | cut -d ' ' -f 3 | cut -d '"' -f 2)
echo "using gcc : $GCCVERSION : $HOST-g++
:
<rc>$HOST-windres
<archiver>$HOST-ar
<cxxflags>-frandom-seed=boost1
<ranlib>$HOST-ranlib
;" > user-config.jam
./bootstrap.sh --without-icu
# Workaround: Upstream boost dev refuses to include patch that would allow Free Software cross-compile toolchain to work
# This patch was authored by the Fedora package developer and ships in Fedora's mingw32-boost.
# Please obtain the exact patch that matches the above sha256sum from one of the following mirrors.
#
# Read History: https://svn.boost.org/trac/boost/ticket/7262
# History Mirror: http://rose.makesad.us/~paulproteus/mirrors/7262%20Boost.Context%20fails%20to%20build%20using%20MinGW.html
#
# Patch: https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/boost-mingw.patch
# Patch Mirror: http://wtogami.fedorapeople.org/boost-mingw-gas-cross-compile-2013-03-03.patch
# Patch Mirror: http://mindstalk.net/host/boost-mingw-gas-cross-compile-2013-03-03.patch
# Patch Mirror: http://rose.makesad.us/~paulproteus/mirrors/boost-mingw-gas-cross-compile-2013-03-03.patch
patch -p0 < $INDIR/boost-mingw-gas-cross-compile-2013-03-03.patch
# Bug Workaround: boost-1.54.0 broke the ability to disable zlib, still broken in 1.55
# https://svn.boost.org/trac/boost/ticket/9156
sed -i 's^\[ ac.check-library /zlib//zlib : <library>/zlib//zlib^^' libs/iostreams/build/Jamfile.v2
sed -i 's^<source>zlib.cpp <source>gzip.cpp \]^^' libs/iostreams/build/Jamfile.v2
# http://statmt.org/~s0565741/software/boost_1_52_0/libs/context/doc/html/context/requirements.html
# "For cross-compiling the lib you must specify certain additional properties at bjam command line: target-os, abi, binary-format, architecture and address-model."
./bjam toolset=gcc binary-format=pe target-os=windows threadapi=win32 address-model=$BITS threading=multi variant=release link=static runtime-link=static --user-config=user-config.jam --without-mpi --without-python -sNO_BZIP2=1 -sNO_ZLIB=1 --layout=tagged --build-type=complete --prefix="$INSTALLPREFIX" $MAKEOPTS install
# post-process all generated libraries to be deterministic
# extract them to a temporary directory then re-build them deterministically
for LIB in $(find $INSTALLPREFIX -name \*.a); do
rm -rf $TEMPDIR && mkdir $TEMPDIR && cd $TEMPDIR
$HOST-ar xv $LIB | cut -b5- > /tmp/list.txt
rm $LIB
$HOST-ar crsD $LIB $(cat /tmp/list.txt)
done
#
cd "$INSTALLPREFIX"
find | sort | zip -X@ $OUTDIR/boost-win$BITS-1.55.0-gitian-r6.zip
done # for BITS in
38 changes: 0 additions & 38 deletions contrib/gitian-descriptors/boost-win32.yml

This file was deleted.

62 changes: 62 additions & 0 deletions contrib/gitian-descriptors/deps-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: "twister"
suites:
- "precise"
architectures:
- "i386"
- "amd64"
packages:
- "g++"
- "unzip"
- "zip"
- "pkg-config"
- "libtool"
- "faketime"
- "bsdmainutils"
reference_datetime: "2013-06-01 00:00:00"
remotes: []
files:
- "openssl-1.0.1h.tar.gz"
- "db-4.8.30.NC.tar.gz"
script: |
STAGING="$HOME/install"
TEMPDIR="$HOME/tmp"
OPTFLAGS='-O2'
export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
export FAKETIME=$REFERENCE_DATETIME
export TZ=UTC
export LIBRARY_PATH="$STAGING/lib"
# Integrity Check
echo "9d1c8a9836aa63e2c6adb684186cbd4371c9e9dcc01d6e3bb447abf2d4d3d093 openssl-1.0.1h.tar.gz" | sha256sum -c
echo "12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef db-4.8.30.NC.tar.gz" | sha256sum -c
#
tar xzf openssl-1.0.1h.tar.gz
cd openssl-1.0.1h
# need -fPIC to avoid relocation error in 64 bit builds
./config no-shared no-zlib no-dso no-krb5 --openssldir=$STAGING -fPIC
# need to build OpenSSL with faketime because a timestamp is embedded into cversion.o
make
make install_sw
cd ..
#
tar xzf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix
# need --with-pic to avoid relocation error in 64 bit builds
../dist/configure --prefix=$STAGING --enable-cxx --disable-shared --with-pic
# Workaround to prevent re-configuring by make; make all files have a date in the past
find . -print0 | xargs -r0 touch -t 200001010000
make $MAKEOPTS library_build
make install_lib install_include
cd ../..
# post-process all generated libraries to be deterministic
# extract them to a temporary directory then re-build them deterministically
for LIB in $(find $STAGING -name \*.a); do
rm -rf $TEMPDIR && mkdir $TEMPDIR && cd $TEMPDIR
ar xv $LIB | cut -b5- > /tmp/list.txt
rm $LIB
ar crsD $LIB $(cat /tmp/list.txt)
done
#
cd $STAGING
find include lib bin host | sort | zip -X@ $OUTDIR/twister-deps-linux${GBUILD_BITS}-gitian-r6.zip
Loading

0 comments on commit ac9e5f5

Please sign in to comment.