Skip to content

Commit

Permalink
Add a USE_64_BIT_INT build option to the Windows makefiles.
Browse files Browse the repository at this point in the history
Rather than adding more canned configurations, we dynamically set values
which differ from the standard 32-bit build options, and actually remove
the canned configurations for 64-bit builds too and do likewise for them.

The ~ARCHPREFIX~ games used by the outgoing .gc64 configuration needed
bringing into the remaining .gc configuration to maintain support for the
GCCCROSS build option.

Two tweaks to sv.c were required for the USE_64_BIT_INT option to work
with a VC++ build, allowing the I64 printf size specification. The GCC
build worked anyway since it uses ll rather than I64.

The motivation for this change came from a patch submitted by Sisyphus
<sisyphus1@optusnet.com.au>:
Message-ID: <6AC52DD00C96415A9E919A02F12DD05F@desktop2>
  • Loading branch information
steve-m-hay committed Aug 1, 2012
1 parent 9fa1f09 commit 1f64ae1
Show file tree
Hide file tree
Showing 11 changed files with 278 additions and 11,638 deletions.
4 changes: 0 additions & 4 deletions MANIFEST
Expand Up @@ -5589,16 +5589,12 @@ win32/ce-helpers/makedist.pl WinCE port
win32/ce-helpers/registry.bat WinCE port
win32/config.ce WinCE port
win32/config.gc Win32 base line config.sh (MinGW build)
win32/config.gc64 Win64 base line config.sh (MinGW build)
win32/config_H.ce WinCE port
win32/config_H.gc Win32 config header (MinGW build)
win32/config_H.gc64 Win64 config header (MinGW build)
win32/config_h.PL Perl code to convert Win32 config.sh to config.h
win32/config_H.vc Win32 config header (Visual C++ build)
win32/config_H.vc64 Win64 config header (Visual C++ build)
win32/config_sh.PL Perl code to update Win32 config.sh from Makefile
win32/config.vc Win32 base line config.sh (Visual C++ build)
win32/config.vc64 Win64 base line config.sh (Visual C++ build)
win32/create_perllibst_h.pl creates perllibst.h file for inclusion from perllib.c
win32/distclean.bat Remove _ALL_ files not listed here in MANIFEST
win32/fcrypt.c crypt() implementation
Expand Down
2 changes: 0 additions & 2 deletions Porting/checkcfgvar.pl
Expand Up @@ -53,9 +53,7 @@ sub usage
"uconfig64.sh",
"plan9/config_sh.sample",
"win32/config.gc",
"win32/config.gc64",
"win32/config.vc",
"win32/config.vc64",
"win32/config.ce",
"configure.com",
"Porting/config.sh",
Expand Down
4 changes: 2 additions & 2 deletions sv.c
Expand Up @@ -10406,7 +10406,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p
switch (*q) {
#ifdef WIN32
case 'I': /* Ix, I32x, and I64x */
# ifdef WIN64
# ifdef USE_64_BIT_INT
if (q[1] == '6' && q[2] == '4') {
q += 3;
intsize = 'q';
Expand All @@ -10417,7 +10417,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p
q += 3;
break;
}
# ifdef WIN64
# ifdef USE_64_BIT_INT
intsize = 'q';
# endif
q++;
Expand Down
109 changes: 98 additions & 11 deletions win32/Makefile
Expand Up @@ -92,6 +92,12 @@ USE_PERLIO = define
# with an older release of perl.
USE_LARGE_FILES = define

#
# Uncomment this if you're building a 32-bit perl and want 64-bit integers.
# (If you're building a 64-bit perl then you will have 64-bit integers whether
# or not this is uncommented.)
#USE_64_BIT_INT = define

#
# uncomment exactly one of the following
#
Expand Down Expand Up @@ -261,6 +267,10 @@ USE_PERLIO = undef
USE_LARGE_FILES = undef
!ENDIF

!IF "$(USE_64_BIT_INT)" == ""
USE_64_BIT_INT = undef
!ENDIF

!IF "$(USE_IMP_SYS)$(USE_MULTI)" == "defineundef"
USE_MULTI = define
!ENDIF
Expand Down Expand Up @@ -301,6 +311,10 @@ WIN64 = undef
!ENDIF
!ENDIF

!IF "$(WIN64)" == "define"
USE_64_BIT_INT = define
!ENDIF

# Treat 64-bit MSVC60 (doesn't really exist) as SDK2003SP1 because
# both link against MSVCRT.dll (which is part of Windows itself) and
# not against a compiler specific versioned runtime.
Expand Down Expand Up @@ -334,6 +348,12 @@ BUILDOPT = $(BUILDOPT) -DUSE_PERLIO
ARCHNAME = $(ARCHNAME)-thread
!ENDIF

!IF "$(WIN64)" != "define"
!IF "$(USE_64_BIT_INT)" == "define"
ARCHNAME = $(ARCHNAME)-64int
!ENDIF
!ENDIF

# Visual C++ 98, .NET 2003, 2005/2008/2010 specific.
# VC++ 6/7/8/9/10.x can load DLLs on demand. Makes the test suite run
# in about 10% less time. (The free version of 7.x can't do this, but the free
Expand Down Expand Up @@ -603,13 +623,8 @@ UTILS = \
MAKE = nmake -nologo
MAKE_BARE = nmake

!IF "$(WIN64)" == "define"
CFGSH_TMPL = config.vc64
CFGH_TMPL = config_H.vc64
!ELSE
CFGSH_TMPL = config.vc
CFGH_TMPL = config_H.vc
!ENDIF

XCOPY = xcopy /f /r /i /d /y
RCOPY = xcopy /f /r /i /e /d /y
Expand Down Expand Up @@ -788,10 +803,12 @@ CFG_VARS = \
"useithreads=$(USE_ITHREADS)" \
"usemultiplicity=$(USE_MULTI)" \
"useperlio=$(USE_PERLIO)" \
"use64bitint=$(USE_64_BIT_INT)" \
"uselargefiles=$(USE_LARGE_FILES)" \
"usesitecustomize=$(USE_SITECUST)" \
"LINK_FLAGS=$(LINK_FLAGS:"=\")" \
"optimize=$(OPTIMIZE:"=\")"
"optimize=$(OPTIMIZE:"=\")" \
"WIN64=$(WIN64)"

ICWD = -I..\dist\Cwd -I..\dist\Cwd\lib

Expand Down Expand Up @@ -827,9 +844,82 @@ perlglob$(o) : perlglob.c
config.w32 : $(CFGSH_TMPL)
copy $(CFGSH_TMPL) config.w32

#
# Copy the template config.h and set configurables at the end of it
# as per the options chosen and compiler used.
# Note: This config.h is only used to build miniperl.exe anyway, but
# it's as well to have its options correct to be sure that it builds
# and so that it's "-V" options are correct for use by makedef.pl. The
# real config.h used to build perl.exe is generated from the top-level
# config_h.SH by config_h.PL (run by miniperl.exe).
#
.\config.h : $(CFGH_TMPL)
-del /f config.h
copy $(CFGH_TMPL) config.h
@echo.>>$@
@echo #ifndef _config_h_footer_>>$@
@echo #define _config_h_footer_>>$@
@echo #undef PTRSIZE>>$@
@echo #undef SSize_t>>$@
@echo #undef HAS_ATOLL>>$@
@echo #undef HAS_STRTOLL>>$@
@echo #undef HAS_STRTOULL>>$@
@echo #undef IVTYPE>>$@
@echo #undef UVTYPE>>$@
@echo #undef IVSIZE>>$@
@echo #undef UVSIZE>>$@
@echo #undef NV_PRESERVES_UV>>$@
@echo #undef NV_PRESERVES_UV_BITS>>$@
@echo #undef IVdf>>$@
@echo #undef UVuf>>$@
@echo #undef UVof>>$@
@echo #undef UVxf>>$@
@echo #undef UVXf>>$@
@echo #undef USE_64_BIT_INT>>$@
@echo #undef Size_t_size>>$@
!IF "$(WIN64)"=="define"
@echo #define PTRSIZE ^8>>$@
@echo #define SSize_t __int64>>$@
@echo #define HAS_ATOLL>>$@
@echo #define HAS_STRTOLL>>$@
@echo #define HAS_STRTOULL>>$@
@echo #define Size_t_size ^8>>$@
!ELSE
@echo #define PTRSIZE ^4>>$@
@echo #define SSize_t int>>$@
@echo #undef HAS_ATOLL>>$@
@echo #undef HAS_STRTOLL>>$@
@echo #undef HAS_STRTOULL>>$@
@echo #define Size_t_size ^4>>$@
!ENDIF
!IF "$(USE_64_BIT_INT)"=="define"
@echo #define IVTYPE __int64>>$@
@echo #define UVTYPE unsigned __int64>>$@
@echo #define IVSIZE ^8>>$@
@echo #define UVSIZE ^8>>$@
@echo #undef NV_PRESERVES_UV>>$@
@echo #define NV_PRESERVES_UV_BITS 53>>$@
@echo #define IVdf "I64d">>$@
@echo #define UVuf "I64u">>$@
@echo #define UVof "I64o">>$@
@echo #define UVxf "I64x">>$@
@echo #define UVXf "I64X">>$@
@echo #define USE_64_BIT_INT>>$@
!ELSE
@echo #define IVTYPE long>>$@
@echo #define UVTYPE unsigned long>>$@
@echo #define IVSIZE ^4>>$@
@echo #define UVSIZE ^4>>$@
@echo #define NV_PRESERVES_UV>>$@
@echo #define NV_PRESERVES_UV_BITS 32>>$@
@echo #define IVdf "ld">>$@
@echo #define UVuf "lu">>$@
@echo #define UVof "lo">>$@
@echo #define UVxf "lx">>$@
@echo #define UVXf "lX">>$@
@echo #undef USE_64_BIT_INT>>$@
!ENDIF
@echo #endif>>$@

..\git_version.h : $(MINIPERL) ..\make_patchnum.pl
cd ..
Expand All @@ -842,13 +932,10 @@ config.w32 : $(CFGSH_TMPL)
..\config.sh : config.w32 $(MINIPERL) config_sh.PL FindExt.pm
$(MINIPERL) -I..\lib config_sh.PL $(CFG_VARS) config.w32 > ..\config.sh

# this target is for when changes to the main config.sh happen.
# edit config.vc, then make perl in a minimal configuration (i.e. with MULTI,
# This target is for when changes to the main config.sh happen.
# Edit config.vc, then make perl in a minimal configuration (i.e. with MULTI,
# ITHREADS, IMP_SYS, LARGE_FILES and PERLIO off), then make this target
# to regenerate config_H.vc.
# repeat for config.vc64 and config_H.vc64 if you have a suitable build
# environment, otherwise hand-edit them to maintain the same differences with
# config.vc and config_H.vc as before.
regen_config_h:
$(MINIPERL) -I..\lib config_sh.PL $(CFG_VARS) $(CFGSH_TMPL) > ..\config.sh
$(MINIPERL) -I..\lib ..\configpm --chdir=..
Expand Down
10 changes: 5 additions & 5 deletions win32/config.gc
Expand Up @@ -22,7 +22,7 @@ api_revision='~PERL_API_REVISION~'
api_subversion='~PERL_API_SUBVERSION~'
api_version='~PERL_API_VERSION~'
api_versionstring='~PERL_API_REVISION~.~PERL_API_VERSION~.~PERL_API_SUBVERSION~'
ar='ar'
ar='~ARCHPREFIX~ar'
archlib='~INST_TOP~~INST_VER~\lib~INST_ARCH~'
archlibexp='~INST_TOP~~INST_VER~\lib~INST_ARCH~'
archname64=''
Expand All @@ -40,7 +40,7 @@ byteorder='1234'
c=''
castflags='0'
cat='type'
cc='gcc'
cc='~ARCHPREFIX~gcc'
cccdlflags=' '
ccdlflags=' '
ccflags='-MD -DWIN32'
Expand Down Expand Up @@ -539,7 +539,7 @@ db_version_patch='0'
defvoidused='15'
direntrytype='struct direct'
dlext='dll'
dlltool='dlltool'
dlltool='~ARCHPREFIX~dlltool'
dlsrc='dl_win32.xs'
doublesize='8'
drand01='(rand()/(double)((unsigned)1<<RANDBITS))'
Expand Down Expand Up @@ -757,7 +757,7 @@ ivsize='4'
ivtype='long'
known_extensions='~static_ext~ ~dynamic_ext~ ~nonxs_ext~'
ksh=''
ld='g++'
ld='~ARCHPREFIX~g++'
lddlflags='-mdll ~LINK_FLAGS~'
ldflags='~LINK_FLAGS~'
ldflags_uselargefiles=''
Expand Down Expand Up @@ -825,7 +825,7 @@ netdb_hlen_type='int'
netdb_host_type='char *'
netdb_name_type='char *'
netdb_net_type='long'
nm='nm'
nm='~ARCHPREFIX~nm'
nm_opt=''
nm_so_opt=''
nonxs_ext='Errno'
Expand Down

0 comments on commit 1f64ae1

Please sign in to comment.