Add the_silver_searcher

This commit is contained in:
Andrew Dunham 2015-02-18 15:33:05 -08:00
commit 937007470d
3 changed files with 121 additions and 0 deletions

BIN
binaries/ag Executable file

Binary file not shown.

View File

@ -0,0 +1,18 @@
FROM debian:jessie
MAINTAINER Andrew Dunham <andrew@du.nham.ca>
# 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

103
the_silver_searcher/build.sh Executable file
View File

@ -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