Skip to content

Commit

Permalink
Some more changes to the pkg file
Browse files Browse the repository at this point in the history
License.htm now contains full license text
postinstall changes odbc.ini' group. Also driver name is now along with
the one we use on Windows
install_driver can take now 3rd argument for the driver description
  • Loading branch information
lawrinn committed May 2, 2019
1 parent 6c6fb25 commit 0e3c3ff
Show file tree
Hide file tree
Showing 9 changed files with 234 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .travis/osx.sh
Expand Up @@ -24,7 +24,7 @@ export TEST_PASSWORD=
mysql.server start

# ls -la /usr/local/Cellar/openssl/
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_OPENSSL=ON -DWITH_IODBC=ON -DOPENSSL_ROOT_DIR=/usr/local/Cellar/openssl/1.0.2o_2 -DOPENSSL_LIBRARIES=/usr/local/Cellar/openssl/1.0.2o_2/lib
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_OPENSSL=ON -DWITH_SSL=OPENSSL -DWITH_IODBC=ON -DOPENSSL_ROOT_DIR=/usr/local/Cellar/openssl/1.0.2o_2 -DOPENSSL_LIBRARIES=/usr/local/Cellar/openssl/1.0.2o_2/lib
cmake --build . --config RelWithDebInfo

###################################################################################################################
Expand Down
1 change: 1 addition & 0 deletions ma_dsn.c
Expand Up @@ -195,6 +195,7 @@ BOOL MADB_DsnSwitchDependents(MADB_Dsn *Dsn, unsigned int Changed)
break;
case DSN_TYPE_OPTION:
case DSN_TYPE_BOOL:
case DSN_TYPE_CBOXGROUP:
{
KeySet= *GET_FIELD_PTR(Dsn, &DsnKeys[Changed], my_bool);
}
Expand Down
10 changes: 9 additions & 1 deletion osxinstall/CMakeLists.txt
Expand Up @@ -10,12 +10,15 @@ IF(WITH_REVNO)
ENDIF()
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(PLATFORM "x86_64")
SET(PRODUCT_ARCH_BITS "64")
ELSE()
SET(PLATFORM "32bit")
SET(PRODUCT_ARCH_BITS "32")
endif()
SET(PRODUCT_NAME "MariaDB ODBC Driver")
SET(PRODUCT_MANUFACTURER "MariaDB")
SET(PRODUCT_VERSION "${MARIADB_ODBC_VERSION_MAJOR}.${MARIADB_ODBC_VERSION_MINOR}.${MARIADB_ODBC_VERSION_PATCH}")
SET(PRODUCT_SERIES "${MARIADB_ODBC_VERSION_MAJOR}.${MARIADB_ODBC_VERSION_MINOR}")
SET(PRODUCT_IDENTIFIER "com.mariadb.connector.odbc")

IF(${revno})
Expand All @@ -26,6 +29,11 @@ ENDIF()

MESSAGE(STATUS "PKG package file name ${PKG_PACKAGE}")

CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/WELCOME.html.in
${CMAKE_CURRENT_BINARY_DIR}/WELCOME.html @ONLY)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/scripts/postinstall.in
${CMAKE_CURRENT_BINARY_DIR}/scripts/postinstall @ONLY)

ADD_EXECUTABLE(install_driver install_driver.c)
TARGET_LINK_LIBRARIES(install_driver ${ODBC_INSTLIBS})#${PLATFORM_DEPENDENCIES})
# On Windows should look like
Expand All @@ -45,7 +53,7 @@ ENDIF()

