Skip to content
Pull request Compare This branch is 288 commits ahead, 740 commits behind master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
..
Failed to load latest commit information.
abicheck
deb
rpm
README

README

DEB (Debian, Ubuntu, etc.)
==========================

Prerequisites
-------------

    apt-get install build-essential fakeroot devscripts dpkg-dev gnupg \
                    debhelper cowbuilder

Download ubuntu archive keyring

    wget http://archive.ubuntu.com/ubuntu/project/ubuntu-archive-keyring.gpg
    cp ubuntu-archive-keyring.gpg /usr/share/keyrings/

Configure chroot environment for each supported version and platform

    MIRROR=http://ftp.byfly.by/ubuntu

    init_ubuntu () {
        dist=$1
        arch=$2

        cowbuilder --create \
            --distribution $dist \
            --components "main universe" \
            --basepath /var/cache/pbuilder/$dist-$arch.cow \
            --mirror $MIRROR \
            --debootstrapopts --keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg

        cowbuilder --execute --save \
            --basepath /var/cache/pbuilder/$dist-$arch.cow -- \
            /tmp/install-dependencies
    }

    cat <<'EOF' >/tmp/install-dependencies
    #!/bin/sh

    set -x
    set -e

    apt-get update
    apt-get -y install libevent-dev libev-dev debhelper autotools-dev
    EOF
    chmod a+rx /tmp/install-dependencies

    for DIST in lucid oneiric precise; do
        for ARCH in i386 amd64; do
            init_ubuntu $DIST $ARCH
        done
    done

Build Packages
--------------

Source package can be built on any debian-like system. This system
should have installed fresh autotools.

    git clone git://github.com/couchbase/libcouchbase.git
    cd libcouchbase
    ./config/autorun.sh && ./configure --disable-tests --disable-couchbasemock --disable-plugins
    make dist

    VERSION=$(git describe | sed 's/-/_/g')
    DEB_VERSION=$(git describe | sed 's/-\([0-9]\+\)-g\([0-9a-z]\+\)/+\1~\2/')
    WORKSPACE=$PWD/build
    PKGDIR=$WORKSPACE/libcouchbase-$VERSION
    if [ "x$BUILDNO" = "x" ]; then BUILDNO=1; fi

    mkdir -p $PKGDIR
    cp -r packaging/deb $PKGDIR/debian
    cp libcouchbase-$VERSION.tar.gz $WORKSPACE/libcouchbase_$DEB_VERSION.orig.tar.gz
    (
        cd $WORKSPACE;
        tar zxf libcouchbase_$DEB_VERSION.orig.tar.gz
    )
    (
        cd $PKGDIR;
        dch --no-auto-nmu --newversion "$DEB_VERSION-$BUILDNO" "Release package for libcouchbase $DEB_VERSION"
        debian/rules clean
        dpkg-source -b .
    )
    mv $WORKSPACE/*.{dsc,tar.gz} $PWD
    rm -rf $WORKSPACE

Now binary packages could be built using cowbuilder

    for DIST in lucid oneiric precise; do
        for ARCH in i386 amd64; do
            export BUILDRESULT=$HOME/input/$DIST
            cowbuilder --build --basepath /var/cache/pbuilder/$DIST-$ARCH.cow libcouchbase_$DEB_VERSION-$BUILDNO.dsc
        done
    done

All build artifacts will be stored in `BUILDRESULT` directory.

To debug failing builds in manual mode, one could use pbuilder hooks like this

    mkdir $HOME/pb-hooks
    cp /usr/share/doc/pbuilder/examples/C10shell $HOME/pb-hooks
    cowbuilder --hookdir $HOME/pb-hook ...

RPM (CentOS, RHEL, SUSE, etc.)
==============================

Prerequisites
-------------


* Install mock

    yum install mock

* Add user to 'mock' group

    usermod -a -G mock [User name] && newgrp mock

* Setup configurations

    cp packaging/rpm/mock/* /etc/mock

* Initialize chroot.

    for CONFIG in centos-5-i386 centos-5-x86_64 centos-6-i386 centos-6-x86_64; do
        mock -r $CONFIG --init
    done

Build Packages
--------------

* Generate

    VERSION=$(git describe | awk -F- '{ print $1 }')
    RELEASE=$(git describe | awk -F- '{ print $2"_"$3 }')
    if [ "$RELEASE" = "_"]
    then
        RELEASE = 1;
        TARNAME="%{name}-%{version}"
    else
        TARNAME="%{name}-%{version}_%{release}"
    fi
    sed "s/@VERSION@/${VERSION}/g;s/@RELEASE@/${RELEASE}/g;s/@TARREDAS@/${TARNAME}/g" < packaging/rpm/libcouchbase.spec.in > libcouchbase.spec
    rpmbuild -bs --nodeps \
             --define "_source_filedigest_algorithm md5" \
             --define "_binary_filedigest_algorithm md5" \
             --define "_topdir ${PWD}" \
             --define "_sourcedir ${PWD}" \
             --define "_srcrpmdir ${PWD}" libcouchbase.spec

* Run the build

    for CONFIG in centos-5-i386 centos-5-x86_64 centos-6-i386 centos-6-x86_64; do
        mock -r $CONFIG --rebuild --resultdir=$HOME/input/$CONFIG libcouchbase-$VERSION-$RELEASE.src.rpm
    done
Something went wrong with that request. Please try again.