[ODBC-258] RFE: make documentation and license dirs configurable Created: 2019-06-25  Updated: 2021-03-22  Resolved: 2019-06-27

Status: Closed
Project: MariaDB Connector/ODBC
Component/s: General
Affects Version/s: 3.1.1
Fix Version/s: 3.1.2

Type: Bug Priority: Minor
Reporter: Michal Schorm Assignee: Lawrin Novitsky
Resolution: Fixed Votes: 0
Labels: None
Environment:

Fedora



 Description   

First of all:
the package is named "mariadb-connector-odbc" with dashes, but installs documentation and licenses to the "<some_path>/mariadb_connector_odbc" with underscores, which is not correct from the packaging POV.

316 SET(CPACK_PACKAGE_NAME "mariadb_connector_odbc")

IMHO that should be fixed to use the dashes. If the non GNU/Linux distributions use underscores, there probbably should be if clause.


Now to the core issue:

In Fedora (RHEL, CentOS, ...) the documentation lies in "/usr/share/doc/<pkgname>" and license files are located in "/usr/share/licenses/<pkgname>".

I'd like to have those two paths configurable for that reason.

--- mariadb-connector-odbc-3.1.1-ga-src/CMakeLists.txt  2019-05-02 14:41:44.000000000 +0200
+++ mariadb-connector-odbc-3.1.1-ga-src/CMakeLists.txt_patched  2019-06-25 14:31:46.211295272 +0200
@@ -333,12 +333,24 @@ ELSE()
           LIBRARY DESTINATION ./${INSTALL_LIB_SUFFIX}
           COMPONENT ODBCLibs)
 
+  IF(NOT DEFINED INSTALL_DOC_DIR)
+    SET(INSTALL_DOC_DIR "./share/doc/${CPACK_PACKAGE_NAME}/")
+  ENDIF()
+  IF(NOT DEFINED INSTALL_LICENSE_DIR)
+    SET(INSTALL_LICENSE_DIR "./share/doc/${CPACK_PACKAGE_NAME}/")
+  ENDIF()
+
   INSTALL(FILES
-          ${CMAKE_SOURCE_DIR}/COPYING
           ${CMAKE_SOURCE_DIR}/README
           DESTINATION
-          ./share/doc/${CPACK_PACKAGE_NAME}/
+          ${INSTALL_DOC_DIR}
           COMPONENT Documentation)
+  INSTALL(FILES
+          ${CMAKE_SOURCE_DIR}/COPYING
+          DESTINATION
+          ${INSTALL_LICENSE_DIR}
+          COMPONENT Documentation)
+
 ENDIF()
 
 # Tests. Checking if we have them. May be not the case if we are building from source package

This way it will default to what is hardcoded now, while granting the freedom to change any of those paths if necessary.

I'm not sure however, how to add those macros to show up with description when "cmake -LAH" is called

Also I'm not sure if you have something like "COMPONENT License", which could be used there.



 Comments   
Comment by Lawrin Novitsky [ 2019-06-26 ]

Thank you. I guess the proposed patch makes sense. But I guess I must ask you if you submitting it under BSD license, or if you wish to sign code contribution agreement https://mariadb.com/kb/en/mariadb/mca/
Although, the patch is fairly simple, and unlikely there are easy ways to make it differently...

Comment by Michal Schorm [ 2019-06-26 ]

I'm a MCA signatory.
You are good to go.

Comment by Lawrin Novitsky [ 2019-06-27 ]

The proposed fix has been pushed. I only made new parameter cache variables(to let them appear in the cmake -LA)

Comment by Michal Schorm [ 2019-06-27 ]

Awesome, thanks!
So, that's how to add CMake CACHE STRING.

I tested the patch on the released 3.1.1 tarball and it builds just fine.
I only pointed out one little typo in the commit on the GitHub.

Generated at Thu Feb 08 03:27:23 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.