From 6340dc673cb5f597b1f5e7d14ca91b605bb3da29 Mon Sep 17 00:00:00 2001 From: Yan Wang Date: Mon, 3 Apr 2023 14:05:16 -0700 Subject: [PATCH 1/7] fix minor version exceeding 255, remove lib folder for installer --- build_installer.ps1 | 16 ++++++++-------- wix/cmake/getodbcversion.c | 2 +- wix/mysql_odbc_fragment.xml | 23 ----------------------- 3 files changed, 9 insertions(+), 32 deletions(-) diff --git a/build_installer.ps1 b/build_installer.ps1 index 086c61470..4c54dfa7a 100644 --- a/build_installer.ps1 +++ b/build_installer.ps1 @@ -56,20 +56,20 @@ if ($null -eq $MYSQL_DIR) { } # BUILD DRIVER -cmake -S . -G "Visual Studio 16 2019" -DMYSQL_DIR="$MYSQL_DIR" -DMYSQLCLIENT_STATIC_LINKING=TRUE -DCMAKE_BUILD_TYPE="$CONFIGURATION" -DBUNDLE_DEPENDENCIES=TRUE -cmake --build . --config "$CONFIGURATION" +cmake -S . -B ./build -G "Visual Studio 17 2022" -DMYSQL_DIR="$MYSQL_DIR" -DMYSQLCLIENT_STATIC_LINKING=TRUE -DCMAKE_BUILD_TYPE="$CONFIGURATION" -DBUNDLE_DEPENDENCIES=TRUE +cmake --build ./build --config "$CONFIGURATION" # CREATE INSTALLER # Copy dll, installer, and info files to wix folder New-Item -Path .\Wix\x64 -ItemType Directory -Force New-Item -Path .\Wix\x86 -ItemType Directory -Force New-Item -Path .\Wix\doc -ItemType Directory -Force -Copy-Item .\lib\$CONFIGURATION\awsmysqlodbc*.dll .\Wix\x64 -Copy-Item .\lib\$CONFIGURATION\awsmysqlodbc*.lib .\Wix\x64 -Copy-Item .\lib\$CONFIGURATION\awsmysqlodbc*.dll .\Wix\x86 -Copy-Item .\lib\$CONFIGURATION\awsmysqlodbc*.lib .\Wix\x86 -Copy-Item .\bin\$CONFIGURATION\myodbc-installer.exe .\Wix\x64 -Copy-Item .\bin\$CONFIGURATION\myodbc-installer.exe .\Wix\x86 +Copy-Item .\build\lib\$CONFIGURATION\awsmysqlodbc*.dll .\Wix\x64 +Copy-Item .\build\lib\$CONFIGURATION\awsmysqlodbc*.lib .\Wix\x64 +Copy-Item .\build\lib\$CONFIGURATION\awsmysqlodbc*.dll .\Wix\x86 +Copy-Item .\build\lib\$CONFIGURATION\awsmysqlodbc*.lib .\Wix\x86 +Copy-Item .\build\bin\$CONFIGURATION\myodbc-installer.exe .\Wix\x64 +Copy-Item .\build\bin\$CONFIGURATION\myodbc-installer.exe .\Wix\x86 Copy-Item .\INFO_BIN .\Wix\doc Copy-Item .\INFO_SRC .\Wix\doc Copy-Item .\ChangeLog .\Wix\doc diff --git a/wix/cmake/getodbcversion.c b/wix/cmake/getodbcversion.c index bc7433475..a1890f323 100644 --- a/wix/cmake/getodbcversion.c +++ b/wix/cmake/getodbcversion.c @@ -48,7 +48,7 @@ int main(int argc, char *argv[]) fprintf(fp, "\n", v1, v2, v3); if (v3 == 0) { if (v2 == 0) - fprintf(fp, "\n", v1-1, 999, 999); + fprintf(fp, "\n", v1-1, 255, 999); else fprintf(fp, "\n", v1, v2-1, 999); } else { diff --git a/wix/mysql_odbc_fragment.xml b/wix/mysql_odbc_fragment.xml index f1e5e1056..5d5d3c033 100644 --- a/wix/mysql_odbc_fragment.xml +++ b/wix/mysql_odbc_fragment.xml @@ -53,15 +53,6 @@ - - - - - - - - - @@ -74,9 +65,6 @@ - - - @@ -86,14 +74,6 @@ - - - - - - - - @@ -106,9 +86,6 @@ - - - From 868083dac22afc4aa8964310870faa2fb22293e6 Mon Sep 17 00:00:00 2001 From: Yan Wang Date: Mon, 3 Apr 2023 14:19:01 -0700 Subject: [PATCH 2/7] remove setup lib from installer --- wix/mysql_odbc_fragment.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/wix/mysql_odbc_fragment.xml b/wix/mysql_odbc_fragment.xml index 5d5d3c033..99b6656d2 100644 --- a/wix/mysql_odbc_fragment.xml +++ b/wix/mysql_odbc_fragment.xml @@ -64,7 +64,6 @@ - @@ -85,7 +84,6 @@ - From bc55fc493072ca610da6bb20d7db9fdeeca3aff7 Mon Sep 17 00:00:00 2001 From: Yan Wang Date: Mon, 3 Apr 2023 15:03:43 -0700 Subject: [PATCH 3/7] add aws sdk component in wix --- build_installer.ps1 | 2 ++ wix/mysql_odbc_fragment.xml | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/build_installer.ps1 b/build_installer.ps1 index 4c54dfa7a..6849eccfa 100644 --- a/build_installer.ps1 +++ b/build_installer.ps1 @@ -66,8 +66,10 @@ New-Item -Path .\Wix\x86 -ItemType Directory -Force New-Item -Path .\Wix\doc -ItemType Directory -Force Copy-Item .\build\lib\$CONFIGURATION\awsmysqlodbc*.dll .\Wix\x64 Copy-Item .\build\lib\$CONFIGURATION\awsmysqlodbc*.lib .\Wix\x64 +Copy-Item .\build\lib\$CONFIGURATION\aws-*.dll .\Wix\x64 Copy-Item .\build\lib\$CONFIGURATION\awsmysqlodbc*.dll .\Wix\x86 Copy-Item .\build\lib\$CONFIGURATION\awsmysqlodbc*.lib .\Wix\x86 +Copy-Item .\build\lib\$CONFIGURATION\aws-*.dll .\Wix\x86 Copy-Item .\build\bin\$CONFIGURATION\myodbc-installer.exe .\Wix\x64 Copy-Item .\build\bin\$CONFIGURATION\myodbc-installer.exe .\Wix\x86 Copy-Item .\INFO_BIN .\Wix\doc diff --git a/wix/mysql_odbc_fragment.xml b/wix/mysql_odbc_fragment.xml index 99b6656d2..9a957cda4 100644 --- a/wix/mysql_odbc_fragment.xml +++ b/wix/mysql_odbc_fragment.xml @@ -61,6 +61,21 @@ + + + + + + + + + + + + + + + @@ -81,6 +96,21 @@ + + + + + + + + + + + + + + + From de9fe25671c1212720e345d699dd8d61f4da81ca Mon Sep 17 00:00:00 2001 From: Yan Wang Date: Mon, 3 Apr 2023 15:15:00 -0700 Subject: [PATCH 4/7] build aws sdk on release action --- .github/workflows/release.yml | 22 ++++++++++++++++++++-- build_installer.ps1 | 5 +++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8602bc1c5..4e08dc48a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,7 +40,12 @@ jobs: brew unlink unixodbc brew install libiodbc mysql-client brew link --overwrite --force libiodbc - + + - name: Build and install AWS SDK C++ + working-directory: ./scripts + run: | + ./build_aws_sdk_unix.sh $BUILD_TYPE + - name: Create build environment run: cmake -E make_directory ${{ github.workspace }}/build @@ -94,6 +99,11 @@ jobs: curl -L https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-${{ vars.MYSQL_VERSION }}-linux-glibc2.12-x86_64.tar.xz -o mysql.tar.gz tar xf mysql.tar.gz + - name: Build and install AWS SDK C++ + working-directory: ./scripts + run: | + ./build_aws_sdk_unix.sh $BUILD_TYPE + - name: Create build environment shell: bash run: cmake -E make_directory ${{ github.workspace }}/build @@ -142,12 +152,20 @@ jobs: curl -L https://cdn.mysql.com/archives/mysql-8.0/mysql-${{ vars.MYSQL_VERSION }}-winx64.zip -o mysql.zip unzip -d C:/ mysql.zip + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1.1 + + - name: Build and install AWS SDK C++ + working-directory: ./scripts + run: | + .\build_aws_sdk_win.ps1 x64 ${{ env.BUILD_TYPE}} ON "${{env.CMAKE_GENERATOR}}" + - name: Setup nmake uses: ilammy/msvc-dev-cmd@v1 - name: Run build installer script run: | - .\build_installer.ps1 x64 $BUILD_TYPE C:/mysql-${{ vars.MYSQL_VERSION }}-winx64 + .\build_installer.ps1 x64 ${{ env.BUILD_TYPE}} "${{env.CMAKE_GENERATOR}}" C:/mysql-${{ vars.MYSQL_VERSION }}-winx64 - name: Upload Windows installer as artifact if: success() diff --git a/build_installer.ps1 b/build_installer.ps1 index 6849eccfa..b166e66c6 100644 --- a/build_installer.ps1 +++ b/build_installer.ps1 @@ -45,7 +45,8 @@ Note that building the installer requires the following: $ARCHITECTURE = $args[0] $CONFIGURATION = $args[1] -$MYSQL_DIR = $args[2] +$GENERATOR = $args[2] +$MYSQL_DIR = $args[3] # Set default values if ($null -eq $CONFIGURATION) { @@ -56,7 +57,7 @@ if ($null -eq $MYSQL_DIR) { } # BUILD DRIVER -cmake -S . -B ./build -G "Visual Studio 17 2022" -DMYSQL_DIR="$MYSQL_DIR" -DMYSQLCLIENT_STATIC_LINKING=TRUE -DCMAKE_BUILD_TYPE="$CONFIGURATION" -DBUNDLE_DEPENDENCIES=TRUE +cmake -S . -B ./build -G $GENERATOR -DMYSQL_DIR="$MYSQL_DIR" -DMYSQLCLIENT_STATIC_LINKING=TRUE -DCMAKE_BUILD_TYPE="$CONFIGURATION" -DBUNDLE_DEPENDENCIES=TRUE cmake --build ./build --config "$CONFIGURATION" # CREATE INSTALLER From 880c95aa0db687c79f2ee13ff72372823e4b8b46 Mon Sep 17 00:00:00 2001 From: Yan Wang Date: Mon, 3 Apr 2023 15:25:07 -0700 Subject: [PATCH 5/7] workflow dispatch --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4e08dc48a..6b2166838 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,9 +2,9 @@ name: Release Draft # This workflow is triggered on creating tags on: push: - workflow_dispatch: tags: - "*.*.*" + workflow_dispatch: env: BUILD_TYPE: Release From 0c97f53ebcdb0778c39c4aadf840b19f6c0dc90f Mon Sep 17 00:00:00 2001 From: Yan Wang Date: Mon, 3 Apr 2023 19:34:34 -0700 Subject: [PATCH 6/7] bundle aws sdk when doing cpack on mac and linux --- .github/workflows/release.yml | 2 ++ CMakeLists.txt | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b2166838..3a0cc9b98 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,6 +56,7 @@ jobs: -DMYSQLCLIENT_STATIC_LINKING=true -DODBC_INCLUDES=$ODBC_DM_INCLUDES -DCONNECTOR_PLATFORM=macos + -DBUNDLE_DEPENDENCIES=true - name: Build driver working-directory: ${{ github.workspace }}/build @@ -117,6 +118,7 @@ jobs: -DWITH_UNIXODBC=1 -DCONNECTOR_PLATFORM=linux -DMYSQL_DIR=./mysql-${{ vars.MYSQL_VERSION }}-linux-glibc2.12-x86_64/ + -DBUNDLE_DEPENDENCIES=true # Build driver - name: Build driver diff --git a/CMakeLists.txt b/CMakeLists.txt index b14e62cd6..9bd38b40f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -790,7 +790,7 @@ set(PLUGINS) # additional bundled dependencies of the client library set(BUNDLED_LIBS - libssl libcrypto ssleay libeay + libssl libcrypto ssleay libeay ${AWSSDK_LINK_LIBRARIES} ) # List plugins and other libraries that can be found bundled with the server @@ -840,10 +840,10 @@ function(bundle_lib lib) endfunction(bundle_lib) macro(copy_lib_for_wix lib) - - get_filename_component(lib_name ${lib} NAME) - configure_file(${lib} ${CMAKE_SOURCE_DIR}/wix/x64/${lib_name} COPYONLY) - + if(WIN32) + get_filename_component(lib_name ${lib} NAME) + configure_file(${lib} ${CMAKE_SOURCE_DIR}/wix/x64/${lib_name} COPYONLY) + endif(WIN32) endmacro(copy_lib_for_wix) # Bundle libraries listed in a list variable ${to_bundle}. @@ -866,7 +866,8 @@ macro(bundle_libs to_bundle ignored) file(GLOB _bundled "${MYSQL_LIB_DIR}/*${CMAKE_SHARED_LIBRARY_SUFFIX}*" - "${MYSQL_LIB_DIR}/private/*${CMAKE_SHARED_LIBRARY_SUFFIX}*" + "${MYSQL_LIB_DIR}/private/*${CMAKE_SHARED_LIBRARY_SUFFIX}*" + "${CMAKE_SOURCE_DIR}/aws_sdk/install/lib/*${CMAKE_SHARED_LIBRARY_SUFFIX}*" ) # On windows, libs are in bin directory From fc36f90ea90bd124a812fdcc68e48bbe50a74e5e Mon Sep 17 00:00:00 2001 From: Yan Wang Date: Tue, 4 Apr 2023 10:20:27 -0700 Subject: [PATCH 7/7] fix mac installer aws dependencies --- CMakeLists.txt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bd38b40f..501bbd602 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -788,10 +788,18 @@ endif() set(PLUGINS) # additional bundled dependencies of the client library +if(APPLE) + set(BUNDLED_LIBS + libssl libcrypto ssleay libeay + libaws-c-auth libaws-c-cal libaws-c-common libaws-c-compression libaws-c-event-stream libaws-c-http libaws-c-io + libaws-c-mqtt libaws-c-s3 libaws-c-sdkutils libaws-checksums libaws-cpp-sdk-core libaws-cpp-sdk-rds libaws-cpp-sdk-secretsmanager libaws-crt-cpp + ) +else(APPLE) + set(BUNDLED_LIBS + libssl libcrypto ssleay libeay ${AWSSDK_LINK_LIBRARIES} + ) +endif(APPLE) -set(BUNDLED_LIBS - libssl libcrypto ssleay libeay ${AWSSDK_LINK_LIBRARIES} -) # List plugins and other libraries that can be found bundled with the server # but which are not relevant on client-side and can be safely ignored.