Skip to content

Commit

Permalink
Merge pull request #73 from krallin/32bits
Browse files Browse the repository at this point in the history
Build i386 binary
  • Loading branch information
krallin authored Feb 5, 2017
2 parents b837c03 + 41cc6b3 commit 2c02e14
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 32 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ env:
- CC=gcc ARCH_SUFFIX=amd64 ARCH_NATIVE=1 MINIMAL=
- CC=arm-linux-gnueabihf-gcc ARCH_SUFFIX=armhf ARCH_NATIVE= MINIMAL=
- CC=aarch64-linux-gnu-gcc ARCH_SUFFIX=arm64 ARCH_NATIVE= MINIMAL=
- CFLAGS="-m32" ARCH_SUFFIX=i386 ARCH_NATIVE= MINIMAL=
- CC=gcc ARCH_SUFFIX=amd64 ARCH_NATIVE=1 MINIMAL=1
global:
- SIGN_BINARIES=1
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ project (tini C)

# Config
set (tini_VERSION_MAJOR 0)
set (tini_VERSION_MINOR 13)
set (tini_VERSION_PATCH 2)
set (tini_VERSION_MINOR 14)
set (tini_VERSION_PATCH 0)

# Build options
option(MINIMAL "Disable argument parsing and verbose output" OFF)
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM ubuntu:trusty

ARG ARCH_SUFFIX

COPY ci/install_deps.sh /install_deps.sh
RUN /install_deps.sh

Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ In Docker, you will want to use an entrypoint so you don't have to remember
to manually invoke Tini:

