Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sumo builder utility #1906

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
FROM ubuntu:xenial
ARG UBUNTU_VERSION=20.04
FROM ubuntu:${UBUNTU_VERSION}

ARG DEBIAN_FRONTEND=noninteractive
ARG SUMO_REPO_TAG=v1_16_0

RUN echo "Installing dependencies"
RUN cat /etc/issue
RUN echo "Installing dependencies with ubuntu=${UBUNTU_VERSION} sumo=${SUMO_REPO_TAG}"
RUN apt-get update --fix-missing && \
apt-get install -y \
software-properties-common && \
apt-get update && \
apt-get install -y \
git \
cmake \
python \
python3 \
g++ \
libxerces-c-dev \
libfox-1.6-dev \
libgdal-dev \
libproj-dev \
libgl2ps-dev \
swig \
git
python3-dev \
swig \
ccache

RUN cd /usr/src && \
git clone --recursive https://github.com/eclipse/sumo && \
cd sumo && \
git checkout 3a3be608d2408d7cbf10f6bba939254ef439c209 && \
git checkout ${SUMO_REPO_TAG} && \
git fetch origin refs/replace/*:refs/replace/* && \
export SUMO_HOME="$PWD" && \
mkdir -p build/cmake-build && cd build/cmake-build && \
Expand Down
30 changes: 0 additions & 30 deletions utils/extras/sumo/ubuntu_compile/ubuntu_16_04_sumo_1_5.sh

This file was deleted.

75 changes: 75 additions & 0 deletions utils/extras/sumo/ubuntu_sumo_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
endloc=${SCRIPT_DIR}/build

echo 'If you are building for your system please check with "cat /etc/os-release | grep VERSION_"'

# Parse command line arguments
options=$(getopt -o u:s: --long ubuntu-version:,sumo-tag: -- "$@")
eval set -- "$options"

# Default values
ubuntu_version=""
sumo_tag=""

# Loop through arguments and set variables
while true; do
case "$1" in
-u | --ubuntu-version )
ubuntu_version="$2"
shift 2
;;
-s | --sumo-tag )
sumo_tag="$2"
shift 2
;;
-- )
shift
break
;;
* )
echo "Invalid argument: $1"
exit 1
;;
esac
done

# Check for empty arguments
if [ -z "$ubuntu_version" ] || [ -z "$sumo_tag" ]; then
echo "Error: both ubuntu-version and sumo-tag options are required"
echo "-u, --ubuntu-version <ubuntu docker tag e.g. xenial, 16.04, 21.04, ...>"
echo " See https://hub.docker.com/_/ubuntu/tags"
echo "-s, --sumo-tag <sumo commit tag or commit id>"
echo " See https://github.com/eclipse/sumo/tags"
exit 1
fi


# Print arguments
echo "Ubuntu version: $ubuntu_version"
echo "SUMO tag: $sumo_tag"


docker build --no-cache --build-arg SUMO_REPO_TAG=${sumo_tag} --build-arg UBUNTU_VERSION=${ubuntu_version} -t sumo_builder - < ${SCRIPT_DIR}/Dockerfile.sumo_build && \
docker create -ti --name intermediate_builder sumo_builder /bin/bash
if docker cp intermediate_builder:/usr/src/sumo ${endloc} && \
docker rm -f intermediate_builder ; then
echo 'Current SUMO_HOME is:'
printenv | grep 'SUMO_HOME'
read -p "Do you wish to set SUMO_HOME to ${endloc}? [Yn]" should_change_sumo_home
if [[ $should_change_sumo_home =~ ^[yY]$ ]]; then
# should not be doing this if not linux
if ! [[ "$OSTYPE" == "linux-gnu" ]]; then
echo 'Not Linux, exiting...'
exit 1
fi
# delete current SUMO_HOME from bashrc
sed '/^export SUMO_HOME/d' ~/.bashrc
echo "export SUMO_HOME=${endloc}" >> ~/.bashrc
echo "We've updated your ~/.bashrc. Be sure to run:"
echo ""
echo " source ~/.bashrc"
echo ""
echo "in order to set the SUMO_HOME variable in your current console session"
fi
fi
12 changes: 11 additions & 1 deletion utils/setup/README.pypi.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,17 @@ SUMO primarily targets Ubuntu versions >= 16.04. So you may not be able to downl

If you try through a package manager make sure to command-line call `sumo` to make sure that you have the right version of SUMO.

We would recommend using the prebuilt binaries but if you are using Ubuntu 16 (Xenial), there is a bash script in `extras/sumo/ubuntu_build` that you can use to automate the compilation of SUMO version 1.5.0.
We would recommend using the prebuilt binaries but if you are using Ubuntu there is a bash script in the SMARTS repository `utils/extras/sumo/ubuntu_build` that you can use to compile SUMO from the eclipse SUMO repository.

```bash
# $ ubuntu_sumo_build.sh
# Error: both ubuntu-version and sumo-tag arguments are required
# -u, --ubuntu-version <ubuntu docker tag e.g. xenial, 16.04, 21.04, ...>
# See https://hub.docker.com/_/ubuntu/tags?page=1&ordering=-last_updated
# -s, --sumo-tag <sumo commit tag or commit id>
# See https://github.com/eclipse/sumo/tags
bash utils/extras/sumo/ubuntu_build/ubuntu_sumo_build.sh -u focal -s v1_16_0
```

### MacOS

Expand Down