-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate RPI build with shell script;
- Loading branch information
Showing
2 changed files
with
331 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# output folders | ||
build/ | ||
seafile-sources/ | ||
seafile-server-pkgs/ | ||
|
||
# build artefacts | ||
.build.sh.swp | ||
|
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,323 @@ | ||
#!/bin/sh | ||
|
||
# | ||
# CONST | ||
# | ||
|
||
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" | ||
BUILDFOLDER=build | ||
THIRDPARTYFOLDER=$SCRIPTPATH/$BUILDFOLDER/seahub_thirdparty | ||
PKGSOURCEDIR=seafile-sources | ||
PKGDIR=seafile-server-pkgs | ||
|
||
LIBSEARPC_VERSION=3.1.0 | ||
LIBSEARPC_TAG=v$LIBSEARPC_VERSION | ||
VERSION=7.0.4 | ||
VERSION_TAG=v$VERSION-server | ||
VERSION_CCNET=6.0.1 # seafile/ccnet has not consistent version (see configure.ac) | ||
VERSION_SEAFILE=6.0.1 | ||
|
||
STEPS=11 | ||
|
||
# | ||
# INSTALL DEPENDENCIES | ||
# | ||
|
||
install_dependencies() | ||
{ | ||
echo | ||
echo -e "\e[93m-> [1/$STEPS] Install dependencies\e[39m" | ||
|
||
# https://github.com/haiwen/seafile/issues/1158 | ||
# onigposix (libonig-dev) is dependency for /usr/local/include/evhtp.h | ||
|
||
apt-get update | ||
apt-get install -y build-essential | ||
apt-get install -y \ | ||
libevent-dev \ | ||
libcurl4-openssl-dev \ | ||
libglib2.0-dev \ | ||
uuid-dev \ | ||
intltool \ | ||
libsqlite3-dev \ | ||
libmysqlclient-dev \ | ||
libarchive-dev \ | ||
libtool \ | ||
libjansson-dev \ | ||
valac \ | ||
libfuse-dev \ | ||
re2c \ | ||
flex \ | ||
python-setuptools \ | ||
cmake \ | ||
libpq-dev \ | ||
ldap-client \ | ||
libldap-dev \ | ||
libonig-dev | ||
} | ||
|
||
# | ||
# BUILD libevhtp | ||
# | ||
|
||
build_libevhtp() | ||
{ | ||
echo | ||
echo -e "\e[93m-> [2/$STEPS] Build libevhtp\e[39m" | ||
|
||
mkdir $BUILDFOLDER | ||
cd $BUILDFOLDER | ||
|
||
if [ -d "libevhtp" ]; then | ||
cd libevhtp | ||
git pull | ||
else | ||
git clone https://www.github.com/haiwen/libevhtp.git | ||
cd libevhtp | ||
fi | ||
cmake -DEVHTP_DISABLE_SSL=ON -DEVHTP_BUILD_SHARED=OFF . | ||
make | ||
make install | ||
cd $SCRIPTPATH | ||
|
||
# update system lib cache | ||
ldconfig | ||
} | ||
|
||
# | ||
# Install python third party | ||
# | ||
|
||
install_python_thirdparty() | ||
{ | ||
echo | ||
echo -e "\e[93m-> [3/$STEPS] Install python libraries\e[39m" | ||
|
||
mkdir -p $THIRDPARTYFOLDER | ||
export PYTHONPATH=$THIRDPARTYFOLDER | ||
|
||
pip install --target=$PYTHONPATH --no-deps \ | ||
pytz==2016.1 \ | ||
Django==1.8.10 \ | ||
django-statici18n==1.1.3 \ | ||
djangorestframework==3.3.2 \ | ||
django_compressor==1.4 \ | ||
jsonfield==1.0.3 \ | ||
django-post_office==2.0.6 \ | ||
gunicorn==19.4.5 \ | ||
flup==1.0.2 \ | ||
chardet==2.3.0 \ | ||
python-dateutil==1.5 \ | ||
six==1.9.0 \ | ||
django-picklefield==0.3.2 \ | ||
jdcal==1.2 \ | ||
et_xmlfile==1.0.1 \ | ||
openpyxl==2.3.0 | ||
|
||
wget -O /tmp/django_constance.zip https://github.com/haiwen/django-constance/archive/bde7f7c.zip | ||
pip install --target=$PYTHONPATH /tmp/django_constance.zip | ||
} | ||
|
||
# PREPARE libs | ||
|
||
export_python_path() | ||
{ | ||
export PKG_CONFIG_PATH=$SCRIPTPATH/$BUILDFOLDER/seafile-server/lib:$PKG_CONFIG_PATH | ||
export PKG_CONFIG_PATH=$SCRIPTPATH/$BUILDFOLDER/libsearpc:$PKG_CONFIG_PATH | ||
export PKG_CONFIG_PATH=$SCRIPTPATH/$BUILDFOLDER/ccnet-server:$PKG_CONFIG_PATH | ||
} | ||
|
||
# BUILD libsearpc | ||
|
||
build_libsearpc() | ||
{ | ||
echo | ||
echo -e "\e[93m-> [4/$STEPS] Build libsearpc\e[39m" | ||
|
||
cd $BUILDFOLDER | ||
if [ -d "libsearpc" ]; then | ||
cd libsearpc | ||
git pull | ||
else | ||
git clone https://github.com/haiwen/libsearpc.git | ||
cd libsearpc | ||
fi | ||
git reset --hard $VERSION_TAG | ||
./autogen.sh | ||
./configure | ||
make dist | ||
cd $SCRIPTPATH | ||
} | ||
|
||
# BUILD ccnet | ||
|
||
build_ccnet() | ||
{ | ||
echo | ||
echo -e "\e[93m-> [5/$STEPS] Build ccnet-server\e[39m" | ||
|
||
cd $BUILDFOLDER | ||
if [ -d "ccnet-server" ]; then | ||
cd ccnet-server | ||
git pull | ||
else | ||
git clone https://github.com/haiwen/ccnet-server.git | ||
cd ccnet-server | ||
fi | ||
git reset --hard $VERSION_TAG | ||
./autogen.sh | ||
./configure | ||
make dist | ||
cd $SCRIPTPATH | ||
} | ||
|
||
# BUILD seafile | ||
|
||
build_seafile() | ||
{ | ||
echo | ||
echo -e "\e[93m-> [6/$STEPS] Build seafile-server\e[39m" | ||
|
||
cd $BUILDFOLDER | ||
if [ -d "seafile-server" ]; then | ||
cd seafile-server | ||
git pull | ||
else | ||
git clone https://github.com/haiwen/seafile-server.git | ||
cd seafile-server | ||
fi | ||
git reset --hard $VERSION_TAG | ||
./autogen.sh | ||
./configure | ||
make dist | ||
cd $SCRIPTPATH | ||
} | ||
|
||
# BUILD seahub | ||
|
||
build_seahub() | ||
{ | ||
echo | ||
echo -e "\e[93m-> [7/$STEPS] Build seahub\e[39m" | ||
|
||
export PATH=$THIRDPARTYFOLDER/django/bin:$PATH | ||
|
||
cd $BUILDFOLDER | ||
if [ -d "seahub" ]; then | ||
cd seahub | ||
git pull | ||
else | ||
git clone https://github.com/haiwen/seahub.git | ||
cd seahub | ||
fi | ||
git reset --hard $VERSION_TAG | ||
./tools/gen-tarball.py --version=$VERSION_SEAFILE --branch=HEAD # WAIT.. WHAT? | ||
cd $SCRIPTPATH | ||
} | ||
|
||
# BUILD seafobj | ||
|
||
build_seafobj() | ||
{ | ||
echo | ||
echo -e "\e[93m-> [8/$STEPS] Build seafobj\e[39m" | ||
|
||
cd $BUILDFOLDER | ||
if [ -d "seafobj" ]; then | ||
cd seafobj | ||
git pull | ||
else | ||
git clone https://github.com/haiwen/seafobj.git | ||
cd seafobj | ||
fi | ||
git reset --hard $VERSTION_TAG | ||
make dist | ||
cd $SCRIPTPATH | ||
} | ||
|
||
# BUILD seafdav | ||
|
||
build_seafdav() | ||
{ | ||
echo | ||
echo -e "\e[93m-> [9/$STEPS] Build seafdav\e[39m" | ||
|
||
cd $BUILDFOLDER | ||
if [ -d "seafdav" ]; then | ||
cd seafdav | ||
git pull | ||
else | ||
git clone https://github.com/haiwen/seafdav.git | ||
cd seafdav | ||
fi | ||
git reset --hard $VERSION_TAG | ||
make | ||
cd $SCRIPTPATH | ||
} | ||
|
||
# | ||
# Copy package source | ||
# | ||
|
||
copy_pkg_source() | ||
{ | ||
echo | ||
echo -e "\e[93m-> [10/$STEPS] Copy sources\e[39m" | ||
|
||
mkdir -p $PKGSOURCEDIR | ||
cp $BUILDFOLDER/libsearpc/libsearpc-$LIBSEARPC_VERSION.tar.gz $PKGSOURCEDIR | ||
cp $BUILDFOLDER/ccnet-server/ccnet-$VERSION_CCNET.tar.gz $PKGSOURCEDIR | ||
cp $BUILDFOLDER/seafile-server/seafile-$VERSION_SEAFILE.tar.gz $PKGSOURCEDIR | ||
cp $BUILDFOLDER/seahub/seahub-$VERSION_SEAFILE.tar.gz $PKGSOURCEDIR | ||
cp $BUILDFOLDER/seafobj/seafobj.tar.gz $PKGSOURCEDIR | ||
cp $BUILDFOLDER/seafdav/seafdav.tar.gz $PKGSOURCEDIR | ||
} | ||
|
||
# | ||
# Build server | ||
# | ||
|
||
build_server() | ||
{ | ||
echo | ||
echo -e "\e[93m-> [11/$STEPS] Build server\e[39m" | ||
|
||
mkdir -p $PKGDIR | ||
$SCRIPTPATH/$BUILDFOLDER/seafile-server/scripts/build/build-server.py \ | ||
--libsearpc_version=$LIBSEARPC_VERSION \ | ||
--ccnet_version=$VERSION_CCNET \ | ||
--seafile_version=$VERSION_SEAFILE \ | ||
--version=$VERSION \ | ||
--thirdpartdir=$THIRDPARTYFOLDER \ | ||
--srcdir=$SCRIPTPATH/$PKGSOURCEDIR \ | ||
--outputdir=$SCRIPTPATH/$PKGDIR | ||
} | ||
|
||
# | ||
# COMPLETE | ||
# | ||
|
||
echo_complete() | ||
{ | ||
echo | ||
echo -e "\e[93m-> BUILD COMPLETED.\e[39m" | ||
} | ||
|
||
# | ||
# MAIN | ||
# | ||
|
||
install_dependencies | ||
build_libevhtp | ||
|
||
install_python_thirdparty | ||
export_python_path | ||
|
||
build_libsearpc | ||
build_ccnet | ||
build_seafile | ||
build_seahub | ||
|
||
copy_pkg_source | ||
build_server | ||
echo_complete |