Merge pull request #78 from jlblancoc/debian-ppa
Integrate Debian & Ubuntu PPA scriptsrelease/4.3a0
						commit
						0c3e05f375
					
				|  | @ -0,0 +1,17 @@ | |||
| # This file shows how to build and link a user project against GTSAM using CMake | ||||
| ################################################################################### | ||||
| # To create your own project, replace "example" with the actual name of your project | ||||
| cmake_minimum_required(VERSION 3.0) | ||||
| project(example CXX) | ||||
| 
 | ||||
| # Find GTSAM, either from a local build, or from a Debian/Ubuntu package. | ||||
| find_package(GTSAM REQUIRED) | ||||
| 
 | ||||
| add_executable(example | ||||
|   main.cpp | ||||
| ) | ||||
| 
 | ||||
| # By using CMake exported targets, a simple "link" dependency introduces the | ||||
| # include directories (-I) flags, links against Boost, and add any other | ||||
| # required build flags (e.g. C++11, etc.) | ||||
| target_link_libraries(example PRIVATE gtsam) | ||||
|  | @ -0,0 +1,127 @@ | |||
| /* ----------------------------------------------------------------------------
 | ||||
|  * GTSAM Copyright 2010, Georgia Tech Research Corporation, | ||||
|  * Atlanta, Georgia 30332-0415 | ||||
|  * All Rights Reserved | ||||
|  * Authors: Frank Dellaert, et al. (see THANKS for the full author list) | ||||
|  * See LICENSE for the license information | ||||
|  * -------------------------------------------------------------------------- */ | ||||
| 
 | ||||
| /**
 | ||||
|  * @file Pose2SLAMExample.cpp | ||||
|  * @brief A 2D Pose SLAM example | ||||
|  * @date Oct 21, 2010 | ||||
|  * @author Yong Dian Jian | ||||
|  */ | ||||
| 
 | ||||
| /**
 | ||||
|  * A simple 2D pose slam example | ||||
|  *  - The robot moves in a 2 meter square | ||||
|  *  - The robot moves 2 meters each step, turning 90 degrees after each step | ||||
|  *  - The robot initially faces along the X axis (horizontal, to the right in 2D) | ||||
|  *  - We have full odometry between pose | ||||
|  *  - We have a loop closure constraint when the robot returns to the first position | ||||
|  */ | ||||
| 
 | ||||
| // In planar SLAM example we use Pose2 variables (x, y, theta) to represent the robot poses
 | ||||
| #include <gtsam/geometry/Pose2.h> | ||||
| 
 | ||||
| // We will use simple integer Keys to refer to the robot poses.
 | ||||
| #include <gtsam/inference/Key.h> | ||||
| 
 | ||||
| // In GTSAM, measurement functions are represented as 'factors'. Several common factors
 | ||||
| // have been provided with the library for solving robotics/SLAM/Bundle Adjustment problems.
 | ||||
| // Here we will use Between factors for the relative motion described by odometry measurements.
 | ||||
| // We will also use a Between Factor to encode the loop closure constraint
 | ||||
| // Also, we will initialize the robot at the origin using a Prior factor.
 | ||||
| #include <gtsam/slam/PriorFactor.h> | ||||
| #include <gtsam/slam/BetweenFactor.h> | ||||
| 
 | ||||
| // When the factors are created, we will add them to a Factor Graph. As the factors we are using
 | ||||
| // are nonlinear factors, we will need a Nonlinear Factor Graph.
 | ||||
| #include <gtsam/nonlinear/NonlinearFactorGraph.h> | ||||
| 
 | ||||
| // Finally, once all of the factors have been added to our factor graph, we will want to
 | ||||
| // solve/optimize to graph to find the best (Maximum A Posteriori) set of variable values.
 | ||||
| // GTSAM includes several nonlinear optimizers to perform this step. Here we will use the
 | ||||
| // a Gauss-Newton solver
 | ||||
| #include <gtsam/nonlinear/GaussNewtonOptimizer.h> | ||||
| 
 | ||||
| // Once the optimized values have been calculated, we can also calculate the marginal covariance
 | ||||
| // of desired variables
 | ||||
| #include <gtsam/nonlinear/Marginals.h> | ||||
| 
 | ||||
| // The nonlinear solvers within GTSAM are iterative solvers, meaning they linearize the
 | ||||
| // nonlinear functions around an initial linearization point, then solve the linear system
 | ||||
| // to update the linearization point. This happens repeatedly until the solver converges
 | ||||
| // to a consistent set of variable values. This requires us to specify an initial guess
 | ||||
| // for each variable, held in a Values container.
 | ||||
| #include <gtsam/nonlinear/Values.h> | ||||
| 
 | ||||
