Skip to content

Commit

Permalink
Sample .rbuild.conf and stylistic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Periklis Akritidis committed Jan 18, 2017
1 parent af6e708 commit 49363f1
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 5 deletions.
10 changes: 5 additions & 5 deletions rbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

LC_CTYPE=C
SSH="ssh -o BatchMode=yes -o StrictHostKeyChecking=no -o ForwardAgent=yes"
ANCHORS=".hg .git configure.ac"
LOCAL_DIR_ANCHORS=".hg .git configure.ac"
BUILD_ENV=debug
INSTALL_DIR='$HOME/.local'
BUILD_JOBS=8
Expand Down Expand Up @@ -39,7 +39,7 @@ function load_conf {
. $conf
fi

LOCAL_DIR=${LOCAL_DIR:-$(dirname $(upsearch $ANCHORS))}
LOCAL_DIR=${LOCAL_DIR:-$(dirname $(upsearch $LOCAL_DIR_ANCHORS))}
# cd into dir to normalize it
cd $LOCAL_DIR
LOCAL_DIR=$PWD
Expand Down Expand Up @@ -82,7 +82,7 @@ function autoreconf {

function configure {
echo Remote configure in $BUILD_HOST:$BUILD_DIR
$SSH $BUILD_HOST "mkdir -p $BUILD_DIR && cd $BUILD_DIR && PKG_CONFIG_PATH=\"$PKG_CONFIG_PATH\" CC=\"$CC\" CFLAGS=\"$CFLAGS\" CCAS=gcc CCASFLAGS= ../$BASENAME/configure $CONFIGURE_OPTIONS"
$SSH $BUILD_HOST "mkdir -p $BUILD_DIR && cd $BUILD_DIR && PKG_CONFIG_PATH=\"$PKG_CONFIG_PATH\" CC=\"$CC\" CFLAGS=\"$CFLAGS\" CCAS=gcc CCASFLAGS= ../$BASENAME/configure $CONFIGURE_ARGS"
}

function build {
Expand Down Expand Up @@ -237,8 +237,8 @@ export BUILD_ENV

load_conf $config_file

CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS:---disable-silent-rules --prefix $INSTALL_DIR/$BASENAME}"
CONFIGURE_OPTIONS+=" $EXTRA_CONFIGURE_OPTIONS"
CONFIGURE_ARGS="${CONFIGURE_ARGS:---prefix $INSTALL_DIR/$BASENAME}"
CONFIGURE_ARGS+=" $EXTRA_CONFIGURE_ARGS"

if [ $do_stage ]; then
stage || exit 1
Expand Down
53 changes: 53 additions & 0 deletions sample.rbuild.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This file should be copied to ~/.rbuild.conf on the local machine

# CONFIGURE_ARGS default to --prefix $INSTALL_DIR/$BASENAME
# INSTALL_DIR defaults to '$HOME/.local'. Single quotes can be
# used to refer to $HOME on the BUILD_HOST and DEPLOY_HOST instead
# of the local machine.
# BASENAME defaults to the basename of LOCAL_DIR
# LOCAL_DIR is detected by searching from the current directory towards the root directory
# for a directory containing any of LOCAL_DIR_ANCHORS
# LOCAL_DIR_ANCHORS defaults to ".hg .git configure.ac"
# SSH defaults to "ssh -o BatchMode=yes -o StrictHostKeyChecking=no -o ForwardAgent=yes"


# BUILD_ENV contains the argument to the -e option of rbuild
# and defaults to "debug"
case $BUILD_ENV in
debug)
# We can override the CFLAGS variable.
# It will be passed to the remote build.
CFLAGS="-fsanitize=address -ggdb3 -O0 -Werror -Wall"

# Any EXTRA_CONFIGURE_ARGS are appended to CONFIGURE_ARGS
EXTRA_CONFIGURE_ARGS="--enable-valgrind-testing"
;;
optimized)
CFLAGS="-ggdb3 -O3"
EXTRA_CONFIGURE_ARGS="--enable-optimizations"
;;
asan)
CFLAGS="-fsanitize=address -ggdb3 -O0 -Werror -Wall"
;;
*)
;;
esac

# We can override the compiler used
CC=/opt/rh/devtoolset-4/root/usr/bin/gcc

# PKG_CONFIG_PATH is passed to the remote build.
# Use double-quotes to interpret $HOME on the remote machine
PKG_CONFIG_PATH='$HOME/.local/libnio/lib/pkgconfig'

# BUILD_HOST is mandatory
BUILD_HOST=builder

# DEPLOY_HOST is required for -d
DEPLOY_HOST=staging

# Runs make -j $BUILD_JOBS
# BUILD_JOBS=10

# Empty BUILD_JOBS will run make -j
# BUILD_JOBS=

0 comments on commit 49363f1

Please sign in to comment.