# Add Tini
ENV TINI_VERSION v0.13.2
ENV TINI_VERSION v0.14.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]
Expand All @@ -81,7 +81,7 @@ The `tini` and `tini-static` binaries are signed using the key `595E85A6B1B4779E
You can verify their signatures using `gpg` (which you may install using
your package manager):

ENV TINI_VERSION v0.13.2
ENV TINI_VERSION v0.14.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini.asc /tini.asc
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \
Expand All @@ -102,10 +102,10 @@ Using Nix, you can use the following command to install Tini:

nix-env --install tini

### ARM ###
### Other Platforms ###

ARM images are available! Find the list of available platforms under the
releases tab.
ARM and 32-bit binaries are available! You can find the complete list of
available binaries under [the releases tab][11].


Options
Expand Down Expand Up @@ -245,6 +245,7 @@ Special thanks to:

[0]: https://github.com/krallin/tini/issues/8
[10]: https://github.com/krallin/tini-images
[11]: https://github.com/krallin/tini/releases
[20]: https://github.com/krallin/
[30]: https://github.com/tianon
[31]: https://github.com/dpw
Expand Down
25 changes: 19 additions & 6 deletions ci/install_deps.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
#!/bin/bash
set -o errexit
set -o nounset
set -o xtrace

apt-get update

apt-get install --no-install-recommends --yes \
DEPS=(
build-essential git gdb valgrind cmake rpm \
python-dev libcap-dev python-pip python-virtualenv \
hardening-includes gnupg \
gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu libc6-dev-arm64-cross \
gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabi libc6-dev-armhf-cross
hardening-includes gnupg
)

if [[ "$ARCH_SUFFIX" = "amd64" ]]; then
true
elif [[ "$ARCH_SUFFIX" = "armhf" ]]; then
DEPS+=(gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabi libc6-dev-armhf-cross)
elif [[ "$ARCH_SUFFIX" = "arm64" ]]; then
DEPS+=(gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu libc6-dev-arm64-cross)
elif [[ "$ARCH_SUFFIX" = "i386" ]]; then
DEPS+=(libc6-dev-i386 gcc-multilib)
else
echo "Unknown ARCH_SUFFIX=${ARCH_SUFFIX}"
exit 1
fi

apt-get update
apt-get install --no-install-recommends --yes "${DEPS[@]}"
rm -rf /var/lib/apt/lists/*
26 changes: 15 additions & 11 deletions ci/run_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ set -o pipefail
# Default compiler
: ${CC:="gcc"}

echo "CC=${CC}"

# Paths
: ${SOURCE_DIR:="."}
Expand All @@ -30,12 +29,17 @@ export FORCE_SUBREAPER

# Our build platform doesn't have those newer Linux flags, but we want Tini to have subreaper support
# We also use those in our tests
CFLAGS="-DPR_SET_CHILD_SUBREAPER=36 -DPR_GET_CHILD_SUBREAPER=37"
CFLAGS="${CFLAGS-} -DPR_SET_CHILD_SUBREAPER=36 -DPR_GET_CHILD_SUBREAPER=37"
if [[ "${FORCE_SUBREAPER}" -eq 1 ]]; then
# If FORCE_SUBREAPER is requested, then we set those CFLAGS for the Tini build
export CFLAGS
fi

echo "CC=${CC}"
echo "CFLAGS=${CFLAGS}"
echo "ARCH_SUFFIX=${ARCH_SUFFIX-}"
echo "ARCH_NATIVE=${ARCH_NATIVE-}"

# Ensure Python output is not buffered (to make tests output clearer)
export PYTHONUNBUFFERED=1

Expand All @@ -53,16 +57,16 @@ cmake "${CMAKE_ARGS[@]}"
pushd "${BUILD_DIR}"
make clean
make
if [[ -n "${ARCH_NATIVE:=}" ]]; then
if [[ -n "${ARCH_NATIVE-}" ]]; then
make package
fi
popd

pkg_version="$(cat "${BUILD_DIR}/VERSION")"


if [[ -n "${ARCH_NATIVE:=}" ]]; then
echo "Built native package (ARCH_NATIVE=${ARCH_NATIVE})"
if [[ -n "${ARCH_NATIVE-}" ]]; then
echo "Built native package (ARCH_NATIVE=${ARCH_NATIVE-})"
echo "Running smoke and internal tests"

BIN_TEST_DIR="${BUILD_DIR}/bin-test"
Expand Down Expand Up @@ -194,7 +198,7 @@ if [[ -n "${ARCH_NATIVE:=}" ]]; then
# Run tests
python "${SOURCE_DIR}/test/run_inner_tests.py"
else
if [[ ! -n "${ARCH_SUFFIX:=}" ]]; then
if [[ ! -n "${ARCH_SUFFIX-}" ]]; then
echo "Built cross package, but $ARCH_SUFFIX is empty!"
exit 1
fi
Expand All @@ -210,30 +214,30 @@ mkdir -p "${DIST_DIR}"
TINIS=()

for tini in tini tini-static; do
if [[ -n "${ARCH_SUFFIX:=}" ]]; then
if [[ -n "${ARCH_SUFFIX-}" ]]; then
to="${DIST_DIR}/${tini}-${ARCH_SUFFIX}"
TINIS+=("$to")
cp "${BUILD_DIR}/${tini}" "$to"
fi

if [[ -n "${ARCH_NATIVE:=}" ]]; then
if [[ -n "${ARCH_NATIVE-}" ]]; then
to="${DIST_DIR}/${tini}"
TINIS+=("$to")
cp "${BUILD_DIR}/${tini}" "$to"
fi
done

if [[ -n "${ARCH_NATIVE:=}" ]]; then
if [[ -n "${ARCH_NATIVE-}" ]]; then
for pkg_format in deb rpm; do
src="${BUILD_DIR}/tini_${pkg_version}.${pkg_format}"

if [[ -n "${ARCH_SUFFIX:=}" ]]; then
if [[ -n "${ARCH_SUFFIX-}" ]]; then
to="${DIST_DIR}/tini_${pkg_version}-${ARCH_SUFFIX}.${pkg_format}"
TINIS+=("$to")
cp "$src" "$to"
fi

if [[ -n "${ARCH_NATIVE:=}" ]]; then
if [[ -n "${ARCH_NATIVE-}" ]]; then
to="${DIST_DIR}/tini_${pkg_version}.${pkg_format}"
TINIS+=("$to")
cp "$src" "$to"
Expand Down
13 changes: 10 additions & 3 deletions ddist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@
set -o errexit
set -o nounset

if [[ "$#" != 1 ]]; then
echo "Usage: $0 ARCH_SUFFIX"
exit 1
fi
suffix="$1"

REL_HERE=$(dirname "${BASH_SOURCE}")
HERE=$(cd "${REL_HERE}"; pwd)

IMG="tini"
IMG="tini-build-${suffix}"
SRC="/tini"

# Cleanup the build dir
rm -f "${HERE}/dist"/*

# Create the build image
docker build -t "${IMG}" .
docker build --build-arg "ARCH_SUFFIX=${suffix}" -t "${IMG}" .

# Run test without subreaper support, don't copy build files here
docker run -it --rm \
Expand All @@ -22,7 +28,8 @@ docker run -it --rm \
-e FORCE_SUBREAPER="${FORCE_SUBREAPER:="1"}" \
-e GPG_PASSPHRASE="${GPG_PASSPHRASE:=}" \
-e CC="${CC:=gcc}" \
-e CFLAGS="${CFLAGS-}" \
-e ARCH_NATIVE="${ARCH_NATIVE-1}" \
-e ARCH_SUFFIX="${ARCH_SUFFIX-}" \
-e ARCH_SUFFIX="${suffix}" \
-e MINIMAL="${MINIMAL-}" \
"${IMG}" "${SRC}/ci/run_build.sh"
9 changes: 7 additions & 2 deletions dtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ set -o nounset

IMG="tini"

if [[ "$#" != 1 ]]; then
echo "Usage: $0 ARCH_SUFFIX"
exit 1
fi
suffix="$1"

docker build -t "${IMG}" .
python test/run_outer_tests.py "${IMG}"
IMG="tini-build-${suffix}"
python test/run_outer_tests.py "${IMG}"
7 changes: 4 additions & 3 deletions tpl/README.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ Using Nix, you can use the following command to install Tini:

nix-env --install tini

### ARM ###
### Other Platforms ###

ARM images are available! Find the list of available platforms under the
releases tab.
ARM and 32-bit binaries are available! You can find the complete list of
available binaries under [the releases tab][11].


Options
Expand Down Expand Up @@ -245,6 +245,7 @@ Special thanks to:

[0]: https://github.com/krallin/tini/issues/8
[10]: https://github.com/krallin/tini-images
[11]: https://github.com/krallin/tini/releases
[20]: https://github.com/krallin/
[30]: https://github.com/tianon
[31]: https://github.com/dpw
Expand Down

0 comments on commit 2c02e14

Please sign in to comment.