| 
 | ||||
| using namespace std; | ||||
| using namespace gtsam; | ||||
| 
 | ||||
| int main(int argc, char** argv) { | ||||
| 
 | ||||
|   // 1. Create a factor graph container and add factors to it
 | ||||
|   NonlinearFactorGraph graph; | ||||
| 
 | ||||
|   // 2a. Add a prior on the first pose, setting it to the origin
 | ||||
|   // A prior factor consists of a mean and a noise model (covariance matrix)
 | ||||
|   noiseModel::Diagonal::shared_ptr priorNoise = noiseModel::Diagonal::Sigmas(Vector3(0.3, 0.3, 0.1)); | ||||
|   graph.emplace_shared<PriorFactor<Pose2> >(1, Pose2(0, 0, 0), priorNoise); | ||||
| 
 | ||||
|   // For simplicity, we will use the same noise model for odometry and loop closures
 | ||||
|   noiseModel::Diagonal::shared_ptr model = noiseModel::Diagonal::Sigmas(Vector3(0.2, 0.2, 0.1)); | ||||
| 
 | ||||
|   // 2b. Add odometry factors
 | ||||
|   // Create odometry (Between) factors between consecutive poses
 | ||||
|   graph.emplace_shared<BetweenFactor<Pose2> >(1, 2, Pose2(2, 0, 0     ), model); | ||||
|   graph.emplace_shared<BetweenFactor<Pose2> >(2, 3, Pose2(2, 0, M_PI_2), model); | ||||
|   graph.emplace_shared<BetweenFactor<Pose2> >(3, 4, Pose2(2, 0, M_PI_2), model); | ||||
|   graph.emplace_shared<BetweenFactor<Pose2> >(4, 5, Pose2(2, 0, M_PI_2), model); | ||||
| 
 | ||||
|   // 2c. Add the loop closure constraint
 | ||||
|   // This factor encodes the fact that we have returned to the same pose. In real systems,
 | ||||
|   // these constraints may be identified in many ways, such as appearance-based techniques
 | ||||
|   // with camera images. We will use another Between Factor to enforce this constraint:
 | ||||
|   graph.emplace_shared<BetweenFactor<Pose2> >(5, 2, Pose2(2, 0, M_PI_2), model); | ||||
|   graph.print("\nFactor Graph:\n"); // print
 | ||||
| 
 | ||||
|   // 3. Create the data structure to hold the initialEstimate estimate to the solution
 | ||||
|   // For illustrative purposes, these have been deliberately set to incorrect values
 | ||||
|   Values initialEstimate; | ||||
|   initialEstimate.insert(1, Pose2(0.5, 0.0,  0.2   )); | ||||
|   initialEstimate.insert(2, Pose2(2.3, 0.1, -0.2   )); | ||||
|   initialEstimate.insert(3, Pose2(4.1, 0.1,  M_PI_2)); | ||||
|   initialEstimate.insert(4, Pose2(4.0, 2.0,  M_PI  )); | ||||
|   initialEstimate.insert(5, Pose2(2.1, 2.1, -M_PI_2)); | ||||
|   initialEstimate.print("\nInitial Estimate:\n"); // print
 | ||||
| 
 | ||||
|   // 4. Optimize the initial values using a Gauss-Newton nonlinear optimizer
 | ||||
|   // The optimizer accepts an optional set of configuration parameters,
 | ||||
|   // controlling things like convergence criteria, the type of linear
 | ||||
|   // system solver to use, and the amount of information displayed during
 | ||||
|   // optimization. We will set a few parameters as a demonstration.
 | ||||
|   GaussNewtonParams parameters; | ||||
|   // Stop iterating once the change in error between steps is less than this value
 | ||||
|   parameters.relativeErrorTol = 1e-5; | ||||
|   // Do not perform more than N iteration steps
 | ||||
|   parameters.maxIterations = 100; | ||||
|   // Create the optimizer ...
 | ||||
|   GaussNewtonOptimizer optimizer(graph, initialEstimate, parameters); | ||||
|   // ... and optimize
 | ||||
|   Values result = optimizer.optimize(); | ||||
|   result.print("Final Result:\n"); | ||||
| 
 | ||||
|   // 5. Calculate and print marginal covariances for all variables
 | ||||
|   cout.precision(3); | ||||
|   Marginals marginals(graph, result); | ||||
|   cout << "x1 covariance:\n" << marginals.marginalCovariance(1) << endl; | ||||
|   cout << "x2 covariance:\n" << marginals.marginalCovariance(2) << endl; | ||||
|   cout << "x3 covariance:\n" << marginals.marginalCovariance(3) << endl; | ||||
|   cout << "x4 covariance:\n" << marginals.marginalCovariance(4) << endl; | ||||
|   cout << "x5 covariance:\n" << marginals.marginalCovariance(5) << endl; | ||||
| 
 | ||||
|   return 0; | ||||
| } | ||||
|  | @ -0,0 +1,12 @@ | |||
| # How to build a GTSAM debian package | ||||
| 
 | ||||
