Commit 08f6513c authored by Daniel Black's avatar Daniel Black Committed by Marko Mäkelä

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.
parent 38774f8d
......@@ -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()
......
......@@ -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
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment