-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrules.j2
executable file
·92 lines (82 loc) · 3.27 KB
/
rules.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/make -f
%:
dh $@
export PYTHONUNBUFFERED=1
export PYTHONDONTWRITEBYTECODE=1
export PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/"
export RELEASE_TRACK={{ release_track }}
export RELEASE_LABEL={{ release_label }}
export RELEASE_STAMP={{ debian_version }}
export RELEASE_FLAVOUR={{ flavour }}
export RELEASE_VERSION={{ release_label }}-{{ debian_version }}
export CCACHE_BASEDIR=$(CURDIR)
SHELL=bash
INSTALL_DIR=debian/tmp/opt/{{ organization }}/{{ release_label }}/{{ flavour }}
# Do this oneshot as part of override_dh_auto_install
override_dh_auto_clean:
override_dh_auto_configure:
override_dh_auto_build:
override_dh_auto_test:
override_dh_auto_install:
mkdir -p $(INSTALL_DIR)
{% for distro_name, distro_options in distributions.items() if distro_options['root_packages'] is defined %}
{% for vendor_environment in vendor_environments | default([]) %}
test -e {{ vendor_environment }} && source {{ vendor_environment }} || true && \
{% endfor %}
{% for underlay_name in distro_options['underlays'] | default([]) %}
{% if distributions[underlay_name]['root_packages'] is defined %}
source $(INSTALL_DIR)/{{ underlay_name }}/setup.bash && \
{% endif %}
{% endfor %}
{% for key, value in distro_options['env'].items() %}
export {{ key }}={{ value }} && \
{% endfor %}
export ROS_DISTRO_OVERRIDE={{ organization }}-{{ release_label }}-{{ flavour }} && \
env && \
TERM=dumb colcon build \
--packages-up-to {{ distro_options['root_packages'] | join(' ') }} \
--base-paths src/{{ distro_name }} \
--build-base debian/tmp/build/{{ distro_name }} \
--install-base $(INSTALL_DIR)/{{ distro_name }} \
--cmake-args \
-DCMAKE_CXX_FLAGS='{{ cxx_flags | join(' ') }}' \
-DCMAKE_CXX_STANDARD='{{ cxx_standard }}' \
-DCMAKE_CXX_STANDARD_REQUIRED='ON' \
-DCMAKE_CXX_EXTENSIONS='ON' \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DPYTHON_EXECUTABLE=/usr/bin/python{{ python_version }} \
--ament-cmake-args \
-DBUILD_TESTING=OFF \
--catkin-cmake-args \
-DCATKIN_SKIP_TESTING=1 \
--merge-install \
--catkin-skip-building-tests \
--event-handlers console_cohesion+
{% if distro_options['compat_catkin_tools'] | default(False) == True %}
# Workaround colcon not creating env.sh https://github.com/colcon/colcon-ros/issues/16
cp debian/compat_catkin_tools/env.sh $(INSTALL_DIR)/{{ distro_name }}/env.sh
cp debian/compat_catkin_tools/_setup_util.py $(INSTALL_DIR)/{{ distro_name }}/_setup_util.py
{% endif %}
{% endfor %}
# TODO(pbovbel) create separate debug packages
override_dh_strip:
# We don't really care about calculating shlibdeps
override_dh_shlibdeps:
# Fixup absolute and relative paths for installation target into /opt, don't touch .so libs
# Remove all python bytecode
# Find duplicate files, turn into relative symlinks
override_dh_installdeb:
find $(INSTALL_DIR) -type f -exec grep -I -q . {} \; -print0 | xargs -0 sed -ri "s|($(CURDIR)/)?debian/tmp/opt|/opt|g" && \
find $(INSTALL_DIR) -name '*.pyc' -delete && \
rdfind -makesymlinks true $(INSTALL_DIR) && \
find $(INSTALL_DIR) -type l -exec sh -c ' \
for link do \
target=$$(readlink "$$link"); \
case "$$target" in \
/*) \
dir=$$(dirname "$$link"); \
reltarget=$$(realpath --relative-to="$$dir" "$$target"); \
ln -sfn "$$reltarget" "$$link";; \
esac; \
done' sh {} + && \
dh_installdeb