| To use the ``debuild`` command, install the ``devscripts`` package | ||||
| 
 | ||||
|     sudo apt install devscripts | ||||
| 
 | ||||
| Change into the gtsam directory, then run: | ||||
| 
 | ||||
|     debuild -us -uc -j4 | ||||
| 
 | ||||
| Adjust the ``-j4`` depending on how many CPUs you want to build on in | ||||
| parallel.  | ||||
|  | @ -0,0 +1,5 @@ | |||
| gtsam (4.0.0-1berndpfrommer) bionic; urgency=medium | ||||
| 
 | ||||
|   * initial release | ||||
| 
 | ||||
|  -- Bernd Pfrommer <bernd.pfrommer@gmail.com>  Wed, 18 Jul 2018 20:36:44 -0400 | ||||
|  | @ -0,0 +1 @@ | |||
| 9 | ||||
|  | @ -0,0 +1,15 @@ | |||
| Source: gtsam | ||||
| Section: libs | ||||
| Priority: optional | ||||
| Maintainer: Frank Dellaert <frank@cc.gatech.edu> | ||||
| Uploaders: Jose Luis Blanco Claraco <joseluisblancoc@gmail.com>, Bernd Pfrommer <bernd.pfrommer@gmail.com> | ||||
| Build-Depends: cmake, libboost-all-dev (>= 1.58), libeigen3-dev, libtbb-dev, debhelper (>=9) | ||||
| Standards-Version: 3.9.7 | ||||
| Homepage: https://github.com/borglab/gtsam | ||||
| Vcs-Browser: https://github.com/borglab/gtsam | ||||
| 
 | ||||
| Package: libgtsam-dev | ||||
| Architecture: any | ||||
| Depends: ${shlibs:Depends}, ${misc:Depends} | ||||
| Description: Georgia Tech Smoothing and Mapping Library | ||||
|  gtsam: Georgia Tech Smoothing and Mapping library for SLAM type applications | ||||
|  | @ -0,0 +1,15 @@ | |||
| Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | ||||
| Upstream-Name: gtsam | ||||
| Source: https://bitbucket.org/gtborg/gtsam.git | ||||
| 
 | ||||
| Files: * | ||||
| Copyright: 2017, Frank Dellaert | ||||
| License: BSD | ||||
| 
 | ||||
