Skip to content
This repository has been archived by the owner on Mar 12, 2019. It is now read-only.

Build a portable bottle

Shaun Jackman edited this page Nov 2, 2018 · 23 revisions

The bottles for binutils, patchelf and zlib are special. Because they are installed before glibc, they must be able to run on host systems using an older version of glibc. Linuxbrew supports host systems with glibc 2.12 and newer. We use CentOS 6 with glibc 2.12 to build portable bottles.

First, create a new clean docker image and run it:

docker pull centos:6
docker run -it --name=linuxbrew-centos6 centos:6
# Install build dependencies of `binutils`.
yum install -y bison flex texinfo gcc gcc-c++ make curl sudo which

# Create the Linuxbrew user
useradd -m -s /bin/bash linuxbrew
echo 'linuxbrew ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers
su -l linuxbrew

# Install Linuxbrew
PATH=$HOME/.linuxbrew/bin:$HOME/.linuxbrew/sbin:$PATH
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"

# Create symlinks for GCC 4.4
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.4
sudo ln -s /usr/bin/g++ /usr/bin/g++-4.4

Build a portable bottle for binutils.

export HOMEBREW_NO_AUTO_UPDATE=1
brew install --build-bottle binutils
brew bottle --json binutils
brew test binutils

Upload the bottle to Bintray using curl.

export HOMEBREW_BINTRAY_USER=linuxbrewtestbot HOMEBREW_BINTRAY_KEY=...
version=$(brew list --versions binutils | sed 's/.* //')
/usr/bin/curl -u$HOMEBREW_BINTRAY_USER:$HOMEBREW_BINTRAY_KEY -T binutils--$version.x86_64_linux.bottle.tar.gz "https://api.bintray.com/content/linuxbrew/bottles/binutils/$version/binutils-$version.x86_64_linux.bottle.tar.gz?publish=1" >curl.out

Add the sha256 of the bottle to the binutils formula manually.

sha256sum binutils--$version.x86_64_linux.bottle.tar.gz
brew edit binutils
git commit binutils.rb -m"binutils: update $version bottle for Linuxbrew."

Optional steps

Add the sha256 of the bottle to the binutils formula.

brew install git
git config --global user.name LinuxbrewTestBot
git config --global user.email testbot@linuxbrew.sh
brew bottle --merge --write --keep-old binutils-*.x86_64_linux.bottle.json

Test the bottle.

brew remove --ignore-dependencies binutils
brew install ./binutils-*.x86_64_linux.bottle.tar.gz
brew install ruby # Fix Error: cannot load such file -- test/unit/assertions
brew test binutils

Upload the bottle to Bintray using brew test-bot.

export BINTRAY_USER=linuxbrewtestbot
export BINTRAY_KEY=...
export CIRCLE_PR_NUMBER=...
brew test-bot --ci-upload --keep-old