From: Greg Hudson Date: Sat, 19 May 2018 02:04:25 +0000 (-0400) Subject: Clean up Windows build CPU detection X-Git-Tag: krb5-1.17-beta1~90 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F788%2Fhead;p=thirdparty%2Fkrb5.git Clean up Windows build CPU detection In the main build, set a variable BITS based on the detected CPU type, and use it in library name expansions rather than repeatedly checking for the same three 64-bit architectures. Also remove an unused variable WLIB, formerly used to name the winsock library. In the installer build, detect the CPU type in the makefile and pass it to candle with the -arch option. This sets $(sys.BUILDARCH) in wix scripts and also sets the default value of Win64 in components so we don't have to set it for each one. Update the build instructions and appveyor.yml to reflect that the builder no longer needs to set CPU. ticket: 8662 --- diff --git a/appveyor.yml b/appveyor.yml index db8aa84196..e54c7c4ce6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,7 +6,6 @@ build_script: - cd %APPVEYOR_BUILD_FOLDER%\src - set PATH=%PATH%;%wix%bin - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat" - - set CPU=i386 - set - nmake -f Makefile.in prep-windows - nmake @@ -16,7 +15,6 @@ build_script: - rename kfw.msi kfw32.msi - cd ..\..\.. - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" - - set CPU=AMD64 - set - nmake clean - nmake diff --git a/src/config/win-pre.in b/src/config/win-pre.in index 1f8309ccb6..a3fb46ed40 100644 --- a/src/config/win-pre.in +++ b/src/config/win-pre.in @@ -34,6 +34,13 @@ CPU=i386 !if ( "$(CPU)" != "i386" ) && ( "$(CPU)" != "ALPHA" ) && ( "$(CPU)" != "ALPHA64" ) && ( "$(CPU)" != "IA64" ) && ( "$(CPU)" != "AMD64" ) !error Must specify CPU environment variable ( CPU=i386, CPU=ALPHA, CPU=ALPHA64,CPU=IA64, CPU=AMD64) !endif + +!if ("$(CPU)" == "IA64" ) || ("$(CPU)" == "AMD64" ) || ("$(CPU)" == "ALPHA64" ) +BITS=64 +!else +BITS=32 +!endif + # # End of figuring out CPU # @@ -114,7 +121,7 @@ CPPFLAGS=-I$(top_srcdir)\include -I$(top_srcdir)\include\krb5 $(DNSFLAGS) -DWIN3 CCOPTS=-nologo /EHsc /W3 $(PDB_OPTS) $(DLL_FILE_DEF) LOPTS=-nologo -incremental:no -manifest -!if ("$(CPU)" == "IA64" ) || ("$(CPU)" == "AMD64" ) || ("$(CPU)" == "ALPHA64" ) +!if ("$(BITS)" == "64" ) ENTRYPOINT=_DllMainCRTStartup !else ENTRYPOINT=_DllMainCRTStartup@12 @@ -176,28 +183,13 @@ PERL=perl WCONFIG_EXE=$(BUILDTOP)\$(OUTPRE)wconfig.exe WCONFIG=$(WCONFIG_EXE:.exe=) $(WCONFIG_FLAGS) -CLIB=$(BUILDTOP)\lib\$(OUTPRE)comerr32.lib -PLIB=$(BUILDTOP)\lib\$(OUTPRE)xpprof32.lib -KLIB=$(BUILDTOP)\lib\$(OUTPRE)krb5_32.lib -K4LIB=$(BUILDTOP)\lib\$(OUTPRE)krb4_32.lib -SLIB=$(BUILDTOP)\lib\$(OUTPRE)k5sprt32.lib -GLIB=$(BUILDTOP)\lib\$(OUTPRE)gssapi32.lib -CCLIB=krbcc32 -SPAKELIB=spake32 -WLIB= - -!if ("$(CPU)" == "IA64" ) || ("$(CPU)" == "AMD64" ) || ("$(CPU)" == "ALPHA64" ) -CLIB=$(BUILDTOP)\lib\$(OUTPRE)comerr64.lib -PLIB=$(BUILDTOP)\lib\$(OUTPRE)xpprof64.lib -KLIB=$(BUILDTOP)\lib\$(OUTPRE)krb5_64.lib -K4LIB=$(BUILDTOP)\lib\$(OUTPRE)krb4_64.lib -SLIB=$(BUILDTOP)\lib\$(OUTPRE)k5sprt64.lib -GLIB=$(BUILDTOP)\lib\$(OUTPRE)gssapi64.lib -CCLIB=krbcc64 -SPAKELIB=spake64 -WLIB= - -!endif +CLIB=$(BUILDTOP)\lib\$(OUTPRE)comerr$(BITS).lib +PLIB=$(BUILDTOP)\lib\$(OUTPRE)xpprof$(BITS).lib +KLIB=$(BUILDTOP)\lib\$(OUTPRE)krb5_$(BITS).lib +SLIB=$(BUILDTOP)\lib\$(OUTPRE)k5sprt$(BITS).lib +GLIB=$(BUILDTOP)\lib\$(OUTPRE)gssapi$(BITS).lib +CCLIB=krbcc$(BITS) +SPAKELIB=spake$(BITS) KRB4_INCLUDES=-I$(BUILDTOP)/include/kerberosIV diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in index 681718420a..3b812ed832 100644 --- a/src/lib/Makefile.in +++ b/src/lib/Makefile.in @@ -28,11 +28,7 @@ clean-windows:: -##WIN32##!if ("$(CPU)" == "IA64" ) || ("$(CPU)" == "AMD64" ) || ("$(CPU)" == "ALPHA64" ) -##WIN32##SLIBS = $(BUILDTOP)\util\support\$(OUTPRE)k5sprt64.lib -##WIN32##!else -##WIN32##SLIBS = $(BUILDTOP)\util\support\$(OUTPRE)k5sprt32.lib -##WIN32##!endif +##WIN32##SLIBS = $(BUILDTOP)\util\support\$(OUTPRE)k5sprt$(BITS).lib ##WIN32##CLIBS = $(BUILDTOP)\util\et\$(OUTPRE)comerr.lib ##WIN32##PLIBS = $(BUILDTOP)\util\profile\$(OUTPRE)profile.lib ##WIN32##KLIBS = krb5\$(OUTPRE)krb5.lib crypto\$(OUTPRE)crypto.lib \ diff --git a/src/windows/README b/src/windows/README index 158427e963..381d254d64 100644 --- a/src/windows/README +++ b/src/windows/README @@ -90,26 +90,24 @@ In a 32-bit command shell: 4) nmake [NODEBUG=1] # Build the sources 5) nmake install [NODEBUG=1] # Copy headers, libs, executables 6) cd windows\installer\wix # Go to where the installer source is - 7) set CPU=i386 # Specify 32-bit target - 8) nmake [NODEBUG=1] # Build the installer - 9) rename kfw.msi kfw32.msi # Save the 32-bit installer + 7) nmake [NODEBUG=1] # Build the installer + 8) rename kfw.msi kfw32.msi # Save the 32-bit installer In a 64-bit command shell: -10) set PATH=%PATH%;"%WindowsSdkVerBinPath%"\x86 # To get uicc.exe -11) set KRB_INSTALL_DIR=\path\to\dir # Where bin/include/lib lives -12) cd xxx\src # Go to where source lives -13) nmake clean # Clean up the 32-bit objects -14) nmake [NODEBUG=1] # Build the sources for 64-bit -15) nmake install [NODEBUG=1] # Copy 64-bit lib/executables -16) cd windows\installer\wix # Back to the installer source -17) set CPU=AMD64 # Specify 64-bit target -18) nmake clean # Remove 32-bit leavings -19) nmake [NODEBUG=1] # Build the 64-bit installer -20) rename kfw.msi kfw64.msi # And name it usefully - -Step 10 may be skipped if uicc is already in your command-line path -(try running "uicc" to see if you get a usage message or a not-found + 9) set PATH=%PATH%;"%WindowsSdkVerBinPath%"\x86 # To get uicc.exe +10) set KRB_INSTALL_DIR=\path\to\dir # Where bin/include/lib lives +11) cd xxx\src # Go to where source lives +12) nmake clean # Clean up the 32-bit objects +13) nmake [NODEBUG=1] # Build the sources for 64-bit +14) nmake install [NODEBUG=1] # Copy 64-bit lib/executables +15) cd windows\installer\wix # Back to the installer source +16) nmake clean # Remove 32-bit leavings +17) nmake [NODEBUG=1] # Build the 64-bit installer +18) rename kfw.msi kfw64.msi # And name it usefully + +Step 9 may be skipped if uicc is already in the command-line path (try +running "uicc" to see if you get a usage message or a not-found error), or if you are not building the graphical ticket manager. Visual Studio 2013 and 2015 provide only a single command prompt. diff --git a/src/windows/installer/wix/Makefile b/src/windows/installer/wix/Makefile index 3c2bfd691f..225fbe8fd1 100644 --- a/src/windows/installer/wix/Makefile +++ b/src/windows/installer/wix/Makefile @@ -35,10 +35,22 @@ WIXINCLUDES= \ CUSTOMDLL=custom\custom.dll +!if !defined(CPU) || "$(CPU)" == "" +CPU=$(PROCESSOR_ARCHITECTURE) +!endif # CPU + +!if ( "$(CPU)" == "X86" ) || ( "$(CPU)" == "x86" ) || ( "$(CPU)" == "i386" ) +WIXARCH = x86 +!elseif ( "$(CPU)" == "AMD64" ) +WIXARCH = x64 +!else +!error "Architecture $(CPU) not supported by installer" +!endif + all: $(MSIFILE) $(OBJFILE): kfw.wxs $(WIXINCLUDES) - $(CANDLE) -out $@ kfw.wxs \ + $(CANDLE) -arch $(WIXARCH) -out $@ kfw.wxs \ "-dDate=%DATE%" \ "-dTime=%TIME%" \ -dBuildLang=$(LANG) diff --git a/src/windows/installer/wix/config.wxi b/src/windows/installer/wix/config.wxi index 2c68cb1c55..15411c17a6 100644 --- a/src/windows/installer/wix/config.wxi +++ b/src/windows/installer/wix/config.wxi @@ -35,22 +35,10 @@ - - - - - - - - - - - - diff --git a/src/windows/installer/wix/features.wxi b/src/windows/installer/wix/features.wxi index a4c9ff3593..5aa5f6fe4f 100644 --- a/src/windows/installer/wix/features.wxi +++ b/src/windows/installer/wix/features.wxi @@ -56,7 +56,7 @@ - + @@ -146,7 +146,7 @@ Level="130" Title="!(loc.KerberosSDKTitle)"> - + @@ -169,10 +169,6 @@ Level="30" Title="!(loc.KerberosDocTitle)"> - - diff --git a/src/windows/installer/wix/files.wxi b/src/windows/installer/wix/files.wxi index 8bf67d883f..039732693c 100644 --- a/src/windows/installer/wix/files.wxi +++ b/src/windows/installer/wix/files.wxi @@ -35,7 +35,7 @@ - + @@ -51,11 +51,11 @@ - + - + @@ -67,76 +67,76 @@ - + KRB5CONFIG - + KRB5CCNAME - + KRB5PRESERVEIDENTITY - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -153,158 +153,158 @@ - + - + - + - + - - + LEASHCREATEMISSINGCONFIG - + LEASHAUTORENEWTICKETS - + LEASHMSLSAIMPORT - + - + - + - + LEASHLIFETIME - + LEASHRENEWTILL - + LEASHRENEWABLE - + LEASHFORWARDABLE - + LEASHNOADDRESSES - + LEASHPROXIABLE - + LEASHPUBLICIP - + LEASHHIDEKINITOPTIONS - + LEASHLIFEMIN - + LEASHLIFEMAX - + LEASHRENEWMIN - + LEASHRENEWMAX - + LEASHUPPERCASEREALM - + LEASHTIMEHOST - + LEASHPRESERVEKINITOPTIONS - + - + - + - - + + - + - + - + - + - + - + - - + + @@ -340,17 +340,17 @@ - + - - + + - - + + @@ -363,7 +363,7 @@ - + @@ -371,11 +371,11 @@ - + - + @@ -383,15 +383,15 @@ - + - + @@ -404,9 +404,9 @@ - + - + @@ -416,9 +416,9 @@ - + - + @@ -429,25 +429,13 @@ - - - - + @@ -463,7 +451,7 @@ - + @@ -475,7 +463,7 @@ - + @@ -491,7 +479,7 @@ - + @@ -515,7 +503,7 @@ - + @@ -539,7 +527,7 @@ - + @@ -575,7 +563,7 @@ - + diff --git a/src/windows/installer/wix/kfw.wxs b/src/windows/installer/wix/kfw.wxs index c5c0f5fab2..d150a61fdb 100755 --- a/src/windows/installer/wix/kfw.wxs +++ b/src/windows/installer/wix/kfw.wxs @@ -50,7 +50,6 @@ Languages="$(var.Language)" Compressed="yes" SummaryCodepage="$(var.CodePage)" - Platforms="$(var.Platform)" /> @@ -65,7 +64,7 @@ (Not (VersionNT = 600)) Or (ServicePackLevel >= 2) USELEASH Or USENETIDMGR Not (USELEASH And USENETIDMGR) - + diff --git a/src/windows/installer/wix/lang/config_1033.wxi b/src/windows/installer/wix/lang/config_1033.wxi index 78f26d31e2..3dbaaf54be 100644 --- a/src/windows/installer/wix/lang/config_1033.wxi +++ b/src/windows/installer/wix/lang/config_1033.wxi @@ -27,10 +27,10 @@ - + - + diff --git a/src/windows/installer/wix/platform.wxi b/src/windows/installer/wix/platform.wxi index 1f9bba7d6b..493354e72a 100644 --- a/src/windows/installer/wix/platform.wxi +++ b/src/windows/installer/wix/platform.wxi @@ -18,7 +18,7 @@ - + @@ -104,7 +104,7 @@ - + diff --git a/src/windows/installer/wix/runtime.wxi b/src/windows/installer/wix/runtime.wxi index ff86e3f54a..3d5c1dfea7 100644 --- a/src/windows/installer/wix/runtime.wxi +++ b/src/windows/installer/wix/runtime.wxi @@ -1,7 +1,7 @@  - + diff --git a/src/windows/leash/Makefile.in b/src/windows/leash/Makefile.in index e3300849e7..263f91966a 100644 --- a/src/windows/leash/Makefile.in +++ b/src/windows/leash/Makefile.in @@ -43,7 +43,7 @@ DEFINES = $(DEFINES) -DDBG ##### Linker LINK = link -LIBS = $(GLIB) $(CLIB) $(WLIB) +LIBS = $(GLIB) $(CLIB) SYSLIBS = kernel32.lib Iphlpapi.lib ws2_32.lib user32.lib gdi32.lib comdlg32.lib comctl32.lib version.lib LFLAGS = /nologo $(LOPTS) diff --git a/src/windows/leashdll/Makefile.in b/src/windows/leashdll/Makefile.in index 390a0a475f..76df81bda8 100644 --- a/src/windows/leashdll/Makefile.in +++ b/src/windows/leashdll/Makefile.in @@ -1,12 +1,6 @@ BUILDTOP=..\.. -DLL_NAME=leashw32 - -# Use 64-bit DLL_NAME and DEF_FILE on 64-bit platforms -!if ("$(CPU)" == "IA64") || ("$(CPU)" == "AMD64") || ("$(CPU)" == "ALPHA64") -DLL_NAME=leashw64 -!endif - +DLL_NAME=leashw$(BITS) DEF_FILE=leashw32.def OBJS= $(OUTPRE)krb5routines.$(OBJEXT) \