osmith has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43926?usp=email )

Change subject: s1gw: titan 11.2.1: use --legacy-template-subrefs
......................................................................

s1gw: titan 11.2.1: use --legacy-template-subrefs

Add the flag if running with a ttcn3_compiler version that supports it
and omit it otherwise.

Related: https://gitlab.eclipse.org/eclipse/titan/titan.core/-/work_items/798
Change-Id: I918b814f33a9db8614961ebddb3a7ad1adfebf99
---
M _buildsystem/regen_makefile.inc.sh
M s1gw/regen_makefile.sh
2 files changed, 35 insertions(+), 0 deletions(-)

Approvals:
  fixeria: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  Jenkins Builder: Verified




diff --git a/_buildsystem/regen_makefile.inc.sh 
b/_buildsystem/regen_makefile.inc.sh
index f9dcfe6..b68e244 100644
--- a/_buildsystem/regen_makefile.inc.sh
+++ b/_buildsystem/regen_makefile.inc.sh
@@ -65,6 +65,36 @@
 fi

 #
+# Add options to ttcn3_compiler if they are supported
+#
+add_ttcn3_compiler_opts_if_supported() {
+       local i
+       local add_flags=""
+
+       if [ -z "$REGEN_MAKEFILE_ADD_TTCN3_COMPILER_FLAGS_IF_SUPPORTED" ]; then
+               return
+       fi
+
+       for i in $REGEN_MAKEFILE_ADD_TTCN3_COMPILER_FLAGS_IF_SUPPORTED; do
+               if ttcn3_compiler --help 2>&1 | grep -q -- "$i"; then
+                       echo "Using ttcn3_compiler flag: $i"
+                       add_flags="$add_flags $i"
+               else
+                       echo "Unsupported ttcn3_compiler flag: $i"
+               fi
+       done
+
+       sed -i "s/COMPILER_FLAGS = /COMPILER_FLAGS = $add_flags /" Makefile
+
+       if ! grep -q "COMPILER_FLAGS = $add_flags " Makefile; then
+               echo "ERROR: failed to add compiler flags: $add_flags"
+               exit 1
+       fi
+}
+
+add_ttcn3_compiler_opts_if_supported
+
+#
 # Make output more readable (skip with make V=1)
 #

diff --git a/s1gw/regen_makefile.sh b/s1gw/regen_makefile.sh
index 01f5cd4..fbcfa43 100755
--- a/s1gw/regen_makefile.sh
+++ b/s1gw/regen_makefile.sh
@@ -22,4 +22,9 @@
        TCCInterface.cc
 "

+# https://gitlab.eclipse.org/eclipse/titan/titan.core/-/work_items/798
+REGEN_MAKEFILE_ADD_TTCN3_COMPILER_FLAGS_IF_SUPPORTED="
+       --legacy-template-subrefs
+"
+
 . ../_buildsystem/regen_makefile.inc.sh

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43926?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I918b814f33a9db8614961ebddb3a7ad1adfebf99
Gerrit-Change-Number: 43926
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to