Skip to content

Instantly share code, notes, and snippets.

@mikulely
Created May 27, 2015 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikulely/25bd8dcfc65c69648234 to your computer and use it in GitHub Desktop.
Save mikulely/25bd8dcfc65c69648234 to your computer and use it in GitHub Desktop.
Build ceph from github on the archlinux
# This script is used to build ceph on a bare new ArchLinux.
# based on https://github.com/ido/packages-archlinux/blob/master/aur/ceph/PKGBUILD
# modified by Jiaying Ren <mikulely@gmail.com>
pkgname='ceph'
pkgdesc='Distributed, fault-tolerant file system delivering object,
block, and file storage in one unified system.'
depends=('libedit' 'libsigc++' 'gtkmm' 'btrfs-progs' 'crypto++'
'gperftools>=1.8.3-2' 'python2' 'fuse' 'keyutils'
'libatomic_ops' 'curl' 'libaio' 'fcgi' 'expat' 'boost'
'leveldb' 'xfsprogs' 'snappy')
devdepends=('base-devel' 'gdb')
makedepends=('boost' 'boost-libs' 'yasm')
install_deps () {
echo "Install deps ..."
pacman -Syyu --noconfirm
for pkg in ${devdepends[@]}, ${makedepends[@]}, ${depends[@]};
do
pacman -S --noconfirm $pkg;
done
}
srcdir="/home/ceph-lab"
source="https://github.com/ceph/ceph.git"
fetch_source () {
echo "Fetch Ceph source code..."
mkdir -p $srcdir && cd $srcdir
git clone $source
}
prepare() {
echo "Prepare $pkgname on $srcdir/$pkgname ..."
cd $srcdir/$pkgname
# "fix python scripts to use python2"
find . -type f -exec sed -i 's,^#!/usr/bin/env python$,#!/usr/bin/env python2,g' {} \;
# run setup.py script with python2
find . -type f ! -name 'tox.ini' -exec sed -i 's,python setup.py,python2 setup.py,g' {} \;
}
build() {
echo "Start build ceph on $srcdir/$pkgname ..."
cd $srcdir/$pkgname
./autogen.sh
LIBS="-lpthread -lboost_system" PYTHON=/usr/bin/python2 LDFLAGS="" ./configure \
--prefix=/usr \
--sbindir=/usr/bin \
--libexecdir=/usr/lib \
--sysconfdir=/etc \
--localstatedir=/var \
--with-radosgw
make -j32
}
package() {
cd $srcdir/$pkgname
# Some python scripts are autogenerated through Makefiles. Fix those
# too, or /usr/bin/ceph will have the wrong shebang.
find . -type f -exec sed -i 's,^#!/usr/bin/env python$,#!/usr/bin/env python2,g' {} \;
make install
}
build_ceph () {
echo $pkgdesc
install_deps
fetch_source
prepare
build
package
}
build_ceph
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment