deb-boost.sh 4.57 KB
#!/bin/bash
#
#  Copyright (C) 2008-2014 National Institute For Space Research (INPE) - Brazil.
#
#  This file is part of the TerraLib - a Framework for building GIS enabled applications.
#
#  TerraLib is free software: you can redistribute it and/or modify
#  it under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation, either version 3 of the License,
#  or (at your option) any later version.
#
#  TerraLib is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#  GNU Lesser General Public License for more details.
#
#  You should have received a copy of the GNU Lesser General Public License
#  along with TerraLib. See COPYING. If not, write to
#  TerraLib Team at <terralib-team@terralib.org>.
#
#  Description: Boost Package for Linux Ubuntu environment.
#
#  Before start, please read the "PACKAGE-INSTRUCTIONS".
#

#
# Set package info:
#
DEBNAME=terralib-boost
DEBVERSION=1.60.0
DEBARC=amd64
LIBNAME=Boost
FILENAME=boost_1_65_0.tar.gz
FOLDERNAME=boost_1_65_0
if [ -z "$OUTPUT_PATH" ]; then
  OUTPUT_PATH=`pwd`/../../../3rdparty
fi

#
# Check if the package already exist in the "OUTPUT_PATH":
#
if [ ! -f "${OUTPUT_PATH}/packages/${DEBNAME}_${DEBVERSION}_${DEBARC}.deb" ]; then
#
# Unpack source:
#
if [ ! -d "${FOLDERNAME}" ]; then
    tar xzvf ${FILENAME}
fi
#
# Create debian folder:
#
cd ${FOLDERNAME}
rm -rf debian
mkdir -p debian
#
# Create the copyright file:
#
cat > debian/copyright <<EOF
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: TerraLib ${LIBNAME} Library
Upstream-Contact: TerraLib Team <terralib-team@terralib.org>
Source: https://gitlab.dpi.inpe.br/terralib/terralib

Files: *
Copyright: Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil
License: LGPL-3.0
  TerraLib is free software, you can redistribute it and/or modify
  it under the terms of the GNU Lesser General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  TerraLib is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  GNU Lesser General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program. If not, write to TerraLib Team at <terralib-team@terralib.org>.
EOF
#
# Create the changelog (no messages needed):
#
dch --create -v ${DEBVERSION} --distribution unstable --package ${DEBNAME} ""
#
# Create control file:
#
cat > debian/control <<EOF
Source: ${DEBNAME}
Maintainer: TerraLib Team <terralib-team@terralib.org>
Section: misc
Priority: optional
Standards-Version: 3.9.2
Build-Depends: debhelper (>= 7)

Package: ${DEBNAME}
Architecture: ${DEBARC}
Depends: \${shlibs:Depends}, \${misc:Depends}, ${DEBNAME} (= ${DEBVERSION})
Description: TerraLib ${LIBNAME} Library, version ${DEBVERSION} (shared libraries)
Replaces:${DEBNAME}
EOF
#
# Create rules file:
#
cat > debian/rules <<EOF
#!/usr/bin/make -f
%:
	dh \$@
override_dh_auto_configure:
	./bootstrap.sh --prefix=`pwd`/debian/${DEBNAME}/opt/terralib/$TE_VERSION/3rdparty/ --libdir=`pwd`/debian/${DEBNAME}/opt/terralib/$TE_VERSION/3rdparty/lib
override_dh_auto_build:
	./b2 -j 4 boost.locale.iconv=off link=shared --prefix=`pwd`/debian/${DEBNAME}/opt/terralib/$TE_VERSION/3rdparty/ dll-path=`pwd`/debian/${DEBNAME}/opt/terralib/$TE_VERSION/3rdparty/lib
override_dh_auto_test:
override_dh_auto_install:
	mkdir -p debian/${DEBNAME}/opt/terralib/$TE_VERSION/3rdparty
	./b2 -j 4 boost.locale.iconv=off runtime-link=shared link=shared variant=release threading=multi --prefix=`pwd`/debian/${DEBNAME}/opt/terralib/$TE_VERSION/3rdparty/ dll-path=`pwd`/debian/${DEBNAME}/opt/terralib/$TE_VERSION/3rdparty/lib install
EOF
#
# Create some misc files:
#
echo "8" > debian/compat
mkdir -p debian/source
echo "3.0 (quilt)" > debian/source/format
#
# Build the package:
#
# To add a GnuPG key just uncomment the "-k" and change the following key.
nice -n19 ionice -c3 debuild -us -uc -b #-kFBC36213
#
# Clean debian-package folder:
#
cd ..
if [ -f "${DEBNAME}_${DEBVERSION}_${DEBARC}.deb" ]; then
  rm -rf ${FOLDERNAME}
  mkdir -p ${OUTPUT_PATH}/packages ${OUTPUT_PATH}/build-changes
  mv ${DEBNAME}_${DEBVERSION}_${DEBARC}.deb ${OUTPUT_PATH}/packages
  mv ${DEBNAME}_${DEBVERSION}_${DEBARC}.changes ${OUTPUT_PATH}/build-changes
  mv ${DEBNAME}_${DEBVERSION}_${DEBARC}.build ${OUTPUT_PATH}/build-changes
fi
fi