| Files: gtsam/3rdparty/CCOLAMD/* | ||||
| Copyright: 2005-2011, Univ. of Florida.  Authors: Timothy A. Davis, Sivasankaran Rajamanickam, and Stefan Larimore.  Closely based on COLAMD by Davis, Stefan Larimore, in collaboration with Esmond Ng, and John Gilbert. http://www.cise.ufl.edu/research/sparse | ||||
| License: GNU LESSER GENERAL PUBLIC LICENSE | ||||
| 
 | ||||
| Files: gtsam/3rdparty/Eigen/* | ||||
| Copyright: 2017, Multiple Authors | ||||
| License: MPL2 | ||||
|  | @ -0,0 +1,25 @@ | |||
| #!/usr/bin/make -f | ||||
| # See debhelper(7) (uncomment to enable) | ||||
| # output every command that modifies files on the build system. | ||||
| export DH_VERBOSE = 1 | ||||
| 
 | ||||
| 
 | ||||
| # see FEATURE AREAS in dpkg-buildflags(1) | ||||
| #export DEB_BUILD_MAINT_OPTIONS = hardening=+all | ||||
| 
 | ||||
| # see ENVIRONMENT in dpkg-buildflags(1) | ||||
| # package maintainers to append CFLAGS | ||||
| #export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic | ||||
| # package maintainers to append LDFLAGS | ||||
| #export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed | ||||
| 
 | ||||
| 
 | ||||
| %: | ||||
| 	dh $@ --parallel | ||||
| 
 | ||||
| 
 | ||||
| # dh_make generated override targets | ||||
| # This is example for Cmake (See https://bugs.debian.org/641051 ) | ||||
| override_dh_auto_configure: | ||||
| 	dh_auto_configure -- -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF -DGTSAM_BUILD_TESTS=OFF -DGTSAM_BUILD_WRAP=OFF -DGTSAM_BUILD_DOCS=OFF -DGTSAM_INSTALL_CPPUNITLITE=OFF -DGTSAM_INSTALL_GEOGRAPHICLIB=OFF -DGTSAM_BUILD_TYPE_POSTFIXES=OFF | ||||
| 
 | ||||
|  | @ -0,0 +1 @@ | |||
| 3.0 (quilt) | ||||
|  | @ -0,0 +1,14 @@ | |||
| 
 | ||||
| # How to generate Debian packages | ||||
| 
 | ||||
|     cd [GTSAM_SOURCE_ROOT] | ||||
|     bash package_scripts/prepare_debian.sh | ||||
| 
 | ||||
| 
 | ||||
| # How to generate Ubuntu packages for a PPA | ||||
| 
 | ||||
|     cd [GTSAM_SOURCE_ROOT] | ||||
|     bash package_scripts/prepare_ubuntu_pkgs_for_ppa.sh | ||||
|     cd ~/gtsam_ubuntu | ||||
|     bash [GTSAM_SOURCE_ROOT]/upload_all_gtsam_ppa.sh | ||||
| 
 | ||||
|  | @ -0,0 +1,179 @@ | |||
| #!/bin/bash | ||||
| # Prepare to build a Debian package. | ||||
| # Jose Luis Blanco Claraco, 2019 (for GTSAM) | ||||
| # Jose Luis Blanco Claraco, 2008-2018 (for MRPT) | ||||
| 
 | ||||
| set -e   # end on error | ||||
| #set -x  # for debugging | ||||
| 
 | ||||
| APPEND_SNAPSHOT_NUM=0 | ||||
| IS_FOR_UBUNTU=0 | ||||
| APPEND_LINUX_DISTRO="" | ||||
| VALUE_EXTRA_CMAKE_PARAMS="" | ||||
| while getopts "sud:c:" OPTION | ||||
| do | ||||
|      case $OPTION in | ||||
|          s) | ||||
|              APPEND_SNAPSHOT_NUM=1 | ||||
|              ;; | ||||
|          u) | ||||
|              IS_FOR_UBUNTU=1 | ||||
|              ;; | ||||
|          d) | ||||
|              APPEND_LINUX_DISTRO=$OPTARG | ||||
|              ;; | ||||
|          c) | ||||
|              VALUE_EXTRA_CMAKE_PARAMS=$OPTARG | ||||
|              ;; | ||||
|          ?) | ||||
|              echo "Unknown command line argument!" | ||||
|              exit 1 | ||||
|              ;; | ||||
|      esac | ||||
| done | ||||
| 
 | ||||
| if [ -f CMakeLists.txt ]; | ||||
| then | ||||
|   source package_scripts/prepare_debian_gen_snapshot_version.sh | ||||
| else | ||||
| 	echo "Error: cannot find CMakeList.txt. This script is intended to be run from the root of the source tree." | ||||
| 	exit 1 | ||||
| fi | ||||
| 
 | ||||
| # Append snapshot? | ||||
| if [ $APPEND_SNAPSHOT_NUM == "1" ]; | ||||
| then | ||||
|         CUR_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||||
|         source $CUR_SCRIPT_DIR/prepare_debian_gen_snapshot_version.sh  # populate GTSAM_SNAPSHOT_VERSION | ||||
| 
 | ||||
|         GTSAM_VERSION_STR="${GTSAM_VERSION_STR}~snapshot${GTSAM_SNAPSHOT_VERSION}${APPEND_LINUX_DISTRO}" | ||||
| else | ||||
|         GTSAM_VERSION_STR="${GTSAM_VERSION_STR}${APPEND_LINUX_DISTRO}" | ||||
| fi | ||||
| 
 | ||||
| # Call prepare_release | ||||
| GTSAMSRC=`pwd` | ||||
| 
 | ||||
| if [ -f $HOME/gtsam_release/gtsam*.tar.gz ]; | ||||
| then | ||||
|   echo "## release file already exists. Reusing it." | ||||
| else | ||||
|   source package_scripts/prepare_release.sh | ||||
|   echo | ||||
|   echo "## Done prepare_release.sh" | ||||
| fi | ||||
| 
 | ||||
| echo "=========== Generating GTSAM ${GTSAM_VER_MMP} Debian package ==============" | ||||
| cd $GTSAMSRC | ||||
| 
 | ||||
| set -x | ||||
| if [ -z "$GTSAM_DEB_DIR" ]; then | ||||
|         GTSAM_DEB_DIR="$HOME/gtsam_debian" | ||||
| fi | ||||
| GTSAM_EXTERN_DEBIAN_DIR="$GTSAMSRC/debian/" | ||||
| GTSAM_EXTERN_UBUNTU_PPA_DIR="$GTSAMSRC/debian/" | ||||
| 
 | ||||
| if [ -f ${GTSAM_EXTERN_DEBIAN_DIR}/control ]; | ||||
| then | ||||
| 	echo "Using debian dir: ${GTSAM_EXTERN_DEBIAN_DIR}" | ||||
| else | ||||
| 	echo "ERROR: Cannot find ${GTSAM_EXTERN_DEBIAN_DIR}" | ||||
| 	exit 1 | ||||
| fi | ||||
| 
 | ||||
| GTSAM_DEBSRC_DIR=$GTSAM_DEB_DIR/gtsam-${GTSAM_VERSION_STR} | ||||
| 
 | ||||
| echo "GTSAM_VERSION_STR: ${GTSAM_VERSION_STR}" | ||||
| echo "GTSAM_DEBSRC_DIR: ${GTSAM_DEBSRC_DIR}" | ||||
| 
 | ||||
| # Prepare a directory for building the debian package: | ||||
| # | ||||
| rm -fR $GTSAM_DEB_DIR || true | ||||
| mkdir -p $GTSAM_DEB_DIR  || true | ||||
| 
 | ||||
| # Orig tarball: | ||||
| echo "Copying orig tarball: gtsam_${GTSAM_VERSION_STR}.orig.tar.gz" | ||||
| cp $HOME/gtsam_release/gtsam*.tar.gz $GTSAM_DEB_DIR/gtsam_${GTSAM_VERSION_STR}.orig.tar.gz | ||||
| cd ${GTSAM_DEB_DIR} | ||||
| tar -xf gtsam_${GTSAM_VERSION_STR}.orig.tar.gz | ||||
| 
 | ||||
| if [ ! -d "${GTSAM_DEBSRC_DIR}" ]; | ||||
| then | ||||
|   mv gtsam-* ${GTSAM_DEBSRC_DIR}  # fix different dir names for Ubuntu PPA packages | ||||
| fi | ||||
| 
 | ||||
| if [ ! -f "${GTSAM_DEBSRC_DIR}/CMakeLists.txt" ]; | ||||
| then | ||||
| 	echo "*ERROR*: Seems there was a problem copying sources to ${GTSAM_DEBSRC_DIR}... aborting script." | ||||
| 	exit 1 | ||||
| fi | ||||
| 
 | ||||
| cd ${GTSAM_DEBSRC_DIR} | ||||
| 
 | ||||
| # Copy debian directory: | ||||
| #mkdir debian | ||||
| cp -r ${GTSAM_EXTERN_DEBIAN_DIR}/* debian | ||||
| 
 | ||||
| # Use modified control & rules files for Ubuntu PPA packages: | ||||
| #if [ $IS_FOR_UBUNTU == "1" ]; | ||||
| #then | ||||
| 	# already done: cp ${GTSAM_EXTERN_UBUNTU_PPA_DIR}/control.in debian/ | ||||
|   # Ubuntu: force use of gcc-7: | ||||
|   #sed -i '9i\export CXX=/usr/bin/g++-7\' debian/rules | ||||
|   #sed -i '9i\export CC=/usr/bin/gcc-7\' debian/rules7 | ||||
| #fi | ||||
| 
 | ||||
| # Export signing pub key: | ||||
| mkdir debian/upstream/ | ||||
| gpg --export --export-options export-minimal --armor > debian/upstream/signing-key.asc | ||||
| 
 | ||||
| # Parse debian/ control.in --> control | ||||
| #mv debian/control.in debian/control | ||||
| #sed -i "s/@GTSAM_VER_MM@/${GTSAM_VER_MM}/g" debian/control | ||||
| 
 | ||||
| # Replace the text "REPLACE_HERE_EXTRA_CMAKE_PARAMS" in the "debian/rules" file | ||||
| # with: ${${VALUE_EXTRA_CMAKE_PARAMS}} | ||||
| RULES_FILE=debian/rules | ||||
| sed -i -e "s/REPLACE_HERE_EXTRA_CMAKE_PARAMS/${VALUE_EXTRA_CMAKE_PARAMS}/g" $RULES_FILE | ||||
| echo "Using these extra parameters for CMake: '${VALUE_EXTRA_CMAKE_PARAMS}'" | ||||
| 
 | ||||
| # Strip my custom files... | ||||
| rm debian/*.new || true | ||||
| 
 | ||||
| 
 | ||||
| # Figure out the next Debian version number: | ||||
| echo "Detecting next Debian version number..." | ||||
| 
 | ||||
| CHANGELOG_UPSTREAM_VER=$( dpkg-parsechangelog | sed -n 's/Version:.*\([0-9]\.[0-9]*\.[0-9]*.*snapshot.*\)-.*/\1/p' ) | ||||
| CHANGELOG_LAST_DEBIAN_VER=$( dpkg-parsechangelog | sed -n 's/Version:.*\([0-9]\.[0-9]*\.[0-9]*\).*-\([0-9]*\).*/\2/p' ) | ||||
| 
 | ||||
