Skip to content

Commit acdc74b

Browse files
committed
Use msys2 tooling for gendef
1 parent 4a11ea6 commit acdc74b

2 files changed

Lines changed: 12 additions & 33 deletions

File tree

bin/cibw_before_all_windows_amd64.sh

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set -o errexit
44

55
pacman -S --noconfirm \
66
mingw-w64-ucrt-x86_64-gcc\
7+
mingw-w64-ucrt-x86_64-llvm-tools\
78
mingw-w64-ucrt-x86_64-tools-git\
89
m4\
910
make\
@@ -19,28 +20,16 @@ bin/build_dependencies_unix.sh \
1920
--patch-C23\
2021
#
2122

22-
# Assumes the standard GitHub Actions Windows 2022 runner layout.
23-
PATH="$PATH:$(find "/c/Program Files/Microsoft Visual Studio/2022/" -name "Hostx86")/x64/"
24-
2523
mkdir -p .local/lib
2624
cd .local/bin
2725
for dll_file in libgmp-*.dll libmpfr-*.dll libflint*.dll
2826
do
29-
lib_name=$(basename -s .dll ${dll_file})
30-
exports_file=${lib_name}-exports.txt
27+
lib_name=$(basename -s .dll "${dll_file}")
3128
def_file=${lib_name}.def
32-
lib_file=${lib_name}.lib
33-
name=$(echo ${lib_name}|sed 's/^lib//;s/[-.][0-9].*$//')
34-
35-
dumpbin //exports ${dll_file} > ${exports_file}
36-
37-
echo LIBRARY ${lib_name} > ${def_file}
38-
echo EXPORTS >> ${def_file}
39-
awk 'NR>19 && $4 != "" {print $4 " @"$1}' ${exports_file} >> ${def_file}
40-
sed -i 's/$/\r/' ${def_file}
29+
name=$(echo "${lib_name}" | sed 's/^lib//;s/[-.][0-9].*$//')
4130

42-
lib //def:${def_file} //out:${lib_file} //machine:x64
43-
rm ${exports_file} ${def_file} ${lib_name}.exp
44-
mv ${lib_file} ../lib/${name}.lib
31+
gendef "${dll_file}"
32+
llvm-lib /def:"${def_file}" /out:"../lib/${name}.lib" /machine:x64 /nologo
33+
rm "${def_file}"
4534
done
4635
cd ../..

bin/cibw_before_all_windows_arm64.sh

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set -o errexit
44

55
pacman -S --noconfirm \
66
mingw-w64-clang-aarch64-toolchain\
7+
mingw-w64-clang-aarch64-llvm-tools\
78
mingw-w64-clang-aarch64-tools-git\
89
m4\
910
make\
@@ -22,27 +23,16 @@ bin/build_dependencies_unix.sh \
2223
--patch-ldd\
2324
#
2425

25-
PATH="$PATH:$(find "/c/Program Files/Microsoft Visual Studio/2022/" -name "Hostx86")/x64/"
26-
2726
mkdir -p .local/lib
2827
cd .local/bin
2928
for dll_file in libgmp-*.dll libmpfr-*.dll libflint*.dll
3029
do
31-
lib_name=$(basename -s .dll ${dll_file})
32-
exports_file=${lib_name}-exports.txt
30+
lib_name=$(basename -s .dll "${dll_file}")
3331
def_file=${lib_name}.def
34-
lib_file=${lib_name}.lib
35-
name=$(echo ${lib_name}|sed 's/^lib//;s/[-.][0-9].*$//')
36-
37-
dumpbin //exports ${dll_file} > ${exports_file}
38-
39-
echo LIBRARY ${lib_name} > ${def_file}
40-
echo EXPORTS >> ${def_file}
41-
awk 'NR>19 && $4 != "" {print $4 " @"$1}' ${exports_file} >> ${def_file}
42-
sed -i 's/$/\r/' ${def_file}
32+
name=$(echo "${lib_name}" | sed 's/^lib//;s/[-.][0-9].*$//')
4333

44-
lib //def:${def_file} //out:${lib_file} //machine:arm64
45-
rm ${exports_file} ${def_file} ${lib_name}.exp
46-
mv ${lib_file} ../lib/${name}.lib
34+
gendef "${dll_file}"
35+
llvm-lib /def:"${def_file}" /out:"../lib/${name}.lib" /machine:arm64 /nologo
36+
rm "${def_file}"
4737
done
4838
cd ../..

0 commit comments

Comments
 (0)