8000 Apply patches to build for ARM64 · python/cpython-source-deps@e3b5ea1 · GitHub
[go: up one dir, main page]

Skip to content

Commit e3b5ea1

Browse files
committed
Apply patches to build for ARM64
1 parent c6710de commit e3b5ea1

File tree

5 files changed

+47
-8
lines changed

5 files changed

+47
-8
lines changed

win/configure

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3831,10 +3831,15 @@ echo "$as_me: error: ${CC} does not support the -shared option.
38313831
echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5
38323832
echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
38333833
;;
3834+
arm64)
3835+
MACHINE="ARM64"
3836+
echo "$as_me:$LINENO: result: Using ARM64 $MACHINE mode" >&5
3837+
echo "${ECHO_T} Using ARM64 $MACHINE mode" >&6
3838+
;;
38343839
ia64)
38353840
MACHINE="IA64"
3836-
echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5
3837-
echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
3841+
echo "$as_me:$LINENO: result: Using IA64 $MACHINE mode" >&5
3842+
echo "${ECHO_T} Using IA64 $MACHINE mode" >&6
38383843
;;
38393844
*)
38403845
cat >conftest.$ac_ext <<_ACEOF
@@ -3931,6 +3936,9 @@ echo "${ECHO_T}using shared flags" >&6
39313936
amd64|x64|yes)
39323937
MACHINE="AMD64" ; # assume AMD64 as default 64-bit build
39333938
;;
3939+
arm64)
3940+
MACHINE="ARM64"
3941+
;;
39343942
ia64)
39353943
MACHINE="IA64"
39363944
;;

win/rules-ext.vc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ macro to the name of the project makefile.
3131
# We extract version numbers using the nmakehlp program. For now use
3232
# the local copy of nmakehlp. Once we locate Tcl, we will use that
3333
# one if it is newer.
34-
!if [$(CC) -nologo -DNDEBUG "nmakehlp.c" -link -subsystem:console > nul]
34+
!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)"
35+
!if [$(cc32) -nologo "$(NMAKEHLPC)" -link -subsystem:console > nul]
36+
!endif
37+
!else
38+
!if [copy x86_64-w64-mingw32-nmakehlp.exe nmakehlp.exe >NUL]
39+
!endif
3540
!endif
3641

3742
# First locate the Tcl directory that we are working with.

win/rules.vc

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ _RULES_VC = 1
2424
# For modifications that are not backward-compatible, you *must* change
2525
# the major version.
2626
RULES_VERSION_MAJOR = 1
27-
RULES_VERSION_MINOR = 9
27+
RULES_VERSION_MINOR = 10
2828

2929
# The PROJECT macro must be defined by parent makefile.
3030
!if "$(PROJECT)" == ""
@@ -411,8 +411,8 @@ _INSTALLDIR=$(_INSTALLDIR)\lib
411411
# compiler version 1200. This is kept only for legacy reasons as it
412412
# does not make sense for recent Microsoft compilers. Only used for
413413
# output directory names.
414-
# ARCH - set to IX86 or AMD64 depending on 32- or 64-bit target
415-
# NATIVE_ARCH - set to IX86 or AMD64 for the host machine
414+
# ARCH - set to IX86, ARM64 or AMD64 depending on 32- or 64-bit target
415+
# NATIVE_ARCH - set to IX86, ARM64 or AMD64 for the host machine
416416
# MACHINE - same as $(ARCH) - legacy
417417
# _VC_MANIFEST_EMBED_{DLL,EXE} - commands for embedding a manifest if needed
418418