| echo " -> PREVIOUS UPSTREAM: $CHANGELOG_UPSTREAM_VER -> New: ${GTSAM_VERSION_STR}" | ||||
| echo " -> PREVIOUS DEBIAN VERSION: $CHANGELOG_LAST_DEBIAN_VER" | ||||
| 
 | ||||
| # If we have the same upstream versions, increase the Debian version, otherwise create a new entry: | ||||
| if [ "$CHANGELOG_UPSTREAM_VER" = "$GTSAM_VERSION_STR" ]; | ||||
| then | ||||
| 	NEW_DEBIAN_VER=$[$CHANGELOG_LAST_DEBIAN_VER + 1] | ||||
| 	echo "Changing to a new Debian version: ${GTSAM_VERSION_STR}-${NEW_DEBIAN_VER}" | ||||
| 	DEBCHANGE_CMD="--newversion ${GTSAM_VERSION_STR}-${NEW_DEBIAN_VER}" | ||||
| else | ||||
| 	DEBCHANGE_CMD="--newversion ${GTSAM_VERSION_STR}-1" | ||||
| fi | ||||
| 
 | ||||
| echo "Adding a new entry to debian/changelog..." | ||||
| 
 | ||||
| DEBEMAIL="Jose Luis Blanco Claraco <joseluisblancoc@gmail.com>" debchange $DEBCHANGE_CMD -b --distribution unstable --force-distribution New version of upstream sources. | ||||
| 
 | ||||
