diff --git a/.github/workflows/32bit_windows.yml b/.github/workflows/32bit_windows.yml deleted file mode 100644 index a396149..0000000 --- a/.github/workflows/32bit_windows.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: Windows wheels for 32 bit Python - -on: [push, pull_request] - -jobs: - build_wheels: - name: Build Windows wheels for 32 bit Python - runs-on: windows-latest - defaults: - run: - shell: msys2 {0} - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v4 - name: Install a Python to use for building - with: - python-version: '3.11' - - - uses: msys2/setup-msys2@v2 - name: Setup an msys2 environment - with: - msystem: CLANG32 - release: false - install: >- - base-devel - m4 - bison - make - patch - sed - pacboy: clang:p gcc-compat:p - path-type: inherit - - - name: Expand the path for Visual Studio 2019 - run: | - echo "/c/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x86" >> $GITHUB_PATH - - - name: Install cibuildwheel - run: | - python -m pip install cibuildwheel - - - name: Build gmp and pari - run: | - bash build_pari.sh pari32 gmp32 - - - name: Build many wheels - run: | - python -m cibuildwheel --output-dir wheelhouse - env: - CIBW_ARCHS: x86 - CIBW_BUILD: cp310-* cp311-* cp312* - CIBW_BEFORE_BUILD: | - pip install cython - CIBW_TEST_COMMAND: python -m cypari.test - - - uses: actions/upload-artifact@v3 - name: Save the wheels as artifacts - with: - path: ./wheelhouse/*.whl diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index b257fc0..acff177 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -26,7 +26,7 @@ jobs: run: | python3 -m cibuildwheel --output-dir wheelhouse env: - CIBW_BUILD: cp310-manylinux_x86_64 cp311-manylinux_x86-64 cp312-manylinux_x86_64 + CIBW_BUILD: cp38-manylinux_x86_64 cp39-manylinux_x86-64 cp310-manylinux_x86_64 cp311-manylinux_x86-64 cp312-manylinux_x86_64 CIBW_BEFORE_BUILD: | pip3 install cython>=3.0.0 CIBW_REPAIR_WHEEL_COMMAND_LINUX: auditwheel repair --strip -w {dest_dir} {wheel} diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 2650895..5a03724 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/setup-python@v2 name: Install Python with: - python-version: 3.12-dev + python-version: 3.12 - name: Install cibuildwheel run: | python -m pip install cibuildwheel @@ -25,7 +25,7 @@ jobs: run: | python3.12 -m cibuildwheel --output-dir wheelhouse env: - CIBW_BUILD: cp310-* cp311-* cp312-* + CIBW_BUILD: cp38* cp39* cp310-* cp311-* cp312-* CIBW_ARCHS_MACOS: "x86_64 arm64 universal2" CIBW_BEFORE_BUILD: | pip install cython>=3.0.0 diff --git a/.github/workflows/64bit_windows.yml b/.github/workflows/windows.yml similarity index 88% rename from .github/workflows/64bit_windows.yml rename to .github/workflows/windows.yml index f4efe79..42046e9 100644 --- a/.github/workflows/64bit_windows.yml +++ b/.github/workflows/windows.yml @@ -1,4 +1,4 @@ -name: Windows wheels for 64 bit Python +name: Windows wheels on: [push, pull_request] @@ -16,7 +16,7 @@ jobs: - uses: actions/setup-python@v4 name: Install a Python to use for building with: - python-version: '3.11' + python-version: '3.12' - uses: msys2/setup-msys2@v2 name: Setup an msys2 environment @@ -50,7 +50,7 @@ jobs: python -m cibuildwheel --output-dir wheelhouse env: CIBW_ARCHS: AMD64 - CIBW_BUILD: cp310* cp311* cp312-* + CIBW_BUILD: cp38* cp39* cp310* cp311* cp312-* CIBW_BEFORE_BUILD: | pip install cython CIBW_TEST_COMMAND: python -m cypari.test diff --git a/Windows/README.Windows b/Windows/README.Windows index 848492d..21e02a9 100644 --- a/Windows/README.Windows +++ b/Windows/README.Windows @@ -1,37 +1,15 @@ Introduction ------------ -Version 2 of CyPari for Windows is built using MSys2 and the mingw32 +CyPari is built for 64 bit Windows using MSys2 and the ucrt64 gcc toolchain. It passes the doctests at essentially the same rate as the linux and macOS versions, and supports SIGINT interrupts via -control-C. However, there are some caveats: - -1) The mingw32 toolchain must be modified to produce a Python -extension module which does not segfault while being loaded. (See the -explanation in "About Segfaults" below.) To deal with this issue, the -script install_files_32.sh in the toolchain directory adds the needed -files to your mingw32 toolchain. (The mingw64 version has not been -tested, but may work.) - -2) To be able to interrupt a long computation by typing control-C -requires two non-trivial things: (i) the module must have appropriate -SIGINT handlers and (see "About longjmp" below); and (ii) the terminal -must send a SIGINT signal (see "About SIGINT" below). The caveat here -is that the Cygwin Mintty terminal provided with MSys2 does not handle -sending a SIGINT in the same way as the Windows console, which causes -different behavior. More importantly, it is not possible to run python -interactively in Mintty at all, unless you run the python process -within a winpty wrapper: -$ winpty python - -One way to handle this is to add something like the following to the -end of the .bash_profile in your msys2 home directory: - -export PATH="/c/Python27:/c/Python27/Scripts:/c/emacs-2.4.v/bin:/c/Program Files (x86)/Common Files/Microsoft/Visual C++ for Python/9.0/VC/bin:$PATH" -winpty bash; exit - -(The second line runs bash in a winpty wrapper and exits when that shell -is killed.) +control-C. Using the ucrt64 toolchain means that CyPari no longer +depends on the out-dated msvcrt.dll and instead will use the +Universal C Runtime which ships with Windows 10 and later. The +UCRT is compliant with C99 and is designed to avoid the headaches +and compatibility issues that come with using a C runtime from +a specific version of Visual Studio. About Segfaults --------------- @@ -58,48 +36,6 @@ unresolved. When realloc is needed in initprimes, the symbol is resolved against the msvcrt.dll. The two runtimes do not allocate memory in compatible ways - hence the segfault. -There is a reason why mingw32 uses the out-of-date msvcrt runtime, and -it has to do with Microsoft's attempt to deal with the "DLL Hell" -caused by having many incompatible DLL's on the same system, all with -the same name. Their solution was called "Side by Side Assemblies" -which consist of a DLL, which has been assigned a cryprographic key -uniquely identifying its precise version, and an xml "Manifest file" -which specifies the key. These must appear in the same subdirectory -of the C:\Windows\winsxs directory. In order for a third party DLL or -EXE to call functions from a dll in a side-by-side assemply, the -library must have its own manifest file which matches the one in -winsxs. This user manifest file must either appear in the same -directory as the DLL or EXE, or else be embedded in it as a Windows -"Resource". The gcc linker is able to embed these resource files, if -they are supplied on the command line. - -So, to ensure that our cypari extension module gets its C runtime -functions from the same DLL as the Python executable we need to do two -things (and possible a third, even more technical one). First, we -need to prevent gcc from linking against its default msvcrt runtime. -This is done by providing gcc with a "specs" file which specifies -things such as which "hidden" link libraries (e.g. C runtimes) are -linked before the user-supplied libraries. Our specs file specifies -that gcc should link agains the msvcr90 runtime. Second, we need to -provide a resource file that matches the msvcr90 runtime so that the -OS will allow the extension module to access the runtime. The final -technical item is that one of the hidden libraries, called -libmoldname, which has the job of mapping names of runtime functions -to the older name which has an underscore prepended, probably has to -be replaced with one that has symbols matching msvcr90 instead of -msvcrt. To accomplish all this we need to add three files to the -mingw32 toolchain. Thes files are named specs90, mscvr90.res and -libmoldname90.a. In addition, to make gcc use the specs file, we need -to pass the option specs=specs90 to the mingw32 linker. Our spec -file is a modified version of the one developed by the mingwpy -project (https://mingwpy.github.io/). Instructions for using the -gnu dlltool to build libmoldname90.a can be found on the pygame -website (http://www.pygame.org/wiki/PreparingMinGW). The tool used -to convert an xml file to a windows resource is called windres -(see http://www.mingw.org/wiki/MS_resource_compiler). The structure -of a manifest file is described on the Microsoft developer site -(https://msdn.microsoft.com/en-us/library/windows/desktop/aa375365(v=vs.85).aspx). - About longjmp ------------- diff --git a/Windows/clear_cache.txt b/Windows/clear_cache.txt deleted file mode 100644 index 8eca3ff..0000000 --- a/Windows/clear_cache.txt +++ /dev/null @@ -1,4 +0,0 @@ -# This file is a dependency for the build cache. Committing a change to this -# file will cause the cache to be deleted. - -2021-01-06 diff --git a/Windows/gcc/libgcc.a b/Windows/gcc/libgcc.a deleted file mode 100644 index 928f592..0000000 Binary files a/Windows/gcc/libgcc.a and /dev/null differ diff --git a/Windows/get_toolchain.py b/Windows/get_toolchain.py deleted file mode 100644 index 1d0663b..0000000 --- a/Windows/get_toolchain.py +++ /dev/null @@ -1,22 +0,0 @@ -import sys, os, requests, subprocess - -if sys.version_info.major == 2: - sys.exit() - -sf_url = 'https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/threads-posix/dwarf/i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z/download' - -toolchain_path = os.path.join('C:', 'mingw-w64', - 'i686-8.1.0-posix-dwarf-rt_v6-rev0') -if os.path.isdir(toolchain_path): - sys.exit() -os.mkdir(toolchain_path) -print('Downloading toolchain ...') -response = requests.get(sf_url, allow_redirects=True, timeout=30) -print('Received %d bytes.'%len(response.content)) -with open('toolchain.7z', 'wb') as output: - output.write(response.content) -print('Unzipping toolchain ...') -junk = subprocess.check_output(['7z', 'x', 'toolchain.7z']) -os.remove('toolchain.7z') -os.rename('mingw32', os.path.join(toolchain_path, 'mingw32')) -print('Done') diff --git a/Windows/mingw_c.patch b/Windows/mingw_c.patch deleted file mode 100644 index 00d4ff7..0000000 --- a/Windows/mingw_c.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- src/systems/mingw/mingw.c.orig 2020-02-14 03:17:45.000000000 -0600 -+++ src/systems/mingw/mingw.c 2020-03-05 13:10:26.365848900 -0600 -@@ -145,6 +145,7 @@ - void - win32_set_pdf_viewer(void) - { -+ #if 0 - char *s = getenv("GP_PDF_VIEWER"); - if (!s) - { -@@ -163,6 +164,7 @@ - sprintf(buf,"GP_PDF_VIEWER=%s",str); - putenv(buf); - } -+ #endif - } - - extern int win32ctrlc, win32alrm; diff --git a/Windows/msys64_env.sh b/Windows/msys64_env.sh deleted file mode 100644 index 4d81e3d..0000000 --- a/Windows/msys64_env.sh +++ /dev/null @@ -1,19 +0,0 @@ -# This sets up a reasonable environment for python development on -# msys64 You can add this to the end of your .bash_profile, or source -# it. It assumes that you have installed the python.org 32-bit Python -# 2.7 in C:\Python27 and their 64-bit Python 2.7 in C:\Python27_64. -# It also assumes that you have installed "Visual C++ for Python" from -# Microsoft. -# https://www.microsoft.com/en-us/download/details.aspx?id=44266 - -if [ $(uname) = "MINGW64_NT-6.1" ] ; then - export PATH="/c/Python27_64:/c/Python27_64/Scripts:/c/emacs-24.5/bin:/c/Program Files (x86)/Common Files/Microsoft/Visual C++ for Python/9.0/VC/bin:/c/Program Files (x86)/Common Files/Microsoft/Visual C++ for Python/9.0/WinSDK/Bin:$PATH" -else - export PATH="/c/Python27:/c/Python27/Scripts:/c/emacs-24.5/bin:/c/Program Files (x86)/Common Files/Microsoft/Visual C++ for Python/9.0/VC/bin:/c/Program Files (x86)/Common Files/Microsoft/Visual C++ for Python/9.0/WinSDK/Bin:$PATH" -fi - -# Run bash inside a winpty wrapper to make it possible to run python -# interactively from a mintty terminal. Install winpty with: -# pacman -S winpty -winpty bash; exit - diff --git a/Windows/pari_config.patch b/Windows/pari_config.patch deleted file mode 100644 index a8a6f54..0000000 --- a/Windows/pari_config.patch +++ /dev/null @@ -1,53 +0,0 @@ -diff -u pari_src/config/arch-osname config_new/arch-osname ---- config/arch-osname 2011-09-22 15:02:11.000000000 -0500 -+++ config_new/arch-osname 2018-04-11 06:35:23.947800500 -0500 -@@ -5,7 +5,8 @@ - if test -n "$myuname"; then - myuname=`echo $myuname | sed -e 's/^[^=]*=//' -e 's,/,,g' | \ - tr '[A-Z]' '[a-z]' | tr '\012' ' '` -- set X $myuname; shift; osname=$1 -+ #set X $myuname; shift; osname=$1 -+ osname="mingw" - case "$osname" in - irix*) osname=irix;; - fx2800) arch=fx2800; osname=concentrix;; -diff -u pari_src/config/get_gmp config_new/get_gmp ---- config/get_gmp 2017-01-14 06:26:41.000000000 -0600 -+++ config_new/get_gmp 2018-04-11 07:20:35.448573300 -0500 -@@ -39,9 +39,10 @@ - fi - fi - --if test -r $exe; then -- gmp_version=`env LD_LIBRARY_PATH="$LD_LIBRARY_PATH$dir_sep$gmp" $RUNTEST $exe`; --fi -+gmp_version="6.1.2" -+#if test -r $exe; then -+# gmp_version=`env LD_LIBRARY_PATH="$LD_LIBRARY_PATH$dir_sep$gmp" $RUNTEST $exe`; -+#fi - case "$gmp_version" in - unsupported) gmp= - echo "### Your GMP library ABI is unsupported.";; -@@ -56,14 +57,14 @@ - *) if test -z "$gmp"; then gmp=yes; fi;; - esac - --if test -n "$gmp"; then -- cmd="$CC $CFLAGS $extraflag $GMPINCLUDE -o $exe gmp_mismatch.c $GMPLIBS" -- . log_cmd -- if test ! -r $exe; then -- gmp= -- echo "### GMP headers mismatch: try both --with-gmp-lib and --with-gmp-include" -- fi --fi -+#if test -n "$gmp"; then -+# cmd="$CC $CFLAGS $extraflag $GMPINCLUDE -o $exe gmp_mismatch.c $GMPLIBS" -+# . log_cmd -+# if test ! -r $exe; then -+# gmp= -+# echo "### GMP headers mismatch: try both --with-gmp-lib and --with-gmp-include" -+# fi -+#fi - - . cleanup_exe - diff --git a/Windows/parigen.h.patch b/Windows/parigen.h.patch deleted file mode 100644 index 51d5c01..0000000 --- a/Windows/parigen.h.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- src64/headers/parigen.h 2020-03-05 12:55:11.290389900 -0600 -+++ patched_src64/headers/parigen.h 2020-03-05 12:45:50.048980800 -0600 -@@ -15,7 +15,11 @@ - - #ifdef _WIN64 - typedef unsigned long long pari_ulong; --#define long long long -+#include -+typedef long long pari_long; -+#define YYPTRDIFF_T pari_long -+#define YYPTRDIFF_MAXIMUM LLONG_MAX -+#define long pari_long - #define labs llabs - #else - typedef unsigned long pari_ulong; diff --git a/Windows/toolchain/install_files_32.sh b/Windows/toolchain/install_files_32.sh deleted file mode 100644 index 2536519..0000000 --- a/Windows/toolchain/install_files_32.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -GCCVERSION="6.3.0" -TOOLCHAIN="/c/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32" -LIBDIR_MINGW32="${TOOLCHAIN}/lib/" -SPECSDIR_MINGW32="${TOOLCHAIN}/lib/gcc/i686-w64-mingw32/${GCCVERSION}/" -cp mingw32/i686-w64-mingw32/lib/* ${LIBDIR_MINGW32} -cp specs90_32 ${SPECSDIR_MINGW32}/specs90 -cp specs100_32 ${SPECSDIR_MINGW32}/specs100 - diff --git a/Windows/toolchain/install_files_64.sh b/Windows/toolchain/install_files_64.sh deleted file mode 100644 index 791a0da..0000000 --- a/Windows/toolchain/install_files_64.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -GCCVERSION="6.3.0" -TOOLCHAIN="/c/mingw-w64/x86_64-6.3.0-posix-seh-rt_v5-rev1/mingw64" -LIBDIR_MINGW64="${TOOLCHAIN}/lib/" -SPECSDIR_MINGW64="${TOOLCHAIN}/lib/gcc/x86_64-w64-mingw32/${GCCVERSION}/" -cp mingw64/x86_64-w64-mingw32/lib/* ${LIBDIR_MINGW64} -cp specs90_64 ${SPECSDIR_MINGW64}/specs90 -cp specs100_64 ${SPECSDIR_MINGW64}/specs100 diff --git a/Windows/toolchain/mingw32/i686-w64-mingw32/lib/libmoldname100.a b/Windows/toolchain/mingw32/i686-w64-mingw32/lib/libmoldname100.a deleted file mode 100644 index 5de3713..0000000 Binary files a/Windows/toolchain/mingw32/i686-w64-mingw32/lib/libmoldname100.a and /dev/null differ diff --git a/Windows/toolchain/mingw32/i686-w64-mingw32/lib/libmoldname90.a b/Windows/toolchain/mingw32/i686-w64-mingw32/lib/libmoldname90.a deleted file mode 100644 index b1e0647..0000000 Binary files a/Windows/toolchain/mingw32/i686-w64-mingw32/lib/libmoldname90.a and /dev/null differ diff --git a/Windows/toolchain/mingw32/i686-w64-mingw32/lib/msvcr100.dll.res b/Windows/toolchain/mingw32/i686-w64-mingw32/lib/msvcr100.dll.res deleted file mode 100644 index 959a00b..0000000 Binary files a/Windows/toolchain/mingw32/i686-w64-mingw32/lib/msvcr100.dll.res and /dev/null differ diff --git a/Windows/toolchain/mingw32/i686-w64-mingw32/lib/msvcr100.exe.res b/Windows/toolchain/mingw32/i686-w64-mingw32/lib/msvcr100.exe.res deleted file mode 100644 index 3e064fb..0000000 Binary files a/Windows/toolchain/mingw32/i686-w64-mingw32/lib/msvcr100.exe.res and /dev/null differ diff --git a/Windows/toolchain/mingw32/i686-w64-mingw32/lib/msvcr90.dll.res b/Windows/toolchain/mingw32/i686-w64-mingw32/lib/msvcr90.dll.res deleted file mode 100644 index 8d4dfc6..0000000 Binary files a/Windows/toolchain/mingw32/i686-w64-mingw32/lib/msvcr90.dll.res and /dev/null differ diff --git a/Windows/toolchain/mingw32/i686-w64-mingw32/lib/msvcr90.exe.res b/Windows/toolchain/mingw32/i686-w64-mingw32/lib/msvcr90.exe.res deleted file mode 100644 index 2adc4fa..0000000 Binary files a/Windows/toolchain/mingw32/i686-w64-mingw32/lib/msvcr90.exe.res and /dev/null differ diff --git a/Windows/toolchain/mingw64/x86_64-w64-mingw32/lib/libmoldname100.a b/Windows/toolchain/mingw64/x86_64-w64-mingw32/lib/libmoldname100.a deleted file mode 100644 index f453a36..0000000 Binary files a/Windows/toolchain/mingw64/x86_64-w64-mingw32/lib/libmoldname100.a and /dev/null differ diff --git a/Windows/toolchain/mingw64/x86_64-w64-mingw32/lib/libmoldname90.a b/Windows/toolchain/mingw64/x86_64-w64-mingw32/lib/libmoldname90.a deleted file mode 100644 index 32f5992..0000000 Binary files a/Windows/toolchain/mingw64/x86_64-w64-mingw32/lib/libmoldname90.a and /dev/null differ diff --git a/Windows/toolchain/mingw64/x86_64-w64-mingw32/lib/msvcr100.dll.res b/Windows/toolchain/mingw64/x86_64-w64-mingw32/lib/msvcr100.dll.res deleted file mode 100644 index f29c78e..0000000 Binary files a/Windows/toolchain/mingw64/x86_64-w64-mingw32/lib/msvcr100.dll.res and /dev/null differ diff --git a/Windows/toolchain/mingw64/x86_64-w64-mingw32/lib/msvcr100.exe.res b/Windows/toolchain/mingw64/x86_64-w64-mingw32/lib/msvcr100.exe.res deleted file mode 100644 index 6e43075..0000000 Binary files a/Windows/toolchain/mingw64/x86_64-w64-mingw32/lib/msvcr100.exe.res and /dev/null differ diff --git a/Windows/toolchain/mingw64/x86_64-w64-mingw32/lib/msvcr90.dll.res b/Windows/toolchain/mingw64/x86_64-w64-mingw32/lib/msvcr90.dll.res deleted file mode 100644 index d30cf02..0000000 Binary files a/Windows/toolchain/mingw64/x86_64-w64-mingw32/lib/msvcr90.dll.res and /dev/null differ diff --git a/Windows/toolchain/mingw64/x86_64-w64-mingw32/lib/msvcr90.exe.res b/Windows/toolchain/mingw64/x86_64-w64-mingw32/lib/msvcr90.exe.res deleted file mode 100644 index 3a60487..0000000 Binary files a/Windows/toolchain/mingw64/x86_64-w64-mingw32/lib/msvcr90.exe.res and /dev/null differ diff --git a/Windows/toolchain/moldname/build.sh b/Windows/toolchain/moldname/build.sh deleted file mode 100644 index ee9afbd..0000000 --- a/Windows/toolchain/moldname/build.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -cd mingw32 -/c/msys64/mingw32/bin/dlltool.exe -d ../moldname-msvcrt.def -U --dllname msvcr90.dll -l libmoldname90.a -k --as=/c/msys64/mingw32/bin/as.exe --as-flags=--32 - -/c/msys64/mingw32/bin/dlltool.exe -d ../moldname-msvcrt.def -U --dllname msvcr100.dll -l libmoldname100.a -k --as=/c/msys64/mingw32/bin/as.exe --as-flags=--32 - -cd ../mingw64 -/c/msys64/mingw64/bin/dlltool.exe -d ../moldname-msvcrt.def -U --dllname msvcr90.dll -l libmoldname90.a -k --as=/c/msys64/mingw64/bin/as.exe --as-flags=--64 - -/c/msys64/mingw64/bin/dlltool.exe -d ../moldname-msvcrt.def -U --dllname msvcr100.dll -l libmoldname100.a -k --as=/c/msys64/mingw64/bin/as.exe --as-flags=--64 - diff --git a/Windows/toolchain/moldname/mingw32/libmoldname100.a b/Windows/toolchain/moldname/mingw32/libmoldname100.a deleted file mode 100644 index 5de3713..0000000 Binary files a/Windows/toolchain/moldname/mingw32/libmoldname100.a and /dev/null differ diff --git a/Windows/toolchain/moldname/mingw32/libmoldname90.a b/Windows/toolchain/moldname/mingw32/libmoldname90.a deleted file mode 100644 index b1e0647..0000000 Binary files a/Windows/toolchain/moldname/mingw32/libmoldname90.a and /dev/null differ diff --git a/Windows/toolchain/moldname/mingw64/libmoldname100.a b/Windows/toolchain/moldname/mingw64/libmoldname100.a deleted file mode 100644 index f453a36..0000000 Binary files a/Windows/toolchain/moldname/mingw64/libmoldname100.a and /dev/null differ diff --git a/Windows/toolchain/moldname/mingw64/libmoldname90.a b/Windows/toolchain/moldname/mingw64/libmoldname90.a deleted file mode 100644 index 32f5992..0000000 Binary files a/Windows/toolchain/moldname/mingw64/libmoldname90.a and /dev/null differ diff --git a/Windows/toolchain/moldname/moldname-msvcrt.def b/Windows/toolchain/moldname/moldname-msvcrt.def deleted file mode 100644 index 6f31518..0000000 --- a/Windows/toolchain/moldname/moldname-msvcrt.def +++ /dev/null @@ -1,149 +0,0 @@ -; -; moldname-msvcrt.def -; -; Exports from the runtime except that these exports are actually preceeded -; by a underscore in the actual DLL. These correspond to functions which -; are non-ANSI and were prefixed with an underscore to avoid name space -; clutter. However many, in fact most programs still use a few of these -; functions without the underscore. This .def file is specially processed -; to make those non-underscored name function calls call the equivalent -; underscored functions. -; -; Contributors: -; Created by Colin Peters -; Maintained by Mumit Khan -; -; THIS SOFTWARE IS NOT COPYRIGHTED -; -; This source code is offered for use in the public domain. You may -; use, modify or distribute it freely. -; -; This code is distributed in the hope that it will be useful but -; WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY -; DISCLAMED. This includes but is not limited to warrenties of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -; -EXPORTS -access -chdir -chmod -chsize -close -creat -cwait - -daylight DATA - -dup -dup2 -ecvt -eof -execl -execle -execlp -execlpe -execv -execve -execvp -execvpe -fcvt -fdopen -fgetchar -fgetwchar -filelength -fileno -; Alias fpreset is set in CRT_fp10,c and CRT_fp8.c. -; fpreset -fputchar -fputwchar -;ftime -gcvt -getch -getche -getcwd -getpid -getw -heapwalk -isatty -itoa -kbhit -lfind -lsearch -lseek -ltoa -memccpy -memicmp -mkdir -mktemp -open -pclose -popen -putch -putenv -putw -read -rmdir -rmtmp -searchenv -setmode -sopen -spawnl -spawnle -spawnlp -spawnlpe -spawnv -spawnve -spawnvp -spawnvpe -strcmpi -strdup -stricmp -stricoll -strlwr -strnicmp -strnset -strrev -strset -strupr -swab -tell -tempnam - -timezone DATA - -; export tzname for both. See -tzname DATA -tzset -umask -ungetch -unlink -utime -wcsdup -wcsicmp -wcsicoll -wcslwr -wcsnicmp -wcsnset -wcsrev -wcsset -wcsupr - -wpopen - -write -; non-ANSI functions declared in math.h -j0 -j1 -jn -y0 -y1 -yn -chgsign -scalb -finite -fpclass -; C99 functions -;cabs -hypot -;logb -nextafter diff --git a/Windows/toolchain/specs100_32 b/Windows/toolchain/specs100_32 deleted file mode 100644 index 978ca66..0000000 --- a/Windows/toolchain/specs100_32 +++ /dev/null @@ -1,141 +0,0 @@ -*asm: -%{m32:--32} %{m64:--64} - -*asm_debug: -%{!g0:%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}} %{fdebug-prefix-map=*:--debug-prefix-map %*} - -*asm_final: -%{gsplit-dwarf: - objcopy --extract-dwo %{c:%{o*:%*}%{!o*:%b%O}}%{!c:%U%O} %{c:%{o*:%:replace-extension(%{o*:%*} .dwo)}%{!o*:%b.dwo}}%{!c:%b.dwo} - objcopy --strip-dwo %{c:%{o*:%*}%{!o*:%b%O}}%{!c:%U%O} } - -*asm_options: -%{-target-help:%:print-asm-header()} %{v} %{w:-W} %{I*} %{gz*:%e-gz is not supported in this configuration} %a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O} - -*invoke_as: -%{!fwpa*: %{fcompare-debug=*|fdump-final-insns=*:%:compare-debug-dump-opt()} %{!S:-o %|.s | - as %(asm_options) %m.s %A } } - -*cpp: -%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} %{municode:-DUNICODE} %{pthread:-D_REENTRANT} %{!no-pthread:-U_REENTRANT} -D__MSVCRT_VERSION__=0x01000 - -*cpp_options: -%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w} %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*} %{undef} %{save-temps*:-fpch-preprocess} - -*cpp_debug_options: -%{d*} - -*cpp_unique_options: -%{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %{I*&F*} %{P} %I %{MD:-MD %{!o:%b.d}%{o*:%.d%*}} %{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}} %{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*} %{!E:%{!M:%{!MM:%{!MT:%{!MQ:%{MD|MMD:%{o*:-MQ %*}}}}}}} %{remap} %{g3|ggdb3|gstabs3|gcoff3|gxcoff3|gvms3:-dD} %{!iplugindir*:%{fplugin*:%:find-plugindir()}} %{H} %C %{D*&U*&A*} %{i*} %Z %i %{E|M|MM:%W{o*}} - -*trad_capable_cpp: -cc1 -E %{traditional|traditional-cpp:-traditional-cpp} - -*cc1: -%(cc1_cpu) - -*cc1_options: -%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}} %{!iplugindir*:%{fplugin*:%:find-plugindir()}} %1 %{!Q:-quiet} %{!dumpbase:-dumpbase %B} %{d*} %{m*} %{aux-info*} %{fcompare-debug-second:%:compare-debug-auxbase-opt(%b)} %{!fcompare-debug-second:%{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}}%{!c:%{!S:-auxbase %b}} %{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi&trigraphs} %{v:-version} %{pg:-p} %{p} %{f*} %{undef} %{Qn:-fno-ident} %{Qy:} %{-help:--help} %{-target-help:--target-help} %{-version:--version} %{-help=*:--help=%*} %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}} %{fsyntax-only:-o %j} %{-param*} %{coverage:-fprofile-arcs -ftest-coverage} -mincoming-stack-boundary=2 - -*cc1plus: --mincoming-stack-boundary=2 -D__MSVCRT_VERSION__=0x01000 - -*link_gcc_c_sequence: -%G %L %G %{shared|mdll: msvcr100.dll.res%s} %{!shared: %{!mdll: msvcr100.exe.res%s}} - -*link_ssp: -%{fstack-protector|fstack-protector-all|fstack-protector-strong|fstack-protector-explicit:-lssp_nonshared -lssp} - -*endfile: -%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} %{!shared:%:if-exists(default-manifest.o%s)} %{fvtable-verify=none:%s; fvtable-verify=preinit:vtv_end.o%s; fvtable-verify=std:vtv_end.o%s} crtend.o%s - -*link: -%{m64:-m i386pep} %{!m64:-m i386pe} %{mwindows:--subsystem windows} %{mconsole:--subsystem console} %{shared: %{mdll: %eshared and mdll are not compatible}} %{shared: --shared} %{mdll:--dll} %{static:-Bstatic} %{!static:-Bdynamic} %{shared|mdll: %{m64:-e DllMainCRTStartup} %{!m64:-e _DllMainCRTStartup@12} --enable-auto-image-base} %(shared_libgcc_undefs) - -*lib: -%{pg:-lgmon} %{pthread:-lpthread} %{!no-pthread: } %{mwindows:-lgdi32 -lcomdlg32} %{fvtable-verify=preinit:-lvtv -lpsapi; fvtable-verify=std:-lvtv -lpsapi} -ladvapi32 -lshell32 -luser32 -lkernel32 -liconv - -*link_gomp: - - -*libgcc: -%{mthreads:-lmingwthrd} -lmingw32 -lgcc -lmoldname100 -lmingwex -lmsvcr100 - -*startfile: -%{shared|mdll:dllcrt2%O%s} %{!shared:%{!mdll:%{!municode:crt2%O%s}}} %{!shared:%{!mdll:%{municode:crt2u%O%s}}} %{pg:gcrt2%O%s} crtbegin.o%s %{fvtable-verify=none:%s; fvtable-verify=preinit:vtv_start.o%s; fvtable-verify=std:vtv_start.o%s} - -*cross_compile: -0 - -*version: -6.3.0 - -*multilib: -. !m64 !m32;.:../lib64 m64 !m32;.:../lib !m64 m32; - -*multilib_defaults: -m32 - -*multilib_extra: - - -*multilib_matches: -m64 m64;m32 m32; - -*multilib_exclusions: - - -*multilib_options: -m64/m32 - -*multilib_reuse: - - -*linker: -collect2 - -*linker_plugin_file: - - -*lto_wrapper: - - -*lto_gcc: - - -*link_libgcc: -%D - -*md_exec_prefix: - - -*md_startfile_prefix: - - -*md_startfile_prefix_1: - - -*startfile_prefix_spec: - - -*sysroot_spec: ---sysroot=%R - -*sysroot_suffix_spec: - - -*sysroot_hdrs_suffix_spec: - - -*self_spec: - - -*cc1_cpu: -%{march=native:%>march=native %:local_cpu_detect(arch) %{!mtune=*:%>mtune=native %:local_cpu_detect(tune)}} %{mtune=native:%>mtune=native %:local_cpu_detect(tune)} - -*shared_libgcc_undefs: - - -*link_command: -%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S: %(linker) %{!fno-use-linker-plugin:%{!fno-lto: -plugin %(linker_plugin_file) -plugin-opt=%(lto_wrapper) -plugin-opt=-fresolution=%u.res %{!nostdlib:%{!nodefaultlibs:%:pass-through-libs(%(link_gcc_c_sequence))}} }}%{flto|flto=*:%march=native %:local_cpu_detect(arch) %{!mtune=*:%>mtune=native %:local_cpu_detect(tune)}} %{mtune=native:%>mtune=native %:local_cpu_detect(tune)} - -*shared_libgcc_undefs: - - -*link_command: -%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S: %(linker) %{!fno-use-linker-plugin:%{!fno-lto: -plugin %(linker_plugin_file) -plugin-opt=%(lto_wrapper) -plugin-opt=-fresolution=%u.res %{!nostdlib:%{!nodefaultlibs:%:pass-through-libs(%(link_gcc_c_sequence))}} }}%{flto|flto=*:%march=native %:local_cpu_detect(arch) %{!mtune=*:%>mtune=native %:local_cpu_detect(tune)}} %{mtune=native:%>mtune=native %:local_cpu_detect(tune)} - -*shared_libgcc_undefs: - - -*link_command: -%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S: %(linker) %{!fno-use-linker-plugin:%{!fno-lto: -plugin %(linker_plugin_file) -plugin-opt=%(lto_wrapper) -plugin-opt=-fresolution=%u.res %{!nostdlib:%{!nodefaultlibs:%:pass-through-libs(%(link_gcc_c_sequence))}} }}%{flto|flto=*:%march=native %:local_cpu_detect(arch) %{!mtune=*:%>mtune=native %:local_cpu_detect(tune)}} %{mtune=native:%>mtune=native %:local_cpu_detect(tune)} - -*shared_libgcc_undefs: - - -*link_command: -%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S: %(linker) %{!fno-use-linker-plugin:%{!fno-lto: -plugin %(linker_plugin_file) -plugin-opt=%(lto_wrapper) -plugin-opt=-fresolution=%u.res %{!nostdlib:%{!nodefaultlibs:%:pass-through-libs(%(link_gcc_c_sequence))}} }}%{flto|flto=*:%]') - sys.exit() - - config = ConfigParser() - section = sys.argv[1] - if os.path.exists('appveyor.cfg'): - config.read('appveyor.cfg') - else: - print('appveyor.cfg not found - creating ...') - config.add_section(section) - config.set(section, 'project', input('Project name: ')) - config.set(section, 'username', input('Username: ')) - config.set(section, 'token', input('Api token: ')) - with open('appveyor.cfg', 'wb') as output: - config.write(output) - - A = AppveyorREST(config.get(section, 'project'), - config.get(section, 'username'), - config.get(section, 'token')) - - skip = False - for n, command in enumerate(sys.argv[2:]): - if skip: - skip = False - continue - if command == 'build': - A.run_build() - elif command == 'clear': - A.clear_cache() - elif command == 'download': - try: - dir = sys.argv[n+2] - except IndexError: - print('Please supply a download directory.') - sys.exit() - A.download(dir) - skip = True - else: - print('unknown command {cmd}'.format(cmd=command)) - sys.exit() - -if __name__ == '__main__': - main() diff --git a/build_pari.sh b/build_pari.sh index 3278f20..e845f3e 100644 --- a/build_pari.sh +++ b/build_pari.sh @@ -1,33 +1,11 @@ -#! /bin/bash - # On macOS this builds both arm and x86_64 PARI librariies for OS X >= -# 10.9. On Windows it uses the clang32 or ucrt64 toolchains, -# depending on the MSys2 environment. On linux the default system gcc -# is used to build for the host architecture. There are two required -# arguments, to specify word sizes for gmp and pari. For macOS these -# arguments should be pari and gmp. +# 10.9. On Windows it uses the ucrt64 toolchain in Msys2. On linux +# the default system gcc is used to build for the host architecture. set -e -if [ $# != 2 ]; then - usage=failed; -fi -if [ "$1" != "pari32" ] && [ "$1" != "pari64" ] && [ "$1" != "pari" ]; then - usage=failed; -fi -if [ "$2" != "gmp32" ] && [ "$2" != "gmp64" ] && [ "$2" != "gmp" ]; then - usage=failed; -fi -if [ "$usage" = "failed" ]; then - echo "usage: build_pari.sh pari32|pari64|pari gmp32|gmp64|gmp" - echo "For macOS use pari and gmp as arguments to build universal binaries." - exit -fi - -#PARIURL=https://pari.math.u-bordeaux.fr/pub/pari/OLD/2.11/ -#PARIVERSION=pari-2.11.4 PARIURL=http://pari.math.u-bordeaux.fr/pub/pari/unix/ -PARIVERSION=pari-2.15.2 +PARIVERSION=pari-2.15.4 GMPURL=https://ftp.gnu.org/gnu/gmp/ GMPVERSION=gmp-6.2.1 @@ -39,13 +17,13 @@ if [[ $(pwd) =~ " " ]]; then exit 1 fi -PARIPREFIX=$(pwd)/libcache/$1 -PARILIBDIR=$(pwd)/libcache/$1/lib -GMPPREFIX=$(pwd)/libcache/$2 +PARIPREFIX=$(pwd)/libcache/pari +PARILIBDIR=$(pwd)/libcache/pari/lib +GMPPREFIX=$(pwd)/libcache/gmp echo Building gmp ... -if [ "$2" != "nogmp" ] && [ ! -e ${GMPPREFIX} ] ; then +if [ ! -e ${GMPPREFIX} ] ; then if [ ! -e ${GMPVERSION}.tar.bz2 ] ; then echo "Downloading GMP source archive ..." ; curl -O ${GMPURL}${GMPVERSION}.tar.bz2 ; @@ -84,34 +62,23 @@ if [ "$2" != "nogmp" ] && [ ! -e ${GMPPREFIX} ] ; then make distclean cd ../../libcache mkdir -p gmp/lib - mv $2/arm/{include,share} gmp - lipo -create $2/arm/lib/libgmp.10.dylib $2/intel/lib/libgmp.10.dylib -output gmp/lib/libgmp.dylib - lipo -create $2/arm/lib/libgmp.a $2/intel/lib/libgmp.a -output gmp/lib/libgmp.a + mv gmp/arm/{include,share} gmp + lipo -create gmp/arm/lib/libgmp.10.dylib gmp/intel/lib/libgmp.10.dylib -output gmp/lib/libgmp.dylib + lipo -create gmp/arm/lib/libgmp.a gmp/intel/lib/libgmp.a -output gmp/lib/libgmp.a cd .. else if [ `python -c "import sys; print(sys.platform)"` = 'win32' ] ; then # Windows - if [ "$2" = "gmp32" ] ; then - export MSYSTEM=MINGW32 - export ABI=32 - BUILD=i686-w32-mingw32 - else - export MSYSTEM=MINGW64 - export ABI=64 - BUILD=x86_64-pc-mingw64 - fi + export PATH=/c/msys64/ucrt64/bin:$PATH + export MSYSTEM=UCRT64 + export CC=/c/msys64/ucrt64/bin/gcc + export ABI=64 + BUILD=x86_64-pc-mingw64 else # linux - if [ "$2" = "gmp32" ] ; then - export ABI=32 - BUILD=i686-none-none - else - export ABI=64 - BUILD=x86_64-none-none - fi + export ABI=64 + BUILD=x86_64-none-none fi - echo compiler is `which gcc` - echo linker is `which ld` echo Configuring gmp with ./configure --build=${BUILD} --prefix=${GMPPREFIX} --with-pic ./configure --build=${BUILD} --prefix=${GMPPREFIX} --with-pic make install @@ -134,12 +101,8 @@ if [ ! -d "build/pari_src" ] ; then tar xzf ../${PARIVERSION}.tar.gz mv ${PARIVERSION} pari_src cd pari_src - # Add a guard against multiple includes of paristio.h and fix uispsp. - patch -p0 < ../../patches/pari_2.15.patch else cd build/pari_src - # Add a guard against multiple includes of paristio.h and fix uispsp. - patch -p0 < ../../patches/pari_2.15.patch fi export DESTDIR= @@ -155,48 +118,17 @@ if [ $(uname) = "Darwin" ] ; then make clean elif [ `python -c "import sys; print(sys.platform)"` = 'win32' ] ; then #Windows - # Get rid of win32_set_pdf_viewer so it won't break linking with MSVC. - patch -N -p0 < ../../Windows/mingw_c.patch || true - # When we build the pari library for linking with Visual C 2014 - # the Pari configure script has trouble linking some of the little - # C programs which verify that we have provided the correct gmp - # configuration in the options to Configure. Also, the msys2 - # uname produces something Pari does not recognize. Since we are - # not lying about our gmpntf configuration we just patch get_gmp - # and arch-osname to give the right answers. - patch -N -p0 < ../../Windows/pari_config.patch - if [ "$2" = "gmp32" ] ; then - export MSYSTEM=CLANG32 - else - export MSYSTEM=MINGW64 - fi - # The dlltool that is provided by clang32 does not accept the - # --version option. This confuses Pari's config tools. So we let - # Pari use the dlltool in the mingw32 toolchain. - if [ "$1" == "pari32" ]; then - export DLLTOOL="/c/msys64/mingw32/bin/dlltool" - fi + export PATH=/c/msys64/ucrt64/bin:$PATH + export MSYSTEM=UCRT64 + export CC=/c/msys64/ucrt64/bin/gcc # Disable avx and sse2. - if [ "$1" == "pari64" ]; then - export CFLAGS="-UHAS_AVX -UHAS_AVX512 -UHAS_SSE2" - fi + export CFLAGS="-U HAS_AVX -U HAS_AVX512 -U HAS_SSE2" ./Configure --prefix=${PARIPREFIX} --libdir=${PARILIBDIR} --without-readline --with-gmp=${GMPPREFIX} cd Omingw-* - # When building for x86 with clang32, the Makefile uses the -rpath option - # which is not recognized by the clang32 linker, and causes an error. - if [ "$1" == "pari32" ]; then - sed -i s/$\(RUNPTH\)//g Makefile - sed -i s/$\(RUNPTH_FINAL\)//g Makefile - fi make install-lib-sta make install-include make install-doc make install-cfg - # Also the clang32 linker does not require the .def file, and just gets - # confused by it. - if [ "$1" == "pari32" ]; then - cat /dev/null > libpari_exe.def - fi make install-bin-sta else # linux diff --git a/cypari/pylong_support.h b/cypari/pylong_support.h index 367984f..fcb5078 100644 --- a/cypari/pylong_support.h +++ b/cypari/pylong_support.h @@ -42,6 +42,15 @@ * See longintrepr.h for more details. */ +#if PY_MINOR_VERSION < 9 + +static inline void _Py_SET_SIZE(PyVarObject *ob, Py_ssize_t size) { + ob->ob_size = size; +} +#define Py_SET_SIZE(ob, size) _Py_SET_SIZE(_PyVarObject_CAST(ob), size) + +#endif + typedef struct _longobject* py_long; inline Py_ssize_t CyPari_Sign(PyObject *op) { diff --git a/patches/pari_2.15.patch b/patches/pari_2.15.patch deleted file mode 100644 index bc536ec..0000000 --- a/patches/pari_2.15.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -r -uu orig_src/basemath/prime.c src/basemath/prime.c ---- orig_src/basemath/prime.c 2022-09-19 10:42:30 -+++ src/basemath/prime.c 2023-03-05 16:16:19 -@@ -125,7 +125,7 @@ - e = vals(t); - c = Fl_powu(a, t >> e, n); - if (c == 1 || c == t) return 1; -- while (--e) -+ while (--e > 0) - { /* go fishing for -1, not for 1 (e - 1 squaring) */ - c = Fl_sqr(c, n); - if (c == t) return 1; diff --git a/setup.py b/setup.py index 9114c16..9ba13a5 100644 --- a/setup.py +++ b/setup.py @@ -15,11 +15,21 @@ sudo python -m pip install "cython>=0.28" """ - -import os, sys, re, sysconfig, subprocess, shutil, site, platform, time -if sys.version_info.major == 2: - print("Python 2 is not supported") +import sys +if sys.version_info < (3,5): + print("Python 3.6 or higher is required") sys.exit() +if not sys.maxsize > 2**32: + raise RuntimeError('32 bit systems are no longer supported.') + +import os +import re +import sysconfig +import subprocess +import shutil +import site +import platform +import time from glob import glob from setuptools import setup, Command from distutils.extension import Extension @@ -28,54 +38,24 @@ from distutils.util import get_platform from subprocess import Popen, PIPE -cpu_width = '64bit' if sys.maxsize > 2**32 else '32bit' - if sys.platform == 'win32': - compiler_set = False + # We expect to be using: + # * Windows Visual Studio 2022 with the Universal C Runtime and the + # Windows 11 SDK 10.0.22000.0 installed. + # * An Msys-2 with the UCRT64 environment installed for gcc 13.2.0 + ext_compiler = 'msvc' - for n, arg in enumerate(sys.argv): - if arg == '-c': - ext_compiler = sys.argv[n+1] - compiler_set = True - break - elif arg.startswith('-c'): - ext_compiler = arg[2:] - compiler_set = True - break - elif arg.startswith('--compiler'): - ext_compiler = arg.split('=')[1] - compiler_set = True - break - if not compiler_set and 'build' in sys.argv: - sys.argv.append('--compiler=msvc') - try: - # To customize your msvc environment create msvc_env.py - # and define the dict dev_env to be a copy of the os.environ - # that you have when you run python in the Command Prompt for - # your installation of Visual Studio. - from msvc_env import dev_env - os.environ.update(dev_env) - MSVC_extra_objects = [] - except: - # This creates a default environment which works on our CI runner - if cpu_width == '64bit': - MSVC_extra_objects = [ - r'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x64\Uuid.lib', - r'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x64\kernel32.lib', - r'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\ucrt\x64\ucrt.lib', - ] - else: - MSVC_extra_objects = [ - r'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x86\Uuid.lib', - r'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x86\kernel32.lib', - r'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\ucrt\x86\ucrt.lib', - os.path.abspath(os.path.join('Windows', 'gcc', 'libgcc.a')), - ] + MSVC_extra_objects = [ + r'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x64\Uuid.lib', + r'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x64\kernel32.lib', + r'C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\ucrt\x64\ucrt.lib', + r'C:\msys64\ucrt64\lib\gcc\x86_64-w64-mingw32\13.2.0\libgcc.a' + ] else: ext_compiler = '' # Path setup for building with the mingw C compiler on Windows. -if sys.platform == 'win32' and not os.path.exists('libcache/pari64'): +if sys.platform == 'win32' and not os.path.exists('libcache/pari'): # We always build the Pari library with mingw, no matter which compiler # is used for the CyPari extension. # Make sure that our C compiler matches our python and that we can run bash @@ -83,50 +63,13 @@ bash_proc = Popen(['bash', '-c', 'echo $PATH'], stdout=PIPE, stderr=PIPE) BASHPATH, _ = bash_proc.communicate() BASHPATH = BASHPATH.decode('utf8') - if sys.version_info >= (3,5): - if cpu_width == '64bit': - TOOLCHAIN_W = r'C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64' - TOOLCHAIN_U = '/c/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64' - else: - TOOLCHAIN_W = r'C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32' - TOOLCHAIN_U = '/c/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32' - else: - if cpu_width == '64bit': - TOOLCHAIN_W = r'C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64' - TOOLCHAIN_U = '/c/mingw-w64/x86_64-6.3.0-posix-seh-rt_v5-rev1/mingw64' - else: - TOOLCHAIN_W = r'C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32' - TOOLCHAIN_U = '/c/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32' - - WINPATH=r'%s\bin;C:\msys64\usr\local\bin;C:\msys64\usr\bin;'%TOOLCHAIN_W - BASHPATH='%s/bin:/c/msys64/usr/bin:'%TOOLCHAIN_U + BASHPATH - os.environ['PATH'] = ';'.join([WINPATH, os.environ['PATH']]) BASH = r'C:\msys64\usr\bin\bash' else: BASHPATH = os.environ['PATH'] BASH = '/bin/bash' -# We build the 32 bit and 64 bit versions of the Pari library in separate -# directories, but in macOS we use lipo to combine them into a fat library. -# On Windows we also build separately for the Universal CRT on Python >= 3.5 -if sys.platform == 'darwin': - PARIDIR = 'pari' - GMPDIR = 'gmp' -elif sys.platform == 'win32': - if cpu_width == '64bit': - PARIDIR = 'pari64' - GMPDIR = 'gmp64' - else: - PARIDIR = 'pari32' - GMPDIR = 'gmp32' -else: - if cpu_width == '64bit': - GMPDIR = 'gmp64' - PARIDIR = 'pari64' - else: - GMPDIR = 'gmp32' - PARIDIR = 'pari32' - +PARIDIR = 'pari' +GMPDIR = 'gmp' pari_include_dir = os.path.join('libcache', PARIDIR, 'include') pari_library_dir = os.path.join('libcache', PARIDIR, 'lib') pari_static_library = os.path.join(pari_library_dir, 'libpari.a') @@ -283,12 +226,9 @@ def run(self): or not os.path.exists(os.path.join('libcache', GMPDIR))): if sys.platform == 'win32': # This is meant to work even in a Windows Command Prompt - if cpu_width == 64: - cmd = r'export PATH="%s" ; export MSYSTEM=MINGW64 ; bash build_pari.sh %s %s'%(BASHPATH, PARIDIR, GMPDIR) - else: - cmd = r'export PATH="%s" ; export MSYSTEM=MINGW32 ; bash build_pari.sh %s %s'%(BASHPATH, PARIDIR, GMPDIR) + cmd = r'export PATH="%s" ; export MSYSTEM=UCRT64 ; bash build_pari.sh'%BASHPATH else: - cmd = r'export PATH="%s" ; bash build_pari.sh %s %s'%(BASHPATH, PARIDIR, GMPDIR) + cmd = r'export PATH="%s" ; bash build_pari.sh'%BASHPATH if subprocess.call([BASH, '-c', cmd]): sys.exit("***Failed to build PARI library***") @@ -309,7 +249,7 @@ def run(self): # #define long long long thereby breaking lots of stuff in the # Python headers. long_include = os.path.join('cypari', 'pari_long.pxi') - if sys.platform == 'win32' and cpu_width == '64bit': + if sys.platform == 'win32': if sys.version_info.major == 2: include_file = os.path.join('cypari', 'long_win64py2.pxi') else: @@ -365,45 +305,23 @@ def run(self): if sys.platform == 'darwin': compile_args=['-mmacosx-version-min=10.9', '-Wno-unreachable-code', '-Wno-unreachable-code-fallthrough'] -else: - compile_args = [] -if ext_compiler == 'mingw32': - major, minor = sys.version_info.major, sys.version_info.minor - if major == 3: - if minor == 4: - link_args = [r'C:\Windows\System32\Python34.dll'] - link_args += ['-specs=specs100'] - else: - link_args = ['-specs=specs90'] - link_args += ['-Wl,--subsystem,windows'] - compile_args += ['-D__USE_MINGW_ANSI_STDIO', - '-Dprintf=__MINGW_PRINTF_FORMAT'] - if cpu_width == '64bit': - compile_args.append('-DMS_WIN64') -elif ext_compiler == 'msvc': +elif sys.platform == 'win32': # Ignore the assembly language inlines when building the extension. - compile_args += ['/DDISABLE_INLINE'] + compile_args = ['/DDISABLE_INLINE'] if False: # Toggle for debugging symbols compile_args += ['/Zi'] link_args += ['/DEBUG'] - # Add the mingw crt objects needed by libpari. - if cpu_width == '64bit': - link_args += [os.path.join('Windows', 'crt', 'libparicrt64.a'), - 'advapi32.lib'] - if sys.version_info >= (3, 5): - link_args += [ - 'legacy_stdio_definitions.lib', - os.path.join('Windows', 'crt', 'get_output_format64.o')] - else: - link_args += [os.path.join('Windows', 'crt', 'libparicrt32.a'), - 'advapi32.lib'] - if sys.version_info >= (3, 5): - link_args += [ - 'legacy_stdio_definitions.lib', 'advapi32.lib', - os.path.join('Windows', 'crt', 'get_output_format32.o')] + # # Add the mingw crt objects needed by libpari. + link_args += [ + os.path.join('Windows', 'crt', 'libparicrt64.a'), + 'advapi32.lib', + 'legacy_stdio_definitions.lib', + os.path.join('Windows', 'crt', 'get_output_format64.o') + ] +else: + compile_args = [] link_args += [pari_static_library, gmp_static_library] - if sys.platform.startswith('linux'): link_args += ['-Wl,-Bsymbolic-functions', '-Wl,-Bsymbolic']