summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorDaniel Black <daniel@linux.ibm.com>2020-06-17 21:29:16 +1000
committerMarko Mäkelä <marko.makela@mariadb.com>2020-06-18 14:15:36 +0300
commit08f6513cb2369a3d5a053a43bb945aa93a3b1da7 (patch)
tree0625b98ee862411e002e39507e271112eb9fbc77 /cmake
parent38774f8dcb0ef4aa11e18e6e9b91907c32f6ca29 (diff)
downloadmariadb-git-08f6513cb2369a3d5a053a43bb945aa93a3b1da7.tar.gz
libutils: merge_archives_unix
MRI scripts cannot handle + in paths, and ubuntu CI makes use of these. So we remove the top level build dir from the script and transform it into a relative path script.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/libutils.cmake4
-rw-r--r--cmake/merge_archives_unix.cmake16
2 files changed, 18 insertions, 2 deletions
diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake
index acf29ae82f0..92a5b9f564d 100644
--- a/cmake/libutils.cmake
+++ b/cmake/libutils.cmake
@@ -217,7 +217,7 @@ MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE)
SET(SCRIPT_CONTENTS "CREATE $<TARGET_FILE:${TARGET}>\n")
FOREACH(LIB ${STATIC_LIBS})
- SET(SCRIPT_CONTENTS "${SCRIPT_CONTENTS}\nADDLIB ${LIB}\n")
+ SET(SCRIPT_CONTENTS "${SCRIPT_CONTENTS}ADDLIB ${LIB}\n")
ENDFOREACH()
FILE(WRITE ${MRI_SCRIPT_TPL} "${SCRIPT_CONTENTS}\nSAVE\nEND\n")
FILE(GENERATE OUTPUT ${MRI_SCRIPT} INPUT ${MRI_SCRIPT_TPL})
@@ -227,12 +227,14 @@ MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE)
COMMAND ${CMAKE_COMMAND}
ARGS
-DTARGET_SCRIPT="${MRI_SCRIPT}"
+ -DTOP_DIR="${CMAKE_BINARY_DIR}"
-DCMAKE_AR="${CMAKE_AR}"
-P "${MYSQL_CMAKE_SCRIPT_DIR}/merge_archives_unix.cmake"
COMMAND ${CMAKE_RANLIB}
ARGS $<TARGET_FILE:${TARGET}>
)
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${MRI_SCRIPT_TPL})
+ SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${MRI_SCRIPT}.mri)
ENDIF()
ENDIF()
ENDMACRO()
diff --git a/cmake/merge_archives_unix.cmake b/cmake/merge_archives_unix.cmake
index 8e5086bb5b7..a66daddaefc 100644
--- a/cmake/merge_archives_unix.cmake
+++ b/cmake/merge_archives_unix.cmake
@@ -14,7 +14,21 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
+
+# MRI scripts have a problem with +. It's a line contination character
+# unfortunately there is no escape character. We know we don't have
+# "+" in libraries or the MariaDB paths, but Ubuntu CI builds will have
+# in their CI path due to the package names that Ubuntu generates.
+# So here we replace the fully expanded paths in the TARGET_SCRIPT,
+# strip off the TOP_DIR to make it a relative path to the top level directory
+# and then execute AR on the top level directory.
+
+FILE(READ ${TARGET_SCRIPT} SCRIPT_CONTENTS)
+STRING(REPLACE "${TOP_DIR}/" "" SCRIPT_CONTENTS_TRIMMED "${SCRIPT_CONTENTS}")
+FILE(WRITE "${TARGET_SCRIPT}.mri" ${SCRIPT_CONTENTS_TRIMMED})
+
EXECUTE_PROCESS(
+ WORKING_DIRECTORY ${TOP_DIR}
COMMAND ${CMAKE_AR} -M
- INPUT_FILE ${TARGET_SCRIPT}
+ INPUT_FILE ${TARGET_SCRIPT}.mri
)