| echo "Copying back the new changelog to a temporary file in: ${GTSAM_EXTERN_DEBIAN_DIR}changelog.new" | ||||
| cp debian/changelog ${GTSAM_EXTERN_DEBIAN_DIR}changelog.new | ||||
| 
 | ||||
| set +x | ||||
| 
 | ||||
| echo "==============================================================" | ||||
| echo "Now, you can build the source Deb package with 'debuild -S -sa'" | ||||
| echo "==============================================================" | ||||
| 
 | ||||
| cd .. | ||||
| ls -lh | ||||
| 
 | ||||
| exit 0 | ||||
|  | @ -0,0 +1,25 @@ | |||
| #!/bin/bash | ||||
| 
 | ||||
| # See https://reproducible-builds.org/specs/source-date-epoch/ | ||||
| # get SOURCE_DATE_EPOCH with UNIX time_t | ||||
| if [ -d ".git" ]; | ||||
| then | ||||
|   SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) | ||||
| else | ||||
|   echo "Error: intended for use from within a git repository" | ||||
|   exit 1 | ||||
| fi | ||||
| GTSAM_SNAPSHOT_VERSION=$(date -d @$SOURCE_DATE_EPOCH +%Y%m%d-%H%M) | ||||
| 
 | ||||
| GTSAM_SNAPSHOT_VERSION+="-git-" | ||||
| GTSAM_SNAPSHOT_VERSION+=`git rev-parse --short=8 HEAD` | ||||
| GTSAM_SNAPSHOT_VERSION+="-" | ||||
| 
 | ||||
| # x.y.z version components: | ||||
| GTSAM_VERSION_MAJOR=$(grep "(GTSAM_VERSION_MAJOR" CMakeLists.txt | sed -r 's/^.*GTSAM_VERSION_MAJOR\s*([0-9])*.*$/\1/g') | ||||
| GTSAM_VERSION_MINOR=$(grep "(GTSAM_VERSION_MINOR" CMakeLists.txt | sed -r 's/^.*GTSAM_VERSION_MINOR\s*([0-9])*.*$/\1/g') | ||||
| GTSAM_VERSION_PATCH=$(grep "(GTSAM_VERSION_PATCH" CMakeLists.txt | sed -r 's/^.*GTSAM_VERSION_PATCH\s*([0-9])*.*$/\1/g') | ||||
| 
 | ||||
| GTSAM_VER_MM="${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}" | ||||
| GTSAM_VER_MMP="${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}" | ||||
| GTSAM_VERSION_STR=$GTSAM_VER_MMP | ||||
|  | @ -0,0 +1,71 @@ | |||
| #!/bin/bash | ||||
| # Export sources from a git tree and prepare it for a public release. | ||||
| # Jose Luis Blanco Claraco, 2019 (for GTSAM) | ||||
| # Jose Luis Blanco Claraco, 2008-2018 (for MRPT) | ||||
| 
 | ||||
