2020-05-25 21:52:22 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma de
|
|
|
|
# Barcelona (UAB).
|
|
|
|
#
|
|
|
|
# This work is licensed under the terms of the MIT license.
|
|
|
|
# For a copy, see <https://opensource.org/licenses/MIT>.
|
|
|
|
|
|
|
|
# This script builds a debian package for CARLA.
|
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
# $ ./CreateDebian.sh <CARLA-VERSION>
|
|
|
|
#
|
|
|
|
# Tested with Ubuntu 14.04, 16.04, 18.04 and 19.10.
|
|
|
|
#
|
|
|
|
# IMPORTANT: Add/remove the appropriate folders in Makefile at line 81.
|
|
|
|
|
|
|
|
# ==================================================================================================
|
|
|
|
# -- Variables -------------------------------------------------------------------------------------
|
|
|
|
# ==================================================================================================
|
|
|
|
|
|
|
|
if [[ -z $1 ]];
|
|
|
|
then
|
2020-05-26 15:52:34 +08:00
|
|
|
echo "$(date) - Missing mandatory arguments: CARLA version. "
|
|
|
|
echo "$(date) - Usage: ./CreateDebian.sh [version]. "
|
2020-05-25 21:52:22 +08:00
|
|
|
exit 1
|
|
|
|
fi
|
2020-03-03 18:38:08 +08:00
|
|
|
|
2020-05-25 21:52:22 +08:00
|
|
|
CARLA_VERSION=$1
|
|
|
|
CARLA_DIR=carla-simulator-${CARLA_VERSION}
|
2023-12-13 15:00:20 +08:00
|
|
|
CARLA_RELEASE_URL=https://carla-releases.s3.us-east-005.backblazeb2.com/Linux/CARLA_${CARLA_VERSION}.tar.gz
|
|
|
|
ADDITIONAL_MAPS_URL=https://carla-releases.s3.us-east-005.backblazeb2.com/Linux/AdditionalMaps_${CARLA_VERSION}.tar.gz
|
2020-02-25 17:19:02 +08:00
|
|
|
|
2020-05-25 21:52:22 +08:00
|
|
|
# Adding maintainer name.
|
2020-02-27 22:31:28 +08:00
|
|
|
DEBFULLNAME=Carla\ Simulator\ Team
|
|
|
|
export DEBFULLNAME
|
|
|
|
|
2020-05-25 21:52:22 +08:00
|
|
|
# ==================================================================================================
|
|
|
|
# -- Dependencies ----------------------------------------------------------------------------------
|
|
|
|
# ==================================================================================================
|
|
|
|
# Installing required dependencies.
|
|
|
|
sudo apt-get install build-essential dh-make
|
2020-02-27 22:31:28 +08:00
|
|
|
|
2020-05-25 21:52:22 +08:00
|
|
|
# ==================================================================================================
|
|
|
|
# -- Download --------------------------------------------------------------------------------------
|
|
|
|
# ==================================================================================================
|
2020-05-26 15:52:34 +08:00
|
|
|
mkdir -p carla-debian/"${CARLA_DIR}"
|
|
|
|
cd carla-debian/"${CARLA_DIR}"
|
2020-02-27 22:31:28 +08:00
|
|
|
|
2020-03-06 22:04:53 +08:00
|
|
|
FILE=$(pwd)/ImportAssets.sh
|
2020-02-25 17:19:02 +08:00
|
|
|
if [ -f "$FILE" ]; then
|
2020-05-25 21:52:22 +08:00
|
|
|
echo "Package already downloaded!"
|
2020-03-06 22:04:53 +08:00
|
|
|
else
|
2020-05-26 15:52:34 +08:00
|
|
|
curl "${CARLA_RELEASE_URL}" | tar xz
|
2020-03-06 22:04:53 +08:00
|
|
|
|
2020-05-26 15:52:34 +08:00
|
|
|
wget "${ADDITIONAL_MAPS_URL}"
|
|
|
|
mv AdditionalMaps_"${CARLA_VERSION}".tar.gz Import/
|
2020-02-25 17:19:02 +08:00
|
|
|
fi
|
|
|
|
|
2020-05-25 21:52:22 +08:00
|
|
|
# Importing new maps.
|
|
|
|
./ImportAssets.sh
|
2020-02-25 17:19:02 +08:00
|
|
|
|
2020-05-25 21:52:22 +08:00
|
|
|
# Removing unnecessary files
|
2020-02-25 17:19:02 +08:00
|
|
|
rm CarlaUE4/Binaries/Linux/CarlaUE4-Linux-Shipping.debug
|
|
|
|
rm CarlaUE4/Binaries/Linux/CarlaUE4-Linux-Shipping.sym
|
|
|
|
|
2020-05-25 21:52:22 +08:00
|
|
|
# ==================================================================================================
|
|
|
|
# -- Debian package --------------------------------------------------------------------------------
|
|
|
|
# ==================================================================================================
|
|
|
|
# Updating CarlaUE4.sh script
|
2020-02-25 17:19:02 +08:00
|
|
|
rm CarlaUE4.sh
|
|
|
|
cat >> CarlaUE4.sh <<EOF
|
|
|
|
#!/bin/sh
|
2020-05-26 18:39:27 +08:00
|
|
|
"/opt/carla-simulator/CarlaUE4/Binaries/Linux/CarlaUE4-Linux-Shipping" CarlaUE4 \$@
|
2020-02-25 17:19:02 +08:00
|
|
|
EOF
|
|
|
|
|
2020-05-25 21:52:22 +08:00
|
|
|
# Making debian package to install Carla in /opt folder
|
2020-03-03 18:38:08 +08:00
|
|
|
rm Makefile
|
|
|
|
|
|
|
|
cat >> Makefile <<EOF
|
|
|
|
binary:
|
|
|
|
# we are not going to build anything
|
|
|
|
|
|
|
|
install:
|
2020-05-25 21:52:22 +08:00
|
|
|
mkdir -p \$(DESTDIR)/opt/carla-simulator/bin
|
|
|
|
cp CarlaUE4.sh \$(DESTDIR)/opt/carla-simulator/bin
|
|
|
|
cp ImportAssets.sh \$(DESTDIR)/opt/carla-simulator
|
|
|
|
cp -r CarlaUE4 \$(DESTDIR)/opt/carla-simulator
|
|
|
|
cp -r Engine \$(DESTDIR)/opt/carla-simulator
|
|
|
|
cp -r Import \$(DESTDIR)/opt/carla-simulator
|
|
|
|
cp -r PythonAPI \$(DESTDIR)/opt/carla-simulator
|
|
|
|
cp -r Co-Simulation \$(DESTDIR)/opt/carla-simulator
|
|
|
|
cp -r Tools \$(DESTDIR)/opt/carla-simulator
|
2020-03-03 18:38:08 +08:00
|
|
|
EOF
|
|
|
|
|
2020-05-25 21:52:22 +08:00
|
|
|
# Create necessary file structure for debian packaging
|
|
|
|
timeout --signal=SIGINT 10 dh_make -e carla.simulator@gmail.com --indep --createorig -y
|
2020-02-25 17:19:02 +08:00
|
|
|
|
|
|
|
cd debian/
|
|
|
|
|
2020-05-25 21:52:22 +08:00
|
|
|
# Removing unnecessary files
|
2020-02-25 18:21:32 +08:00
|
|
|
rm ./*.ex
|
|
|
|
rm ./*.EX
|
2020-02-25 17:19:02 +08:00
|
|
|
|
2020-05-25 21:52:22 +08:00
|
|
|
# Adding package dependencies(Package will install them itself) and description
|
2020-02-25 17:19:02 +08:00
|
|
|
rm control
|
|
|
|
|
|
|
|
cat >> control <<EOF
|
2020-05-25 21:52:22 +08:00
|
|
|
Source: carla-simulator
|
2020-02-25 17:19:02 +08:00
|
|
|
Section: simulator
|
|
|
|
Priority: optional
|
|
|
|
Maintainer: Carla Simulator Team <carla.simulator@gmail.com>
|
2020-03-03 18:38:08 +08:00
|
|
|
Build-Depends: debhelper (>= 9)
|
2020-02-27 22:31:28 +08:00
|
|
|
Standards-Version: ${CARLA_VERSION}
|
2020-02-25 17:19:02 +08:00
|
|
|
Homepage: http://carla.org/
|
|
|
|
|
2020-05-25 21:52:22 +08:00
|
|
|
Package: carla-simulator
|
2020-02-25 17:19:02 +08:00
|
|
|
Architecture: any
|
|
|
|
Depends: python,
|
2020-05-25 21:52:22 +08:00
|
|
|
python-numpy,
|
|
|
|
python-pygame,
|
|
|
|
libpng16-16,
|
|
|
|
libjpeg8,
|
|
|
|
libtiff5
|
2020-02-25 17:19:02 +08:00
|
|
|
Description: Open-source simulator for autonomous driving research
|
|
|
|
CARLA has been developed from the ground up to support development, training, and validation
|
2020-03-06 22:04:53 +08:00
|
|
|
of autonomous driving systems. In addition to open-source code and protocols, CARLA provides
|
|
|
|
open digital assets (urban layouts, buildings, vehicles) that were created for this purpose
|
|
|
|
and can be used freely. The simulation platform supports flexible specification of sensor suites,
|
2020-02-25 17:19:02 +08:00
|
|
|
environmental conditions, full control of all static and dynamic actors, maps generation and much more.
|
|
|
|
EOF
|
|
|
|
|
2020-05-25 21:52:22 +08:00
|
|
|
# Adding Carla library path (carla.pth) to site-packages, during post installation.
|
2020-02-25 17:19:02 +08:00
|
|
|
rm postinst
|
|
|
|
|
|
|
|
cat>> postinst << EOF
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
SITEDIR=\$(python3 -c 'import site; site._script()' --user-site)
|
|
|
|
mkdir -p "\$SITEDIR"
|
2020-05-25 21:52:22 +08:00
|
|
|
PYTHON3_EGG=\$(ls /opt/carla-simulator/PythonAPI/carla/dist | grep py3.)
|
|
|
|
echo "/opt/carla-simulator/PythonAPI/carla/dist/\$PYTHON3_EGG\n/opt/carla-simulator/PythonAPI/carla/" > "\$SITEDIR/carla.pth"
|
2020-02-25 17:19:02 +08:00
|
|
|
|
|
|
|
SITEDIR=\$(python2 -c 'import site; site._script()' --user-site)
|
|
|
|
mkdir -p "\$SITEDIR"
|
2020-05-25 21:52:22 +08:00
|
|
|
PYTHON2_EGG=\$(ls /opt/carla-simulator/PythonAPI/carla/dist | grep py2.)
|
|
|
|
echo "/opt/carla-simulator/PythonAPI/carla/dist/\$PYTHON2_EGG\n/opt/carla-simulator/PythonAPI/carla/" > "\$SITEDIR/carla.pth"
|
2020-02-25 17:19:02 +08:00
|
|
|
|
2020-05-25 21:52:22 +08:00
|
|
|
chmod +x /opt/carla-simulator/bin/CarlaUE4.sh
|
2020-02-25 17:19:02 +08:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
case "\$1" in
|
|
|
|
configure)
|
|
|
|
;;
|
|
|
|
|
|
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
echo "postinst called with unknown argument \\\`\$1'" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
EOF
|
|
|
|
|
2020-05-25 21:52:22 +08:00
|
|
|
# Removing Carla library from site-packages
|
2020-02-25 17:19:02 +08:00
|
|
|
rm prerm
|
|
|
|
cat>> prerm << EOF
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
SITEDIR=\$(python3 -c 'import site; site._script()' --user-site)
|
|
|
|
rm "\$SITEDIR/carla.pth"
|
|
|
|
|
|
|
|
SITEDIR=\$(python2 -c 'import site; site._script()' --user-site)
|
|
|
|
rm "\$SITEDIR/carla.pth"
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
case "\$1" in
|
|
|
|
remove|upgrade|deconfigure)
|
|
|
|
;;
|
|
|
|
|
|
|
|
failed-upgrade)
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
echo "prerm called with unknown argument \\\`\$1'" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
EOF
|
|
|
|
|
2020-05-25 21:52:22 +08:00
|
|
|
# Updating copyright.
|
2020-02-27 22:31:28 +08:00
|
|
|
rm copyright
|
2020-03-03 18:38:08 +08:00
|
|
|
cp ../LICENSE ./copyright
|
2020-02-27 22:31:28 +08:00
|
|
|
|
2020-05-25 21:52:22 +08:00
|
|
|
# Updating debian/Changelog
|
2020-03-03 18:38:08 +08:00
|
|
|
awk '{sub(/UNRELEASED/,"stable")}1' changelog > tmp && mv tmp changelog
|
2020-02-27 22:31:28 +08:00
|
|
|
awk '{sub(/unstable/,"stable")}1' changelog > tmp && mv tmp changelog
|
2020-02-25 17:19:02 +08:00
|
|
|
cd ..
|
2020-02-27 22:31:28 +08:00
|
|
|
|
2020-05-25 21:52:22 +08:00
|
|
|
# Building debian package.
|
|
|
|
dpkg-buildpackage -uc -us -b
|
2020-02-27 22:31:28 +08:00
|
|
|
|