Harald Welte | 20a58c6 | 2017-12-13 01:04:42 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Wrapper around the TITAN make file generator to work in Debian. |
| 4 | # |
| 5 | # TITAN has a makefile generator, but somehow Debian seems to install |
| 6 | # the binaries to different paths without patching the make file |
| 7 | # generator, leading in inconsistent non-working Makefiles. |
| 8 | # |
| 9 | # The regexes below patch the generated Makefile to work on Debian 9 and |
| 10 | # unstable, so far tested with TITAN 6.1.0, 6.2.0 and 6.3.0 |
Max | dbf15f8 | 2017-12-13 11:34:44 +0100 | [diff] [blame] | 11 | # |
Harald Welte | 20a58c6 | 2017-12-13 01:04:42 +0100 | [diff] [blame] | 12 | |
Pau Espin Pedrol | ef85dfa | 2018-01-29 11:48:38 +0100 | [diff] [blame] | 13 | test -x "$(which ttcn3_makefilegen 2>/dev/null)" || { echo "ERROR: ttcn3_makefilegen not in PATH"; exit 1; } |
| 14 | |
Harald Welte | df27725 | 2018-02-20 15:49:30 +0100 | [diff] [blame] | 15 | ttcn3_makefilegen -p -l -f $* |
Harald Welte | 20a58c6 | 2017-12-13 01:04:42 +0100 | [diff] [blame] | 16 | sed -i -e 's/# TTCN3_DIR = /TTCN3_DIR = \/usr/' Makefile |
| 17 | sed -i -e 's/LDFLAGS = /LDFLAGS = -L \/usr\/lib\/titan /' Makefile |
| 18 | #sed -i -e 's/TTCN3_LIB = ttcn3-parallel/TTCN3_LIB = ttcn3/' Makefile |
Max | dbf15f8 | 2017-12-13 11:34:44 +0100 | [diff] [blame] | 19 | |
| 20 | # The -DMAKEDEPEND_RUN is a workaround for Debian packaging issue, |
| 21 | # see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=879816 for details |
| 22 | sed -i -e 's/CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)\/include/CPPFLAGS = -D$(PLATFORM) -DMAKEDEPEND_RUN -I$(TTCN3_DIR)\/include -I\/usr\/include\/titan/' Makefile |
Harald Welte | 20a58c6 | 2017-12-13 01:04:42 +0100 | [diff] [blame] | 23 | |
Harald Welte | df27725 | 2018-02-20 15:49:30 +0100 | [diff] [blame] | 24 | if [ "x$CPPFLAGS_TTCN3" != "x" ]; then |
| 25 | sed -i -e 's/CPPFLAGS_TTCN3 =/CPPFLAGS_TTCN3 = '"$CPPFLAGS_TTCN3"'/' Makefile |
| 26 | fi |
| 27 | |
Harald Welte | 20a58c6 | 2017-12-13 01:04:42 +0100 | [diff] [blame] | 28 | # for TITAN 6.3.0 |
Pau Espin Pedrol | 5c9d99f | 2018-01-29 11:37:25 +0100 | [diff] [blame] | 29 | if cat /etc/issue | grep "Arch Linux" >/dev/null 2>&1; then |
| 30 | sed -i -e 's/TTCN3_DIR = $/TTCN3_DIR = \/usr\/ttcn3/' Makefile |
| 31 | else |
| 32 | sed -i -e 's/TTCN3_DIR = $/TTCN3_DIR = \/usr/' Makefile |
| 33 | fi |
Harald Welte | 20a58c6 | 2017-12-13 01:04:42 +0100 | [diff] [blame] | 34 | sed -i -e 's/\/bin\/compiler/\/bin\/ttcn3_compiler/' Makefile |