| set -e  # exit on error | ||||
| #set -x  # for debugging | ||||
| 
 | ||||
| # Checks | ||||
| # -------------------------------- | ||||
| if [ -f version_prefix.txt ]; | ||||
| then | ||||
| 	if [ -z ${GTSAM_VERSION_STR+x} ]; | ||||
| 	then | ||||
| 		source package_scripts/prepare_debian_gen_snapshot_version.sh | ||||
| 	fi | ||||
| 	echo "ERROR: Run this script from the GTSAM source tree root directory." | ||||
| 	exit 1 | ||||
| fi | ||||
| 
 | ||||
| GTSAM_SRC=`pwd` | ||||
| OUT_RELEASES_DIR="$HOME/gtsam_release" | ||||
| 
 | ||||
| OUT_DIR=$OUT_RELEASES_DIR/gtsam-${GTSAM_VERSION_STR} | ||||
| 
 | ||||
| echo "=========== Generating GTSAM release ${GTSAM_VER_MMP} ==================" | ||||
| echo "GTSAM_VERSION_STR   : ${GTSAM_VERSION_STR}" | ||||
| echo "OUT_DIR            : ${OUT_DIR}" | ||||
| echo "============================================================" | ||||
| echo | ||||
| 
 | ||||
| # Prepare output directory: | ||||
| rm -fR $OUT_RELEASES_DIR  || true | ||||
| mkdir -p ${OUT_DIR} | ||||
| 
 | ||||
| # Export / copy sources to target dir: | ||||
| if [ -d "$GTSAM_SRC/.git" ]; | ||||
| then | ||||
| 	echo "# Exporting git source tree to ${OUT_DIR}" | ||||
| 	git archive --format=tar HEAD | tar -x -C ${OUT_DIR} | ||||
| 
 | ||||
| 	# Remove VCS control files: | ||||
| 	find ${OUT_DIR} -name '.gitignore' | xargs rm | ||||
| 
 | ||||
| 	# Generate ./SOURCE_DATE_EPOCH with UNIX time_t | ||||
| 	SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) | ||||
| else | ||||
| 	echo "# Copying sources to ${OUT_DIR}" | ||||
| 	cp -R . ${OUT_DIR} | ||||
| 
 | ||||
| 	# Generate ./SOURCE_DATE_EPOCH with UNIX time_t | ||||
| 	SOURCE_DATE_EPOCH=$(date +%s) | ||||
| fi | ||||
| 
 | ||||
| # See https://reproducible-builds.org/specs/source-date-epoch/ | ||||
| echo $SOURCE_DATE_EPOCH > ${OUT_DIR}/SOURCE_DATE_EPOCH | ||||
| 
 | ||||
| cd ${OUT_DIR} | ||||
| 
 | ||||
| # Dont include Debian files in releases: | ||||
| rm -fR package_scripts | ||||
| 
 | ||||
| # Orig tarball: | ||||
| cd .. | ||||
| echo "# Creating orig tarball: gtsam-${GTSAM_VERSION_STR}.tar.gz" | ||||
| tar czf gtsam-${GTSAM_VERSION_STR}.tar.gz gtsam-${GTSAM_VERSION_STR} | ||||
| 
 | ||||
| rm -fr gtsam-${GTSAM_VERSION_STR} | ||||
| 
 | ||||
| # GPG signature: | ||||
| gpg --armor --detach-sign gtsam-${GTSAM_VERSION_STR}.tar.gz | ||||
|  | @ -0,0 +1,90 @@ | |||
| #!/bin/bash | ||||
| # Creates a set of packages for each different Ubuntu distribution, with the | ||||
| # intention of uploading them to: | ||||
| #   https://launchpad.net/~joseluisblancoc/ | ||||
| # | ||||
| # JLBC, 2010 | ||||
| # [Addition 2012:] | ||||
| # | ||||
| # You can declare a variable (in the caller shell) with extra flags for the | ||||
| # CMake in the final ./configure like: | ||||
| #  GTSAM_PKG_CUSTOM_CMAKE_PARAMS="\"-DDISABLE_SSE3=ON\"" | ||||
| # | ||||
| 
 | ||||
| set -e | ||||
| 
 | ||||
| # List of distributions to create PPA packages for: | ||||
| LST_DISTROS=(xenial bionic cosmic disco) | ||||
| 
 | ||||
| # Checks | ||||
| # -------------------------------- | ||||
| if [ -f CMakeLists.txt ]; | ||||
| then | ||||
| 	source package_scripts/prepare_debian_gen_snapshot_version.sh | ||||
| 	echo "GTSAM version: ${GTSAM_VER_MMP}" | ||||
| else | ||||
| 	echo "ERROR: Run this script from the GTSAM root directory." | ||||
| 	exit 1 | ||||
| fi | ||||
| 
 | ||||