@@ -435,6 +435,8 @@ VCVER=0
435435
&& ![echo ARCH=IX86 >> vercl.x] \
436436
&& ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \
437437
&& ![echo ARCH=AMD64 >> vercl.x] \
438+
&& ![echo $(_HASH)elif defined(_M_ARM64) >> vercl.x] \
439+
&& ![echo ARCH=ARM64 >> vercl.x] \
438440
&& ![echo $(_HASH)endif >> vercl.x] \
439441
&& ![$(cc32) -nologo -TC -P vercl.x 2>NUL]
440442
!include vercl.i
@@ -459,6 +461,9 @@ VCVER = $(VCVERSION)
459461
!if "$(MACHINE)" == "x86"
460462
!undef MACHINE
461463
MACHINE = IX86
464+
!elseif "$(MACHINE)" == "arm64"
465+
!undef MACHINE
466+
MACHINE = ARM64
462467
!elseif "$(MACHINE)" == "x64"
463468
!undef MACHINE
464469
MACHINE = AMD64
@@ -475,6 +480,8 @@ MACHINE=$(ARCH)
475480
# the Tcl platform::identify command
476481
!if "$(MACHINE)" == "AMD64"
477482
PLATFORM_IDENTIFY = win32-x86_64
483+
!elseif "$(MACHINE)" == "ARM64"
484+
PLATFORM_IDENTIFY = win32-arm
478485
!else
479486
PLATFORM_IDENTIFY = win32-ix86
480487
!endif
@@ -490,6 +497,8 @@ MULTIPLATFORM_INSTALL = 0
490497

491498
!if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86]
492499
NATIVE_ARCH=IX86
500+
!elseif ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i ARM | findstr /i 64-bit]
501+
NATIVE_ARCH=ARM64
493502
!else
494503
NATIVE_ARCH=AMD64
495504
!endif
@@ -541,8 +550,13 @@ NMAKEHLPC = $(_TCLDIR)\win\nmakehlp.c
541550

542551
# We always build nmakehlp even if it exists since we do not know
543552
# what source it was built from.
553+
!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)"
544554
!if [$(cc32) -nologo "$(NMAKEHLPC)" -link -subsystem:console > nul]
545555
!endif
556+
!else
557+
!if [copy x86_64-w64-mingw32-nmakehlp.exe nmakehlp.exe >NUL]
558+
!endif
559+
!endif
546560

547561
################################################################
548562
# 5. Test for compiler features
@@ -1344,7 +1358,7 @@ INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\..\include
13441358
# baselibs - minimum Windows libraries required. Parent makefile can
13451359
# define PRJ_LIBS before including rules.rc if additional libs are needed
13461360

1347-
OPTDEFINES = /DSTDC_HEADERS
1361+
OPTDEFINES = /DSTDC_HEADERS /DUSE_NMAKE=1
13481362
!if $(VCVERSION) > 1600
13491363
OPTDEFINES = $(OPTDEFINES) /DHAVE_STDINT_H=1
13501364
!else
@@ -1476,6 +1490,11 @@ carch = /D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
14761490
carch =
14771491
!endif
14781492

1493+
# cpuid is only available on intel machines
1494+
!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "AMD64"
1495+
carch = $(carch) /DHAVE_CPUID=1
1496+
!endif
1497+
14791498
!if $(DEBUG)
14801499
# Turn warnings into errors
14811500
cwarn = $(cwarn) -WX

win/tcl.m4

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,9 +770,13 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
770770
MACHINE="AMD64" ; # assume AMD64 as default 64-bit build
771771
AC_MSG_RESULT([ Using 64-bit $MACHINE mode])
772772
;;
773+
arm64)
774+
MACHINE="ARM64"
775+
AC_MSG_RESULT([ Using ARM64 $MACHINE mode])
776+
;;
773777
ia64)
774778
MACHINE="IA64"
775-
AC_MSG_RESULT([ Using 64-bit $MACHINE mode])
779+
AC_MSG_RESULT([ Using IA64 $MACHINE mode])
776780
;;
777781
*)
778782
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@@ -824,6 +828,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
824828
amd64|x64|yes)
825829
MACHINE="AMD64" ; # assume AMD64 as default 64-bit build
826830
;;
831+
arm64)
832+
MACHINE="ARM64"
833+
;;
827834
ia64)
828835
MACHINE="IA64"
829836
;;

win/x86_64-w64-mingw32-nmakehlp.exe

25 KB
Binary file not shown.

0 commit comments

Comments
 (0)
0