-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#94536764] Signed-off-by: Sai To Yeung <[email protected]> Signed-off-by: Matt Horan <[email protected]>
- Loading branch information
Showing
9 changed files
with
161 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module BinaryBuilder | ||
class HttpdArchitect < Architect | ||
HTTPD_TEMPLATE_PATH = File.expand_path('../../../templates/httpd_blueprint', __FILE__) | ||
|
||
def blueprint | ||
contents = read_file(HTTPD_TEMPLATE_PATH) | ||
contents | ||
.gsub('$HTTPD_VERSION', binary_version) | ||
.gsub('$APR_UTIL_VERSION', '1.5.4') | ||
.gsub('$APR_ICONV_VERSION', '1.2.1') | ||
.gsub('$APR_VERSION', '1.5.2') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,10 @@ | ||
#!/bin/sh | ||
#!/usr/bin/env bash | ||
set +e | ||
|
||
tar_name=$1 | ||
exec_path=$2 | ||
exec_flag=$3 | ||
exec_test=$4 | ||
tar_name=$1; shift | ||
|
||
mkdir binary-exerciser | ||
cd binary-exerciser | ||
|
||
tar xzf /binary-builder/${tar_name} | ||
${exec_path} $exec_flag "${exec_test}" | ||
eval $(printf '%q ' "$@") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
require 'spec_helper' | ||
|
||
module BinaryBuilder | ||
describe HttpdArchitect do | ||
subject(:architect) { HttpdArchitect.new(binary_version: '2.4.12') } | ||
|
||
describe '#new' do | ||
|
||
it 'sets a binary version' do | ||
expect(architect.binary_version).to eq('2.4.12') | ||
end | ||
end | ||
|
||
describe 'blueprint' do | ||
let(:template_file) { double(read: 'BINARY_VERSION') } | ||
|
||
before do | ||
allow(File).to receive(:open).and_return(template_file) | ||
end | ||
|
||
it 'uses the httpd_blueprint template' do | ||
expect(File).to receive(:open).with(File.expand_path('../../../templates/httpd_blueprint', __FILE__)) | ||
architect.blueprint | ||
end | ||
|
||
it 'adds the binary version' do | ||
expect(architect.blueprint).to include '2.4.12' | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
STAGING_DIR="/tmp/staged/app" | ||
|
||
INSTALLATION_DIR=$1 | ||
|
||
ln -sf $INSTALLATION_DIR /app/httpd | ||
|
||
function build_apr() { | ||
curl -f -L -O "http://apache.mirrors.tds.net/apr/apr-$APR_VERSION.tar.gz" | ||
tar zxf "apr-$APR_VERSION.tar.gz" | ||
pushd "apr-$APR_VERSION" | ||
./configure --prefix="$STAGING_DIR/libapr-$APR_VERSION" | ||
make -j 3 | ||
make install | ||
popd | ||
} | ||
|
||
function build_apr_iconv() { | ||
curl -f -L -O "http://apache.mirrors.tds.net/apr/apr-iconv-$APR_ICONV_VERSION.tar.gz" | ||
tar zxf "apr-iconv-$APR_ICONV_VERSION.tar.gz" | ||
pushd "apr-iconv-$APR_ICONV_VERSION" | ||
./configure \ | ||
--prefix="$STAGING_DIR/libapr-iconv-$APR_ICONV_VERSION" \ | ||
--with-apr="$STAGING_DIR/libapr-$APR_VERSION/bin/apr-1-config" | ||
make -j 3 | ||
make install | ||
popd | ||
} | ||
|
||
function build_apr_util() { | ||
curl -f -L -O "http://apache.mirrors.tds.net/apr/apr-util-$APR_UTIL_VERSION.tar.gz" | ||
tar zxf "apr-util-$APR_UTIL_VERSION.tar.gz" | ||
pushd "apr-util-$APR_UTIL_VERSION" | ||
./configure \ | ||
--prefix="$STAGING_DIR/libapr-util-$APR_UTIL_VERSION" \ | ||
--with-iconv="$STAGING_DIR/libapr-iconv-$ICONV_VERSION" \ | ||
--with-crypto \ | ||
--with-openssl \ | ||
--with-mysql \ | ||
--with-pgsql \ | ||
--with-gdbm \ | ||
--with-ldap \ | ||
--with-apr="$STAGING_DIR/libapr-$APR_VERSION" | ||
make -j 3 | ||
make install | ||
popd | ||
} | ||
|
||
function build_required_libs() { | ||
build_apr | ||
build_apr_iconv | ||
build_apr_util | ||
} | ||
|
||
function build_httpd_24() { | ||
curl -f -L -O "http://apache.osuosl.org/httpd/httpd-$HTTPD_VERSION.tar.bz2" | ||
tar jxf "httpd-$HTTPD_VERSION.tar.bz2" | ||
pushd "httpd-$HTTPD_VERSION" | ||
./configure \ | ||
--prefix="/app/httpd" \ | ||
--with-apr="$STAGING_DIR/libapr-$APR_VERSION" \ | ||
--with-apr-util="$STAGING_DIR/libapr-util-$APR_UTIL_VERSION" \ | ||
--enable-mpms-shared="worker event" \ | ||
--enable-mods-shared=reallyall \ | ||
--disable-isapi \ | ||
--disable-dav \ | ||
--disable-dialup | ||
make -j 3 | ||
make install | ||
popd | ||
} | ||
|
||
# build required libs & httpd | ||
build_required_libs | ||
build_httpd_24 | ||
|
||
# Remove unnecessary files and config | ||
cd "/app/httpd" | ||
rm -rf build/ cgi-bin/ error/ icons/ include/ man/ manual/ htdocs/ | ||
rm -rf conf/extra/* conf/httpd.conf conf/httpd.conf.bak conf/magic conf/original | ||
|
||
# Install required libraries | ||
mkdir "/app/httpd/lib" | ||
cp "$STAGING_DIR/libapr-$APR_VERSION/lib/libapr-1.so.0" "/app/httpd/lib" | ||
cp "$STAGING_DIR/libapr-util-$APR_UTIL_VERSION/lib/libaprutil-1.so.0" "/app/httpd/lib" | ||
cp "$STAGING_DIR/libapr-iconv-$APR_ICONV_VERSION/lib/libapriconv-1.so.0" "/app/httpd/lib" | ||
|
||
echo "Done!" |