Permalink
Browse files

Merge branch 'master' into split-repo

  • Loading branch information...
2 parents fa2d38a + e8921c3 commit d8dd36d1536bde875cbaa8286a7c0c53716ac675 Andrew Liu and David Stevenson committed Mar 19, 2013
View
@@ -1,7 +1,4 @@
---
-branches:
- only:
- - travis
rvm:
- 1.9.3
script: ./ci_build.sh
@@ -0,0 +1,4 @@
+tmp
+logs
+dist
+release
@@ -0,0 +1,10 @@
+Portable Postgresql Builder
+----------------
+
+What you should do is to run:
+
+ ./build.sh
+
+Then you will get your portable postgresql package in ./release
+
+If you find any errors, look logs/build.log to find anything helpful...
@@ -0,0 +1,91 @@
+#!/bin/bash -e
+
+ function download() {
+ url=$1
+ to_path=$2
+ echo "- Download $name from $url"
+ wget -c --progress=dot --no-check-certificate $url $to_path 2>&1 | \
+ while read line; do
+ echo $line | grep "%" | sed -e "s/\.//g" | \
+ awk '{printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b%4s ETA: %6s", $2, $4)}'
+ done
+ }
+
+ function handle_error() {
+ exit_code=$?
+ if [ ! $exit_code -eq 0 ];
+ then
+ echo "- Error! Check the logs/build.log"
+ exit $exit_code
+ fi
+ }
+
+ BASE_DIR=`dirname $0 | xargs realpath`
+ source $BASE_DIR/config
+
+ echo "Build from source code..."
+ mkdir -p $BASE_DIR/logs
+ rm -rf $BASE_DIR/logs/*
+ BUILD_LOG=$BASE_DIR/logs/build.log
+ mkdir -p $BASE_DIR/tmp
+ rm -rf $BASE_DIR/tmp/*
+
+ echo "- Install prequisites..."
+ sudo apt-get install -y build-essential wget realpath 1>> $BUILD_LOG 2>&1
+ handle_error
+
+ DIST_DIR=$BASE_DIR/dist/$DIST_NAME
+
+ pushd tmp
+ mkdir -p $DIST_DIR
+ if [ $FORCE_CLEAN -eq 1 ];
+ then
+ rm -rf $DIST_DIR/*
+ fi
+ for PKG in `echo $PKGS`; do
+ source $BASE_DIR/scripts/${PKG}/config
+ if [ -e $DIST_DIR/$PKG_FILE ];
+ then
+ echo "- $PKG has been installed"
+ else
+ download ${SRC_URL} "-O ${PKG_NAME}.tar.gz"
+ handle_error
+ echo
+ echo "- Uncompress the ${PKG_NAME} package"
+ tar xzvf ${PKG_NAME}.tar.gz 1>>$BUILD_LOG 2>&1
+ handle_error
+ pushd $PKG_NAME
+ echo "- Compile $PKG_NAME"
+ cp $BASE_DIR/build_env ./.build_env
+ cp $BASE_DIR/scripts/${PKG}/script ./.${PKG}_install_script
+ chmod +x ./.${PKG}_install_script
+ ./.${PKG}_install_script $DIST_DIR 1>>$BUILD_LOG 2>&1
+ handle_error
+ if [ -e $DIST_DIR/$PKG_FILE ];
+ then
+ echo " - $PKG_NAME compiled"
+ else
+ echo " - Failed to compile $PKG_NAME"
+ fi
+ if [ "$PKG" = "postgresql" ];
+ then
+ echo "- Postgresql is built successfully..."
+ fi
+ popd
+ fi
+ done
+ popd
+
+ pushd $DIST_DIR
+ tar czvf $DIST_NAME.tar.gz * 1>>$BUILD_LOG 2>&1
+ handle_error
+ mkdir -p $BASE_DIR/release
+ if [ -e $BASE_DIR/release/$DIST_NAME.tar.gz ];
+ then
+ rm -rf $BASE_DIR/release/$DIST_NAME.tar.gz
+ fi
+ cp $DIST_NAME.tar.gz $BASE_DIR/release
+ popd
+ rm -rf $DIST_DIR
+ rm -rf tmp
+
@@ -0,0 +1,5 @@
+TARGET_DIR=$1
+export LD_LIBRARY_PATH=$TARGET_DIR/lib:$LD_LIBRARY_PATH
+export CFLAGS="-I$TARGET_DIR/incldue -m64"
+export CPPFLAGS="-I$TARGET_DIR/include -m64"
+export LDFLAGS="-L$TARGET_DIR/lib -m64 -Wl,-rpath -Wl,\\\$\$ORIGIN/../lib"
@@ -0,0 +1,3 @@
+FORCE_CLEAN=0
+PKGS="zlib libxml2 libxslt openssl openldap libedit postgresql"
+DIST_NAME=postgresql-9.2-x86_64
@@ -0,0 +1,3 @@
+SRC_URL=http://www.thrysoee.dk/editline/libedit-20121213-3.0.tar.gz
+PKG_NAME=libedit-20121213-3.0
+PKG_FILE=lib/libedit.so
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+source ./.build_env
+
+./configure --prefix=$TARGET_DIR
+make
+make install
@@ -0,0 +1,3 @@
+SRC_URL=ftp://xmlsoft.org/libxml2/libxml2-2.8.0.tar.gz
+PKG_NAME=libxml2-2.8.0
+PKG_FILE=lib/libxml2.so
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+source ./.build_env
+
+./configure --prefix=$TARGET_DIR --with-zlib=$TARGET_DIR
+make
+make install
@@ -0,0 +1,3 @@
+SRC_URL=ftp://xmlsoft.org/libxslt/libxslt-1.1.28.tar.gz
+PKG_NAME=libxslt-1.1.28
+PKG_FILE=lib/libxslt.so
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+source ./.build_env
+
+./configure --prefix=$TARGET_DIR --with-libxml-prefix=$TARGET_DIR
+make
+make install
@@ -0,0 +1,3 @@
+SRC_URL=ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/openldap-2.4.34.tgz
+PKG_NAME=openldap-2.4.34
+PKG_FILE=lib/libldap.so
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+source ./.build_env
+
+./configure --prefix=$TARGET_DIR --disable-slapd
+make
+make install
@@ -0,0 +1,3 @@
+SRC_URL=http://www.openssl.org/source/openssl-1.0.1e.tar.gz
+PKG_NAME=openssl-1.0.1e
+PKG_FILE=lib/libcrypto.so
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+source ./.build_env
+
+./config --prefix=$TARGET_DIR -I$TARGET_DIR/include -L$TARGET_DIR/lib zlib no-asm no-krb5 shared
+make
+make install
@@ -0,0 +1,4 @@
+#!/bin/bash
+SRC_URL=http://ftp.postgresql.org/pub/source/v9.2.3/postgresql-9.2.3.tar.gz
+PKG_NAME=postgresql-9.2.3
+PKG_FILE=bin/postgres
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+source ./.build_env
+
+./configure --prefix=$TARGET_DIR --with-libedit-preferred --with-libxml --with-libxslt --with-openssl --with-ldap
+make world
+make check
+rm -rf $TARGET_DIR/bin/*
+rm -rf $TARGET_DIR/lib/*.a
+rm -rf $TARGET_DIR/lib/*.la
+rm -rf $TARGET_DIR/ssl
+rm -rf $TARGET_DIR/etc/*
+rm -rf $TARGET_DIR/share/aclocal
+rm -rf $TARGET_DIR/share/gtk-doc
+rm -rf $TARGET_DIR/share/man
+rm -rf $TARGET_DIR/share/doc
+make install-world
+rm -rf $TARGET_DIR/share/doc/html
@@ -0,0 +1,3 @@
+SRC_URL=http://zlib.net/zlib-1.2.7.tar.gz
+PKG_NAME=zlib-1.2.7
+PKG_FILE=lib/libz.so
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+source ./.build_env
+
+./configure --prefix=$TARGET_DIR
+make
+make install

0 comments on commit d8dd36d

Please sign in to comment.