From ab96138695246e5d7ddb5c619201e52936053c59 Mon Sep 17 00:00:00 2001 From: Lawrin Novitsky Date: Sun, 13 Aug 2023 23:10:32 +0200 Subject: [PATCH] Fix of travis script The driver dilbrary is installed to INSTALL_LIBDIR, rather than to its mariadb subdir for DEB and RPM. Ignoring PCDIR for RPM(otherwise we have conflict with other package) Also changet tests to use driver installation location in case of RPM or DEB package build, as driver is tested after package installation Minor changes in pc file --- .travis/script.sh | 4 +-- CMakeLists.txt | 75 +++++++++++++++++++++++++++++++-------------- cmake/install.cmake | 48 +++++++++-------------------- libmaodbc.pc.in | 2 +- 4 files changed, 70 insertions(+), 59 deletions(-) diff --git a/.travis/script.sh b/.travis/script.sh index baf4bc24..2bb1c0cf 100755 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -118,14 +118,14 @@ if ! [ "$TRAVIS_OS_NAME" = "windows" ] ; then else TEST_DRIVER="MariaDB ODBC 3.1 Driver" # INSTALLFOLDER='' - cd ../wininstall && for %%a in (mariadb-connector-odbc-*.msi) do (msiexec /i %%a /qn /norestart + cd ../wininstall && for msi in mariadb-connector-odbc-*.msi ; do msiexec /i $msi /qn /norestart; done set +x odbcconf CONFIGDSN "$TEST_DRIVER" "DSN=$TEST_DSN;SERVER=$TEST_SERVER;DATABASE=$TEST_SCHEMA;USER=$TEST_UID;PASSWORD=$TEST_PASSWORD;PORT=$TEST_PORT;$TEST_ADD_PARAM" set -ex fi ctest --output-on-failure -# Running tests 2nd time with resultset streaming. "${TEST_REQUIRE_TLS}" = "1" basically means "not on skysql" +# Running tests 2nd time with resultset streaming. "${TEST_REQUIRE_TLS}" = "1" basically means "not on skysql". if ! [ "${TEST_REQUIRE_TLS}" = "1" ] && ! [ "$srv" = "xpand" ]; then export TEST_ADD_PARAM="STREAMRS=1;FORWARDONLY=1" ctest --output-on-failure diff --git a/CMakeLists.txt b/CMakeLists.txt index b31f9abe..5ee85cea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,7 @@ IF(CMAKE_VERSION VERSION_LESS "3.1") ENDIF() ELSE() SET(CMAKE_C_STANDARD 99) -endif() +ENDIF() SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake) @@ -474,6 +474,9 @@ ELSE() INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libmaodbc.pc DESTINATION "${INSTALL_PCDIR}" COMPONENT Development) + IF(RPM) + SET(CPACK_RPM_Development_USER_FILELIST "%ignore ${CMAKE_INSTALL_PREFIX}/${INSTALL_PCDIR}") + ENDIF() ENDIF() INSTALL(TARGETS ${LIBRARY_NAME} @@ -499,28 +502,54 @@ IF(WITH_UNIT_TESTS) # Configuring ini files for testing with UnixODBC MESSAGE(STATUS "Configurig Test Driver: ${TEST_DRIVER}, Test DSN: ${TEST_DSN}, tcp://${TEST_UID}@${TEST_SERVER}:${TEST_PORT}/${TEST_SCHEMA} socket: ${TEST_SOCKET}") - ADD_CUSTOM_COMMAND(TARGET maodbc POST_BUILD - COMMAND ${CMAKE_COMMAND} ARGS -DDRIVER_LIB_LOCATION=$ - -DTEST_DRIVER=${TEST_DRIVER} - -DFILE_IN=${CMAKE_SOURCE_DIR}/test/odbcinst.ini.in - -DFILE_OUT=${CMAKE_BINARY_DIR}/test/odbcinst.ini - -P ${CMAKE_SOURCE_DIR}/cmake/ConfigureFile.cmake - ) - - ADD_CUSTOM_COMMAND(TARGET maodbc POST_BUILD - COMMAND ${CMAKE_COMMAND} ARGS -DTEST_DRIVER=$ - -DTEST_DSN=${TEST_DSN} - -DTEST_PORT=${TEST_PORT} - -DTEST_SERVER=${TEST_SERVER} - -DTEST_SOCKET=${TEST_SOCKET} - -DTEST_SCHEMA=${TEST_SCHEMA} - -DTEST_UID=${TEST_UID} - -DTEST_PASSWORD="${TEST_PASSWORD}" - -DTEST_USETLS=${TEST_USETLS} - -DFILE_IN=${CMAKE_SOURCE_DIR}/test/odbc.ini.in - -DFILE_OUT=${CMAKE_BINARY_DIR}/test/odbc.ini - -P ${CMAKE_SOURCE_DIR}/cmake/ConfigureFile.cmake - ) + # If deb or rpm package is built, we configure tests to use the driver installed with the packages + IF(DEB OR RPM) + ADD_CUSTOM_COMMAND(TARGET maodbc POST_BUILD + COMMAND ${CMAKE_COMMAND} ARGS -DDRIVER_LIB_LOCATION=${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBDIR}/lib${LIBRARY_NAME}.so + -DTEST_DRIVER=${TEST_DRIVER} + -DFILE_IN=${CMAKE_SOURCE_DIR}/test/odbcinst.ini.in + -DFILE_OUT=${CMAKE_BINARY_DIR}/test/odbcinst.ini + -P ${CMAKE_SOURCE_DIR}/cmake/ConfigureFile.cmake + ) + + ADD_CUSTOM_COMMAND(TARGET maodbc POST_BUILD + COMMAND ${CMAKE_COMMAND} ARGS -DTEST_DRIVER=${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBDIR}/lib${LIBRARY_NAME}.so + -DTEST_DSN=${TEST_DSN} + -DTEST_PORT=${TEST_PORT} + -DTEST_SERVER=${TEST_SERVER} + -DTEST_SOCKET=${TEST_SOCKET} + -DTEST_SCHEMA=${TEST_SCHEMA} + -DTEST_UID=${TEST_UID} + -DTEST_PASSWORD="${TEST_PASSWORD}" + -DTEST_USETLS=${TEST_USETLS} + -DFILE_IN=${CMAKE_SOURCE_DIR}/test/odbc.ini.in + -DFILE_OUT=${CMAKE_BINARY_DIR}/test/odbc.ini + -P ${CMAKE_SOURCE_DIR}/cmake/ConfigureFile.cmake + ) + ELSE() + ADD_CUSTOM_COMMAND(TARGET maodbc POST_BUILD + COMMAND ${CMAKE_COMMAND} ARGS -DDRIVER_LIB_LOCATION=$ + -DTEST_DRIVER=${TEST_DRIVER} + -DFILE_IN=${CMAKE_SOURCE_DIR}/test/odbcinst.ini.in + -DFILE_OUT=${CMAKE_BINARY_DIR}/test/odbcinst.ini + -P ${CMAKE_SOURCE_DIR}/cmake/ConfigureFile.cmake + ) + + ADD_CUSTOM_COMMAND(TARGET maodbc POST_BUILD + COMMAND ${CMAKE_COMMAND} ARGS -DTEST_DRIVER=$ + -DTEST_DSN=${TEST_DSN} + -DTEST_PORT=${TEST_PORT} + -DTEST_SERVER=${TEST_SERVER} + -DTEST_SOCKET=${TEST_SOCKET} + -DTEST_SCHEMA=${TEST_SCHEMA} + -DTEST_UID=${TEST_UID} + -DTEST_PASSWORD="${TEST_PASSWORD}" + -DTEST_USETLS=${TEST_USETLS} + -DFILE_IN=${CMAKE_SOURCE_DIR}/test/odbc.ini.in + -DFILE_OUT=${CMAKE_BINARY_DIR}/test/odbc.ini + -P ${CMAKE_SOURCE_DIR}/cmake/ConfigureFile.cmake + ) + ENDIF() ENDIF() ENDIF() diff --git a/cmake/install.cmake b/cmake/install.cmake index ee1e9985..67032042 100644 --- a/cmake/install.cmake +++ b/cmake/install.cmake @@ -24,6 +24,9 @@ # INSTALL_DOCDIR location of docs # INSTALL_LICENSEDIR location of license +#Sets platform specific CMAKE_INSTALL_XXXDIR values +INCLUDE(GNUInstallDirs) + IF(DEB) SET(INSTALL_LAYOUT "DEB") ENDIF() @@ -67,11 +70,6 @@ IF(NOT DEFINED INSTALL_LIB_SUFFIX) ENDIF() ENDIF() -# -# Todo: We don't generate man pages yet, will fix it -# later (webhelp to man transformation) -# - # # DEFAULT layout # @@ -90,38 +88,24 @@ SET(LIBMARIADB_STATIC_DEFAULT "mariadbclient") # # RPM layout # -SET(INSTALL_BINDIR_RPM "bin") -IF((CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le" OR CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "s390x") AND CMAKE_SIZEOF_VOID_P EQUAL 8) - SET(INSTALL_LIBDIR_RPM "lib64/mariadb") - SET(INSTALL_PCDIR_RPM "lib64/pkgconfig") - SET(INSTALL_PLUGINDIR_RPM "lib64/mariadb/plugin") -ELSE() - SET(INSTALL_LIBDIR_RPM "lib/mariadb") - SET(INSTALL_PCDIR_RPM "lib/pkgconfig") - SET(INSTALL_PLUGINDIR_RPM "lib/mariadb/plugin") -ENDIF() -SET(INSTALL_INCLUDEDIR_RPM "include/mariadb") -SET(INSTALL_DOCDIR_RPM "share/doc/mariadb-connector-odbc") +SET(INSTALL_BINDIR_RPM "${CMAKE_INSTALL_BINDIR}") +SET(INSTALL_LIBDIR_RPM "${CMAKE_INSTALL_LIBDIR}") +SET(INSTALL_PCDIR_RPM "${CMAKE_INSTALL_LIBDIR}/pkgconfig") +SET(INSTALL_PLUGINDIR_RPM "${CMAKE_INSTALL_LIBDIR}/mariadb/plugin") +SET(INSTALL_INCLUDEDIR_RPM "${CMAKE_INSTALL_INCLUDEDIR}/mariadb") +SET(INSTALL_DOCDIR_RPM "${CMAKE_INSTALL_DOCDIR}/mariadbcpp") SET(INSTALL_LICENSEDIR_RPM ${INSTALL_DOCDIR_RPM}) SET(LIBMARIADB_STATIC_RPM "mariadbclient") # # DEB layout -# Only ia-32 and amd64 here. the list is too long to hardcode it -IF(NOT CMAKE_LIBRARY_ARCHITECTURE) - IF(CMAKE_SIZEOF_VOID_P EQUAL 8) - SET(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") - ELSE() - SET(CMAKE_LIBRARY_ARCHITECTURE "i386-linux-gnu") - ENDIF() -ENDIF() - -SET(INSTALL_BINDIR_DEB "bin") -SET(INSTALL_LIBDIR_DEB "lib/${CMAKE_LIBRARY_ARCHITECTURE}") -SET(INSTALL_PCDIR_DEB "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig") +# +SET(INSTALL_BINDIR_DEB "${CMAKE_INSTALL_BINDIR}") +SET(INSTALL_LIBDIR_DEB "${CMAKE_INSTALL_LIBDIR}/${CMAKE_LIBRARY_ARCHITECTURE}") +SET(INSTALL_PCDIR_DEB "${INSTALL_LIBDIR_DEB}/pkgconfig") SET(INSTALL_PLUGINDIR_DEB "${INSTALL_LIBDIR_DEB}/libmariadb${CPACK_PACKAGE_VERSION_MAJOR}/plugin") -SET(INSTALL_INCLUDEDIR_DEB "include/mariadb") -SET(INSTALL_DOCDIR_DEB "share/doc/mariadb-connector-odbc") +SET(INSTALL_INCLUDEDIR_DEB "${CMAKE_INSTALL_INCLUDEDIR}/mariadb") +SET(INSTALL_DOCDIR_DEB "${CMAKE_INSTALL_DOCDIR}") SET(INSTALL_LICENSEDIR_DEB "${INSTALL_DOCDIR_DEB}") SET(LIBMARIADB_STATIC_DEB "mariadb") @@ -180,5 +164,3 @@ ENDFOREACH() SET(INSTALL_PLUGINDIR_CLIENT ${INSTALL_PLUGINDIR}) MESSAGE(STATUS "MariaDB Connector ODBC: INSTALL_PLUGINDIR_CLIENT=${INSTALL_PLUGINDIR_CLIENT}") -MESSAGE(STATUS "Libraries installation dir: ${INSTALL_LIBDIR}") -MESSAGE(STATUS "Authentication Plugins installation dir: ${INSTALL_PLUGINDIR}") diff --git a/libmaodbc.pc.in b/libmaodbc.pc.in index d82991d3..4ea61b2e 100644 --- a/libmaodbc.pc.in +++ b/libmaodbc.pc.in @@ -10,7 +10,7 @@ prefix=@libmaodbc_prefix@ includedir=${prefix}/@INSTALL_INCLUDEDIR@/@SUFFIX_INSTALL_DIR@ libdir=${prefix}/@INSTALL_LIBDIR@/@SUFFIX_INSTALL_DIR@ -Name: libmariadb +Name: libmaodbc Version: @CPACK_PACKAGE_VERSION@ Description: MariaDB Connector/ODBC dynamic library Cflags: -I${includedir}