Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add libxcrypt MSYS2 builder #34

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Dec 11, 2024

This does a full client build of libxcrypt, using upstream's autotools based build chain on MSYS2, but using MSVC build tools. This requires wrappers for the MSVC build tools; ar-lib and compile are taken unmodified from automake; windres is a minimalist self-made wrapper.

A prerequisite is a suitable libxcrypt patched to support MSVC builds[1].

[1] besser82/libxcrypt#195


A test build is available at https://github.com/cmb69/winlib-builder/actions/runs/12279660573 (this should not be used for production; only for testing purposes).

This does a full client build of libxcrypt, using upstream's autotools
based build chain on MSYS2, but using MSVC build tools. This requires
wrappers for the MSVC build tools; ar-lib and compile are taken
unmodified from automake; windres is a minimalist self-made wrapper.

A prerequisite is a suitable libxcrypt patched to support MSVC
builds[1].

[1] <besser82/libxcrypt#195>
@cmb69
Copy link
Member Author

cmb69 commented Dec 11, 2024

Another test build (including cross-compilation for ARM64): https://github.com/cmb69/winlib-builder/actions/runs/12281525937

Generally, should add /Qspectre to CFLAGS (and maybe more).

PS:

arm64.patch

 .github/workflows/libxcrypt_msys.yml |  4 ++--
 patches/libxcrypt.patch              | 24 ++++++++++++++++++++----
 scripts/compute-virtuals.ps1         |  1 +
 3 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/libxcrypt_msys.yml b/.github/workflows/libxcrypt_msys.yml
index 5d79678..90e85ab 100644
--- a/.github/workflows/libxcrypt_msys.yml
+++ b/.github/workflows/libxcrypt_msys.yml
@@ -15,7 +15,7 @@ jobs:
   build:
     strategy:
       matrix:
-          arch: [x64, x86]
+          arch: [x64, x86, amd64_arm64]
     runs-on: windows-2022
     steps:
       - name: Set git to use LF
@@ -63,7 +63,7 @@ jobs:
           >>winlibs.sh echo   LDFLAGS='-debug' \
           >>winlibs.sh echo   LIBS='-lBcrypt'
           >>winlibs.sh echo make
-          >>winlibs.sh echo make check
+          >>winlibs.sh echo #make check
           >>winlibs.sh echo make install
       - name: Build libxcrypt
         run: |
diff --git a/patches/libxcrypt.patch b/patches/libxcrypt.patch
index 99d4db8..5c84c1b 100644
--- a/patches/libxcrypt.patch
+++ b/patches/libxcrypt.patch
@@ -1,7 +1,8 @@
- Makefile.am         | 4 ----
- configure.ac        | 1 +
- test/alg-yescrypt.c | 2 +-
- 3 files changed, 2 insertions(+), 5 deletions(-)
+ Makefile.am                   | 4 ----
+ build-aux/m4/zw_endianness.m4 | 4 ++--
+ configure.ac                  | 1 +
+ test/alg-yescrypt.c           | 2 +-
+ 4 files changed, 4 insertions(+), 7 deletions(-)
 
 diff --git a/Makefile.am b/Makefile.am
 index 5c07059..08ed7ee 100644
@@ -27,6 +28,21 @@ index 5c07059..08ed7ee 100644
  	test/preferred-method \
  	test/short-outbuf \
  	test/special-char-salt
+diff --git a/build-aux/m4/zw_endianness.m4 b/build-aux/m4/zw_endianness.m4
+index 00c3fdd..e758c68 100644
+--- a/build-aux/m4/zw_endianness.m4
++++ b/build-aux/m4/zw_endianness.m4
+@@ -102,8 +102,8 @@ m4_define([zw_C_ENDIANNESS_options], [
+   [(defined _MIPSEB) != (defined _MIPSEL)],
+   [defined _MIPSEB], [defined _MIPSEL], [0],
+ ],
+-[ [_MSC_VER and _M_X64 or _M_IX86],
+-  [defined _MSC_VER && (defined _M_X64 || defined _M_IX86)],
++[ [_MSC_VER and _M_X64 or _M_IX86 or _M_ARM64],
++  [defined _MSC_VER && (defined _M_X64 || defined _M_IX86 || defined _M_ARM64)],
+   [0], [1], [0],
+ ]
+ ])
 diff --git a/configure.ac b/configure.ac
 index 4b8afd8..1523e92 100644
 --- a/configure.ac
diff --git a/scripts/compute-virtuals.ps1 b/scripts/compute-virtuals.ps1
index 025a63d..274148b 100644
--- a/scripts/compute-virtuals.ps1
+++ b/scripts/compute-virtuals.ps1
@@ -72,6 +72,7 @@ if (-not $winsdk) {
 $msarchs = @{
     "x64" = "x64"
     "x86" = "Win32"
+    "amd64_arm64" = "ARM64"
 }
 $msarch = $msarchs.$arch
 if (-not $msarch) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant