commit 937007470dfe888289433f0f7eab14bad6ce8401 Author: Andrew Dunham Date: Wed Feb 18 15:33:05 2015 -0800 Add the_silver_searcher diff --git a/binaries/ag b/binaries/ag new file mode 100755 index 0000000..32d4405 Binary files /dev/null and b/binaries/ag differ diff --git a/the_silver_searcher/Dockerfile b/the_silver_searcher/Dockerfile new file mode 100644 index 0000000..bbbf88f --- /dev/null +++ b/the_silver_searcher/Dockerfile @@ -0,0 +1,18 @@ +FROM debian:jessie +MAINTAINER Andrew Dunham + +# Install build tools +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get upgrade -yy && \ + DEBIAN_FRONTEND=noninteractive apt-get install -yy \ + automake \ + build-essential \ + curl \ + git \ + pkg-config + +RUN mkdir /build +ADD . /build + +# This builds the program and copies it to /output +CMD /build/build.sh diff --git a/the_silver_searcher/build.sh b/the_silver_searcher/build.sh new file mode 100755 index 0000000..09f535a --- /dev/null +++ b/the_silver_searcher/build.sh @@ -0,0 +1,103 @@ +#!/bin/bash + +set -e +set -o pipefail +set -x + + +MUSL_VERSION=1.1.6 +PCRE_VERSION=8.36 +LZMA_VERSION=5.0.8 + + +function build_musl() { + cd /build + + # Download + curl -LO http://www.musl-libc.org/releases/musl-${MUSL_VERSION}.tar.gz + tar zxvf musl-${MUSL_VERSION}.tar.gz + cd musl-${MUSL_VERSION} + + # Build + ./configure + make -j4 + make install +} + +function build_pcre() { + cd /build + + # Download + curl -LO ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-${PCRE_VERSION}.tar.gz + tar zxvf pcre-${PCRE_VERSION}.tar.gz + cd pcre-${PCRE_VERSION} + + # Build + CC='/usr/local/musl/bin/musl-gcc -static' CFLAGS='-fPIC' ./configure \ + --disable-shared \ + --enable-static + make -j4 +} + +function build_lzma() { + cd /build + + # Download + curl -LO http://tukaani.org/xz/xz-${LZMA_VERSION}.tar.gz + tar zxvf xz-${LZMA_VERSION}.tar.gz + cd xz-${LZMA_VERSION} + + # Build + CC='/usr/local/musl/bin/musl-gcc -static' CFLAGS='-fPIC' ./configure \ + --disable-shared \ + --enable-static + make -j4 +} + +function build_ag() { + cd /build + + # Clone + git clone https://github.com/ggreer/the_silver_searcher.git + cd the_silver_searcher + + # Autoconf + aclocal + autoconf + autoheader + automake --add-missing + + # Configure + # Note: since the system won't have PCRE/liblzma installed, we just have pkg-config return true + CC='/usr/local/musl/bin/musl-gcc -static' \ + CFLAGS='-fPIC' \ + CPPFLAGS="-I/build/pcre-${PCRE_VERSION}" \ + PCRE_LIBS="-L/build/pcre-${PCRE_VERSION}/.libs -lpcre" \ + PCRE_CFLAGS="-I/build/pcre-${PCRE_VERSION}" \ + LZMA_LIBS="-L/build/xz-${LZMA_VERSION}/src/liblzma/.libs -llzma" \ + LZMA_CFLAGS="-I/build/xz-${LZMA_VERSION}" \ + ./configure PKG_CONFIG="/bin/true" + + # Build + make -j4 + strip ag +} + +function doit() { + # Kick off all builds + build_musl + build_pcre + build_lzma + build_ag + + # Copy ag to output + if [ -d /output ] + then + cp /build/the_silver_searcher/ag /output/ + echo "** Finished **" + else + echo "** /output does not exist **" + fi +} + +doit