From bae725a3204ecc70efe08e21bc015c630c93f73b Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Mon, 22 Feb 2016 16:08:08 +0100
Subject: [PATCH] Deal with Rel8 RRC (not checked, just let fix_asn1 accept
 it). Also modified CMakeLists.txt to run asn1tostruct.py at cmake time,
 because the generated Makefile was wrong. When compiling with -j4 it would
 mess up by calling fix_asn1 twice with a weird timing, leading to failures.

---
 cmake_targets/CMakeLists.txt | 26 ++++++++++++++++++--------
 cmake_targets/tools/fix_asn1 |  3 +++
 2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index 6bebc2d655..c7058c1cff 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -321,10 +321,15 @@ set(S1AP_ASN_FILES
   )
 set(S1AP_C_DIR ${asn1_generated_dir}/${ASN1RELDIR})
 #message("calling ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}")
-execute_process(COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES})
-execute_process(
-  COMMAND ${fix_asn1c_call} ${S1AP_C_DIR} S1AP ${S1AP_VERSION}
-  RESULT_VARIABLE ret)
+execute_process(COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES} RESULT_VARIABLE ret)
+if (NOT ${ret} STREQUAL 0)
+  message(FATAL_ERROR "${asn1c_call}: error")
+endif (NOT ${ret} STREQUAL 0)
+execute_process(COMMAND python ${S1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f${S1AP_ASN_DIR}/S1AP-PDU-Contents.asn -o${S1AP_C_DIR} RESULT_VARIABLE ret)
+if (NOT ${ret} STREQUAL 0)
+  message(FATAL_ERROR "asn1tostruct.py: error")
+endif (NOT ${ret} STREQUAL 0)
+execute_process(COMMAND ${fix_asn1c_call} ${S1AP_C_DIR} S1AP ${S1AP_VERSION} RESULT_VARIABLE ret)
 if (NOT ${ret} STREQUAL 0)
   message(FATAL_ERROR "${fix_asn1c_call}: error")
 endif (NOT ${ret} STREQUAL 0)
@@ -395,10 +400,15 @@ set(X2AP_ASN_FILES
 
 set(X2AP_C_DIR ${asn1_generated_dir}/${ASN1RELDIR})
 #message("calling ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES}")
-execute_process(COMMAND ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES})
-execute_process(
-  COMMAND ${fix_asn1c_call} ${X2AP_C_DIR} X2AP ${X2AP_VERSION}
-  RESULT_VARIABLE ret)
+execute_process(COMMAND ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES} RESULT_VARIABLE ret)
+if (NOT ${ret} STREQUAL 0)
+  message(FATAL_ERROR "${asn1c_call}: error")
+endif (NOT ${ret} STREQUAL 0)
+execute_process(COMMAND python ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2AP_ASN_DIR}/X2AP-PDU-Contents.asn -o ${X2AP_C_DIR} RESULT_VARIABLE ret)
+if (NOT ${ret} STREQUAL 0)
+  message(FATAL_ERROR "asn1tostruct.py: error")
+endif (NOT ${ret} STREQUAL 0)
+execute_process(COMMAND ${fix_asn1c_call} ${X2AP_C_DIR} X2AP ${X2AP_VERSION} RESULT_VARIABLE ret)
 if (NOT ${ret} STREQUAL 0)
   message(FATAL_ERROR "${fix_asn1c_call}: error")
 endif (NOT ${ret} STREQUAL 0)
diff --git a/cmake_targets/tools/fix_asn1 b/cmake_targets/tools/fix_asn1
index ba8f15d8ec..42893e05c6 100755
--- a/cmake_targets/tools/fix_asn1
+++ b/cmake_targets/tools/fix_asn1
@@ -93,6 +93,9 @@ function patch_rrc()
       echo "patching RRC files release 10"
       apply_patches "$directory" RRC_Rel10 ${#RRC_Rel10[*]}
       ;;
+    Rel8 )
+      echo "patching RRC files release 8 TODO?"
+      ;;
     * )
       error unknwon/unhandled RRC version \'"$version"\'
       ;;
-- 
GitLab