| if [ -z "${gtsam_ubuntu_OUT_DIR}" ]; then | ||||
|        export gtsam_ubuntu_OUT_DIR="$HOME/gtsam_ubuntu" | ||||
| fi | ||||
| GTSAMSRC=`pwd` | ||||
| if [ -z "${GTSAM_DEB_DIR}" ]; then | ||||
|        export GTSAM_DEB_DIR="$HOME/gtsam_debian" | ||||
| fi | ||||
| GTSAM_EXTERN_DEBIAN_DIR="$GTSAMSRC/debian/" | ||||
| EMAIL4DEB="Jose Luis Blanco (University of Malaga) <joseluisblancoc@gmail.com>" | ||||
| 
 | ||||
| # Clean out dirs: | ||||
| rm -fr $gtsam_ubuntu_OUT_DIR/ | ||||
| 
 | ||||
| # ------------------------------------------------------------------- | ||||
| # And now create the custom packages for each Ubuntu distribution: | ||||
| # ------------------------------------------------------------------- | ||||
| count=${#LST_DISTROS[@]} | ||||
| IDXS=$(seq 0 $(expr $count - 1)) | ||||
| 
 | ||||
| cp ${GTSAM_EXTERN_DEBIAN_DIR}/changelog /tmp/my_changelog | ||||
| 
 | ||||
| for IDX in ${IDXS}; | ||||
| do | ||||
| 	DEBIAN_DIST=${LST_DISTROS[$IDX]} | ||||
| 
 | ||||
| 	# ------------------------------------------------------------------- | ||||
| 	# Call the standard "prepare_debian.sh" script: | ||||
| 	# ------------------------------------------------------------------- | ||||
| 	cd ${GTSAMSRC} | ||||
| 	bash package_scripts/prepare_debian.sh -s -u -d ${DEBIAN_DIST}   -c "${GTSAM_PKG_CUSTOM_CMAKE_PARAMS}" | ||||
| 
 | ||||
| 	CUR_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||||
| 	source $CUR_SCRIPT_DIR/prepare_debian_gen_snapshot_version.sh # populate GTSAM_SNAPSHOT_VERSION | ||||
| 
 | ||||
| 	echo "===== Distribution: ${DEBIAN_DIST}  =========" | ||||
| 	cd ${GTSAM_DEB_DIR}/gtsam-${GTSAM_VER_MMP}~snapshot${GTSAM_SNAPSHOT_VERSION}${DEBIAN_DIST}/debian | ||||
| 	#cp ${GTSAM_EXTERN_DEBIAN_DIR}/changelog changelog | ||||
| 	cp /tmp/my_changelog changelog | ||||
| 	DEBCHANGE_CMD="--newversion ${GTSAM_VERSION_STR}~snapshot${GTSAM_SNAPSHOT_VERSION}${DEBIAN_DIST}-1" | ||||
| 	echo "Changing to a new Debian version: ${DEBCHANGE_CMD}" | ||||
| 	echo "Adding a new entry to debian/changelog for distribution ${DEBIAN_DIST}" | ||||
| 	DEBEMAIL="Jose Luis Blanco Claraco <joseluisblancoc@gmail.com>" debchange $DEBCHANGE_CMD -b --distribution ${DEBIAN_DIST} --force-distribution New version of upstream sources. | ||||
| 
 | ||||
| 	cp changelog /tmp/my_changelog | ||||
| 
 | ||||
| 	echo "Now, let's build the source Deb package with 'debuild -S -sa':" | ||||
| 	cd .. | ||||
| 	# -S: source package | ||||
| 	# -sa: force inclusion of sources | ||||
| 	# -d: don't check dependencies in this system | ||||
| 	debuild -S -sa -d | ||||
| 
 | ||||
| 	# Make a copy of all these packages: | ||||
| 	cd .. | ||||
| 	mkdir -p $gtsam_ubuntu_OUT_DIR/$DEBIAN_DIST | ||||
| 	cp gtsam_* $gtsam_ubuntu_OUT_DIR/${DEBIAN_DIST}/ | ||||
| 	echo ">>>>>> Saving packages to: $gtsam_ubuntu_OUT_DIR/$DEBIAN_DIST/" | ||||
| done | ||||
| 
 | ||||
| 
 | ||||
| exit 0 | ||||
|  | @ -0,0 +1,3 @@ | |||
| #!/bin/bash | ||||
| 
 | ||||
| find . -name '*.changes' | xargs -I FIL dput ppa:joseluisblancoc/gtsam-develop FIL | ||||
		Loading…
	
		Reference in New Issue