Skip to content

Commit

Permalink
Fix of travis script
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lawrinn committed Aug 17, 2023
1 parent bbe48ab commit ab96138
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 59 deletions.
4 changes: 2 additions & 2 deletions .travis/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
75 changes: 52 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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}
Expand All @@ -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=$<TARGET_FILE:maodbc>
-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=$<TARGET_FILE:maodbc>
-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=$<TARGET_FILE:maodbc>
-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=$<TARGET_FILE:maodbc>
-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()

Expand Down
48 changes: 15 additions & 33 deletions cmake/install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
#
Expand All @@ -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")

Expand Down Expand Up @@ -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}")
2 changes: 1 addition & 1 deletion libmaodbc.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit ab96138

Please sign in to comment.