├── patch_configure.patch ├── patch_file.patch ├── README.md └── .github └── workflows └── build.yml /patch_configure.patch: -------------------------------------------------------------------------------- 1 | diff --git a/configure.ac b/configure.ac 2 | index e23a2ed..8ccce25 100644 3 | --- a/configure.ac 4 | +++ b/configure.ac 5 | @@ -86,7 +86,7 @@ AC_SUBST(LFLAGS) 6 | CFLAGS="$CFLAGS -Wall" 7 | LOCALE_T=locale_t 8 | AS_CASE([$host], 9 | - [*mingw*], [LDFLAGS="$LDFLAGS -no-undefined" CFLAGS="$CFLAGS -D_spawnv=spawnv"], []) 10 | + [*mingw*], [LDFLAGS="$LDFLAGS -no-undefined" LOCALE_T=_locale_t], []) 11 | AC_SUBST(LOCALE_T) 12 | 13 | dnl See if iconv is present and wanted 14 | -------------------------------------------------------------------------------- /patch_file.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/libmdb/fakeglib.c b/src/libmdb/fakeglib.c 2 | index b767eea..430f51b 100644 3 | --- a/src/libmdb/fakeglib.c 4 | +++ b/src/libmdb/fakeglib.c 5 | @@ -487,7 +487,7 @@ gchar *g_option_context_get_help (GOptionContext *context, 6 | char *end = help + 4096; 7 | char *p = help; 8 | p += snprintf(p, end - p, 9 | - "Usage:\n %s [OPTION\xE2\x80\xA6] %s\n\n", appname, context->desc); 10 | + "Usage:\n %s [OPTION...] %s\n\n", appname, context->desc); 11 | p += snprintf(p, end - p, 12 | "Help Options:\n -h, --%-20s%s\n\n", "help", "Show help options"); 13 | p += snprintf(p, end - p, 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mdbtools-win-build-action 2 | 3 | MDBTools built for Windows using MSYS2 and Github Action 4 | 5 | Read the [mdbtools](https://github.com/mdbtools/mdbtools) guide about [build from source](https://github.com/mdbtools/mdbtools/blob/dev/README.md#from-source) 6 | 7 | And windows build guide: [lsgunth/mdbtools-win](https://github.com/lsgunth/mdbtools-win) 8 | 9 | ## Build Info 10 | 11 | > tweak: Replace `…`(U+2026) [Horizontal Ellipsis](https://unicode-table.com/cn/2026/) 12 | 13 | | Name | Discription | Build Artifacts | 14 | | ---------------- | ------------ | ------------------------------------------------------------ | 15 | | build.yml | UCRT64 Build | [![Build UCRT64](https://github.com/liuxspro/mdbtools-win-build-action/actions/workflows/build.yml/badge.svg)](https://github.com/liuxspro/mdbtools-win-build-action/actions/workflows/build.yml) | 16 | 17 | ## Test 18 | 19 | TODO 20 | 21 | ```bash 22 | git clone https://github.com/mdbtools/mdbtestdata.git test 23 | ``` 24 | 25 | ## Other 26 | 27 | When GCC was upgraded to version 12, build errors started appearing, so I tried downgrading from GCC 12 to 11.3. 28 | 29 | Refer to this issue: [Cannot downgrade from GCC 12 to 11.3 #11730](https://github.com/msys2/MINGW-packages/issues/11730) 30 | 31 | This website [https://repo.msys2.org/mingw/](https://repo.msys2.org/mingw/) contains old version packages 32 | 33 | > 似乎不是gcc版本的问题, 现在gcc 13也能正常编译 34 | 35 | ### UCRT64 build fails 36 | 37 | [Fix windows GH action (#399) · mdbtools/mdbtools@0b96eca (github.com)](https://github.com/mdbtools/mdbtools/commit/0b96ecaff1c543feb39b7e855fa61e6651a01203) this seems cause MSYS2 UCRT64 build fails 38 | 39 | see 40 | [Add option to disable spawnv define by JorisGoosen · Pull Request #301 · WizardMac/ReadStat (github.com)](https://github.com/WizardMac/ReadStat/pull/301) 41 | 42 | ### Links 43 | 44 | [Setup MSYS2 · Actions](https://github.com/marketplace/actions/setup-msys2) 45 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | on: 3 | workflow_dispatch: 4 | 5 | jobs: 6 | build-mdbtools-win: 7 | runs-on: windows-latest 8 | strategy: 9 | fail-fast: false 10 | matrix: 11 | sys: 12 | # - clang64 13 | - ucrt64 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v4 17 | 18 | - name: Clone Mdbtools 19 | run: | 20 | git clone --depth=1 https://github.com/mdbtools/mdbtools.git 21 | 22 | - name: Patch 23 | run: | 24 | cd mdbtools 25 | git apply ../patch_file.patch 26 | git apply ../patch_configure.patch 27 | 28 | - name: Setup MSYS2 29 | uses: msys2/setup-msys2@v2 30 | with: 31 | msystem: ${{matrix.sys}} 32 | release: false 33 | update: true 34 | install: >- 35 | autoconf 36 | automake 37 | libtool 38 | base-devel 39 | pacboy: >- 40 | pkg-config:p 41 | gcc:p 42 | glib2:p 43 | - name: Debug 44 | shell: msys2 {0} 45 | run: | 46 | gcc -v 47 | sed -n '490p' ./mdbtools/src/libmdb/fakeglib.c 48 | pwd 49 | 50 | - name: Autoconf 51 | shell: msys2 {0} 52 | run: cd mdbtools && autoreconf -i -f 53 | 54 | - name: Configure 55 | shell: msys2 {0} 56 | run: cd mdbtools && ./configure --disable-glib 57 | 58 | - name: Make 59 | shell: msys2 {0} 60 | run: cd mdbtools && make all 61 | 62 | - name: Debug 63 | shell: msys2 {0} 64 | run: | 65 | sed -n '490p' ./mdbtools/src/libmdb/fakeglib.c 66 | ./mdbtools/src/util/mdb-export.exe --help 67 | 68 | - name: Orgnize file 69 | run: | 70 | mkdir mdbtools-build-win-${{matrix.sys}} 71 | cp ./mdbtools/COPYING* ./mdbtools-build-win-${{matrix.sys}}/ 72 | cp ./mdbtools/src/util/.libs/*.exe ./mdbtools-build-win-${{matrix.sys}}/ 73 | cp ./mdbtools/src/sql/.libs/*.dll ./mdbtools-build-win-${{matrix.sys}}/ 74 | cp ./mdbtools/src/libmdb/.libs/*.dll ./mdbtools-build-win-${{matrix.sys}}/ 75 | 76 | cp C:/msys64/${{matrix.sys}}/bin/libgcc*.dll ./mdbtools-build-win-${{matrix.sys}}/ 77 | cp C:/msys64/${{matrix.sys}}/bin/libwinpthread*.dll ./mdbtools-build-win-${{matrix.sys}}/ 78 | 79 | ls ./mdbtools-build-win-${{matrix.sys}}/ 80 | 81 | - name: Upload a Build Artifact 82 | uses: actions/upload-artifact@v4 83 | with: 84 | name: "mdbtools-build-win-${{matrix.sys}}" 85 | path: ./mdbtools-build-win-${{matrix.sys}}/ 86 | --------------------------------------------------------------------------------