ADD_CUSTOM_TARGET(maodbcpkg
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build_package.sh ${PRODUCT_IDENTIFIER} ${PRODUCT_VERSION} ${PKG_PACKAGE}
DEPENDS copypkgfiles ${CMAKE_CURRENT_SOURCE_DIR}/scripts/postinstall distribution.plist README.html WELCOME.html LICENSE.html
DEPENDS copypkgfiles ${CMAKE_CURRENT_BINARY_DIR}/scripts/postinstall distribution.plist README.html WELCOME.html LICENSE.html
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

SET_TARGET_PROPERTIES(maodbcpkg PROPERTIES EXCLUDE_FROM_ALL OFF)
Expand Down
186 changes: 183 additions & 3 deletions osxinstall/LICENSE.html

Large diffs are not rendered by default.

13 changes: 0 additions & 13 deletions osxinstall/WELCOME.html

This file was deleted.

13 changes: 13 additions & 0 deletions osxinstall/WELCOME.html.in
@@ -0,0 +1,13 @@
<html>
<head>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
</style>
<title>Welcome to MariaDB Connector/ODBC Installer</title>
</head>
<body>
<p>This is going to install MariaDB Connector/ODBC(Unicode) @PRODUCT_ARCH_BITS@bit version @PRODUCT_VERSION@ - a database driver that uses the industry standard Open Database Connectivity (ODBC) API.</p>
</body>
</html>
11 changes: 8 additions & 3 deletions osxinstall/install_driver.c
Expand Up @@ -47,7 +47,7 @@ int _snprintf(char *buffer, size_t count, const char *format, ...)

int Usage()
{
printf("Usage: install_driver <driver_location> [<driver_naeme>]\n");
printf("Usage: install_driver <driver_location> [<driver_name>]\n");
return 1;
}

Expand All @@ -56,7 +56,7 @@ int main(int argc, char** argv)
{
unsigned int UsageCount, ErrorCode;
char DriverDescr[1024], ErrorText[128], OutLocation[512], DriverDir[512];
const char *DriverLocation, *DriverName, *DriverFileName;
const char *DriverLocation, *DriverName, *DriverFileName, *DriverDescription= "MariaDB Connector/ODBC";

if (argc < 2 || strcmp(argv[1], "--help") == 0)
{
Expand Down Expand Up @@ -92,6 +92,11 @@ int main(int argc, char** argv)
DriverName= DriverLocation;
}

if (argc > 3)
{
DriverDescription= argv[3];
}

if (strlen(DriverLocation) > strlen(DriverDir))
{
DriverFileName= DriverLocation + strlen(DriverDir) + 1;
Expand All @@ -105,7 +110,7 @@ int main(int argc, char** argv)
/*SQLConfigDriver(NULL, ODBC_REMOVE_DRIVER, DriverName, NULL, NULL, 0, NULL);*/
SQLRemoveDriver(DriverName, FALSE, &UsageCount);
printf("Installing driver %s in %s as %s\n", DriverFileName, DriverDir, DriverName);
_snprintf(DriverDescr, sizeof(DriverDescr), "%s%cDriver=%s%c", DriverName, '\0', DriverLocation, '\0');
_snprintf(DriverDescr, sizeof(DriverDescr), "%s%cDriver=%s%cDescription=%s%cThreading=0%c", DriverName, '\0', DriverLocation, '\0', DriverDescription, '\0', '\0');


if (SQLInstallDriverEx(DriverDescr, DriverDir, OutLocation, sizeof(OutLocation), NULL, ODBC_INSTALL_COMPLETE, NULL) == FALSE)
Expand Down
Expand Up @@ -47,29 +47,39 @@ if [ ! -f $ODBCINSTINI ] ; then
if [ ! -f $ODBCINSTINI ] ; then
echo "$ODBCINSTINI still does not exist" >> /tmp/maodbc_postinstall.log
echo "$ODBCINSTINI still does not exist"
mkdir -p "$instinidir"
touch "$ODBCINSTINI"
# mkdir -p "$instinidir"
# touch "$ODBCINSTINI"
exit 1
fi
chmod 664 $ODBCINSTINI

if [ ! -f ${target}Library/ODBC/odbc.ini ] ; then
echo "${target}Library/ODBC/odbc.ini does not exist - creating it" >> /tmp/maodbc_postinstall.log
touch "${target}Library/ODBC/odbc.ini"
chgrp admin ${target}Library/ODBC/odbc.ini
chmod 664 ${target}Library/ODBC/odbc.ini
echo "[ODBC Data Sources]" > ${target}Library/ODBC/odbc.ini
fi

echo "Writing common options and driver entry" >> /tmp/maodbc_postinstall.log
echo "[ODBC]" > $ODBCINSTINI
echo "Trace = no" >> $ODBCINSTINI
echo "TraceFile = /tmp/iodbc_trace.log" >> $ODBCINSTINI
echo "" >> $ODBCINSTINI
echo "[ODBC Drivers]" >> $ODBCINSTINI
echo "mariadb_odbc = Installed" >> $ODBCINSTINI
echo "MariaDB ODBC @PRODUCT_SERIES@ Unicode Driver = Installed" >> $ODBCINSTINI
echo "" >> $ODBCINSTINI
echo "[mariadb_odbc]" >> $ODBCINSTINI
echo "[MariaDB ODBC @PRODUCT_SERIES@ Unicode Driver]" >> $ODBCINSTINI
echo "Driver = ${target}Library/MariaDB/MariaDB-Connector-ODBC/libmaodbc.dylib" >> $ODBCINSTINI
echo "Description = MariaDB ODBC Connector" >> $ODBCINSTINI
echo "Description = MariaDB Connector/ODBC(Unicode) @PRODUCT_VERSION@ @PRODUCT_ARCH_BITS@bit" >> $ODBCINSTINI
echo "Threading = 0" >> $ODBCINSTINI
echo "" >> $ODBCINSTINI
echo "Registration has been successfully finished" >> /tmp/maodbc_postinstall.log

exit 0
fi

${target}Library/MariaDB/MariaDB-Connector-ODBC/bin/install_driver "${target}Library/MariaDB/MariaDB-Connector-ODBC/libmaodbc.dylib" mariadb_odbc >> /tmp/maodbc_postinstall.log
${target}Library/MariaDB/MariaDB-Connector-ODBC/bin/install_driver "${target}Library/MariaDB/MariaDB-Connector-ODBC/libmaodbc.dylib" "MariaDB ODBC @PRODUCT_SERIES@ Unicode Driver" "MariaDB Connector/ODBC(Unicode) @PRODUCT_VERSION@ @PRODUCT_ARCH_BITS@bit" >> /tmp/maodbc_postinstall.log

echo "Registration has been successfully finished" >> /tmp/maodbc_postinstall.log

Expand Down
6 changes: 3 additions & 3 deletions test/info.c
Expand Up @@ -309,7 +309,7 @@ ODBC_TEST(t_bug30626)
CHECK_ENV_RC(henv1, SQLSetEnvAttr(henv1, SQL_ATTR_ODBC_VERSION,
(SQLPOINTER) SQL_OV_ODBC2, SQL_IS_INTEGER));
CHECK_ENV_RC(henv1, SQLAllocHandle(SQL_HANDLE_DBC, henv1, &Connection1));
CHECK_DBC_RC(Connection1, SQLDriverConnect(Connection1, NULL, conn, (SQLSMALLINT)strlen(conn), NULL, 0,
CHECK_DBC_RC(Connection1, SQLDriverConnect(Connection1, NULL, conn, (SQLSMALLINT)strlen((const char*)conn), NULL, 0,
NULL, SQL_DRIVER_NOPROMPT));
CHECK_DBC_RC(Connection1, SQLAllocHandle(SQL_HANDLE_STMT, Connection1, &Stmt1));

Expand Down Expand Up @@ -574,7 +574,7 @@ ODBC_TEST(odbc84_62)
CHECK_ENV_RC(henv1, SQLSetEnvAttr(henv1, SQL_ATTR_ODBC_VERSION,
(SQLPOINTER)SQL_OV_ODBC2, SQL_IS_INTEGER));
CHECK_ENV_RC(henv1, SQLAllocHandle(SQL_HANDLE_DBC, henv1, &Connection1));
CHECK_DBC_RC(Connection1, SQLDriverConnect(Connection1, NULL, conn, (SQLSMALLINT)strlen(conn), NULL, 0,
CHECK_DBC_RC(Connection1, SQLDriverConnect(Connection1, NULL, conn, (SQLSMALLINT)strlen((const char*)conn), NULL, 0,
NULL, SQL_DRIVER_NOPROMPT));
CHECK_DBC_RC(Connection1, SQLAllocHandle(SQL_HANDLE_STMT, Connection1, &Stmt1));

Expand Down Expand Up @@ -704,7 +704,7 @@ ODBC_TEST(odbc109)
CHECK_ENV_RC(henv1, SQLSetEnvAttr(henv1, SQL_ATTR_ODBC_VERSION,
(SQLPOINTER)SQL_OV_ODBC2, SQL_IS_INTEGER));
CHECK_ENV_RC(henv1, SQLAllocHandle(SQL_HANDLE_DBC, henv1, &Connection1));
CHECK_DBC_RC(Connection1, SQLDriverConnect(Connection1, NULL, conn, (SQLSMALLINT)strlen(conn), NULL, 0,
CHECK_DBC_RC(Connection1, SQLDriverConnect(Connection1, NULL, conn, (SQLSMALLINT)strlen((const char*)conn), NULL, 0,
NULL, SQL_DRIVER_NOPROMPT));

CHECK_DBC_RC(Connection1, SQLGetInfo(Connection1, SQL_OWNER_TERM, NULL, 0, &StrLen));
Expand Down

0 comments on commit 0e3c3ff

Please sign in to comment.