Win64 compile
"Russell Lang" <[email protected]> Wed, 16 Feb 2005 13:20:57 +1100
| Newsgroups | gmane.comp.printing.ghostscript.patches |
|---|---|
| Message-ID | <421348B9.8100.3801A3BA@localhost> |
Compile Ghostscript for 64-bit Windows with AMD64 processor. Change the default install directory to "c:\program files\gs". DETAILS: Microsoft Visual Studio .NET 2003 with Windows Server 2003 DDK, or Microsoft Visual Studio 8 (.NET 2005 beta) are required to compile for 64-bits. Dialog boxes return type INT_PTR not BOOL. Install to the "Program Files" directory as default, instead of c:\gs. This allows 32-bit and 64-bit versions to be installed in separate locations. For 32-bit GS on 32-bit Windows, "c:\Program Files\gs" For 32-bit GS on 64-bit Windows, "c:\Program Files (x86)\gs" For 64-bit GS on 64-bit Windows, "c:\Program Files\gs" The " (x86)" is added by Windows when a 32-bit program asks for the "Program Files" folder on 64-bit Windows. Other languages will translate "Program Files". The programs still have "32" in their names: gswin32c.exe, gswin32.exe and gsdll32.dll. They are distinguished from the 32-bit versions by their install location. This avoids changes to many batch files. The registry entries written by the installer do not conflict between 32 and 64-bit. For 32 on 32, or 64 on 64, the location is HKLM\Software\AFPL Ghostscript\N.NN For 32 on 64, Windows adds "WoW6432Node\" to make it HKLM\Software\Wow6432Node\AFPL Ghostscript\N.NN If the "Program Files" folder has a " (x86)" suffix, this is used as a suffix on the Start Menu items. This allows 32-bit and 64-bit GS to be installed without conflict. The start menu item for 32-bit GS on 64-bit Windows is "Ghostscript N.NN (x86)". Building 64-bit GS on 32-bit Windows can be done by the usual method - either execute genconf.exe on a 64-bit platform or hand edit arch.h. A separate patch will fix the display device DisplayHandle parameter which is currently truncated to 32-bits. There is a warning from the linker about exports being defined multiple ways. This is not a problem with the 32-bit compile. This is due to the C code specifying export and the module definition file also specifying the export. Removing the function names from the module definition file would make the warning message go away, but may affect 32-bit compiles. Russell Lang [email protected] Ghostgum Software Pty Ltd http://www.ghostgum.com.au/ _______________________________________________ gs-code-review mailing list [email protected] http://www.ghostscript.com/mailman/listinfo/gs-code-review
gs64c.txt
(application/octet-stream, 19.4 KB)
Common subdirectories: src/CVS and ../gs8.51/src/CVS
diff -u src/dwsetup.cpp ../gs8.51/src/dwsetup.cpp
--- src/dwsetup.cpp Fri Feb 11 21:17:24 2005
+++ ../gs8.51/src/dwsetup.cpp Sat Feb 12 03:07:10 2005
@@ -80,6 +80,21 @@
#include "dwsetup.h"
#include "dwinst.h"
+extern "C" {
+typedef HRESULT (WINAPI *PFN_SHGetFolderPath)(
+ HWND hwndOwner,
+ int nFolder,
+ HANDLE hToken,
+ DWORD dwFlags,
+ LPSTR pszPath);
+
+typedef BOOL (WINAPI *PFN_SHGetSpecialFolderPath)(
+ HWND hwndOwner,
+ LPTSTR lpszPath,
+ int nFolder,
+ BOOL fCreate);
+}
+
//#define DEBUG
#define UNINSTALLPROG "uninstgs.exe"
@@ -129,9 +144,14 @@
BOOL g_bError = FALSE; // TRUE = Install was not successful
BOOL is_winnt = FALSE; // Disable "All Users" if not NT.
+#ifdef _WIN64
+#define DLGRETURN INT_PTR
+#else
+#define DLGRETURN BOOL
+#endif
// Prototypes
-BOOL CALLBACK MainDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
+DLGRETURN CALLBACK MainDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
void gs_addmess_count(const char *str, int count);
void gs_addmess(const char *str);
void gs_addmess_update(void);
@@ -142,6 +162,7 @@
BOOL make_filelist(int argc, char *argv[]);
int get_font_path(char *path, unsigned int pathlen);
BOOL write_cidfmap(const char *gspath, const char *cidpath);
+BOOL GetProgramFiles(LPTSTR path);
//////////////////////////////////////////////////////////////////////
@@ -190,7 +211,7 @@
int twend;
// Modeless Dialog Box
-BOOL CALLBACK
+DLGRETURN CALLBACK
TextWinDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message) {
@@ -338,7 +359,7 @@
char szFolderName[MAXSTR];
char szDirName[MAXSTR];
-BOOL CALLBACK
+DLGRETURN CALLBACK
DirDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
WORD notify_message;
@@ -489,8 +510,12 @@
}
// Interactive setup
+ if (!GetProgramFiles(g_szTargetDir))
+ strcpy(g_szTargetDir, "C:\\Program Files");
+ strcat(g_szTargetDir, "\\");
LoadString(g_hInstance, IDS_TARGET_DIR,
- g_szTargetDir, sizeof(g_szTargetDir));
+ g_szTargetDir+strlen(g_szTargetDir),
+ sizeof(g_szTargetDir)-strlen(g_szTargetDir));
// main dialog box
g_hMain = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_MAIN), (HWND)NULL, MainDlgProc, (LPARAM)NULL);
@@ -520,7 +545,7 @@
// Main Modeless Dialog Box
-BOOL CALLBACK
+DLGRETURN CALLBACK
MainDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message) {
@@ -700,6 +725,8 @@
char szArguments[MAXSTR];
char szDescription[MAXSTR];
char szDotVersion[MAXSTR];
+ char szPlatformSuffix[MAXSTR];
+ const char *pSuffix = "";
if (g_bQuit)
return FALSE;
@@ -778,6 +805,22 @@
// Add Start Menu items
gs_addmess("Adding Start Menu items\n");
+
+ memset(szPlatformSuffix, 0, sizeof(szPlatformSuffix));
+ if (GetProgramFiles(szPlatformSuffix)) {
+ /* If ProgramFiles has a suffix like " (x86)" then use
+ * it for Start menu entries to distinguish between
+ * 32-bit and 64-bit programs.
+ */
+ for (pSuffix = szPlatformSuffix; *pSuffix; pSuffix++)
+ if ((pSuffix[0] == ' ') && (pSuffix[1] == '('))
+ break;
+ }
+ else {
+ pSuffix = "";
+ }
+
+
if (!cinst.StartMenuBegin()) {
gs_addmess("Failed to begin Start Menu update\n");
return FALSE;
@@ -789,7 +832,7 @@
strcpy(szArguments, "\042-I");
strcat(szArguments, szLIB);
strcat(szArguments, "\042");
- sprintf(szDescription, "Ghostscript %s", szDotVersion);
+ sprintf(szDescription, "Ghostscript %s%s", szDotVersion, pSuffix);
if (!cinst.StartMenuAdd(szDescription, szProgram, szArguments)) {
gs_addmess("Failed to add Start Menu item\n");
return FALSE;
@@ -798,7 +841,8 @@
strcat(szProgram, "\\");
strcat(szProgram, cinst.GetMainDir());
strcat(szProgram, "\\doc\\Readme.htm");
- sprintf(szDescription, "Ghostscript Readme %s", szDotVersion);
+ sprintf(szDescription, "Ghostscript Readme %s%s",
+ szDotVersion, pSuffix);
if (!cinst.StartMenuAdd(szDescription, szProgram, NULL)) {
gs_addmess("Failed to add Start Menu item\n");
return FALSE;
@@ -1188,4 +1232,78 @@
return TRUE;
}
+//////////////////////////////////////////////////////////////////////
+
+#ifndef CSIDL_PROGRAM_FILES
+#define CSIDL_PROGRAM_FILES 0x0026
+#endif
+#ifndef CSIDL_FLAG_CREATE
+#define CSIDL_FLAG_CREATE 0x8000
+#endif
+#ifndef SHGFP_TYPE_CURRENT
+#define SHGFP_TYPE_CURRENT 0
+#endif
+
+BOOL
+GetProgramFiles(LPTSTR path)
+{
+ PFN_SHGetSpecialFolderPath PSHGetSpecialFolderPath = NULL;
+ PFN_SHGetFolderPath PSHGetFolderPath = NULL;
+ HMODULE hModuleShell32 = NULL;
+ HMODULE hModuleShfolder = NULL;
+ BOOL fOk = FALSE;
+ hModuleShfolder = LoadLibrary("shfolder.dll");
+ hModuleShell32 = LoadLibrary("shell32.dll");
+
+ if (hModuleShfolder) {
+ PSHGetFolderPath = (PFN_SHGetFolderPath)
+ GetProcAddress(hModuleShfolder, "SHGetFolderPathA");
+ if (PSHGetFolderPath) {
+ fOk = (PSHGetFolderPath(HWND_DESKTOP,
+ CSIDL_PROGRAM_FILES | CSIDL_FLAG_CREATE,
+ NULL, SHGFP_TYPE_CURRENT, path) == S_OK);
+ }
+ }
+
+ if (!fOk && hModuleShell32) {
+ PSHGetFolderPath = (PFN_SHGetFolderPath)
+ GetProcAddress(hModuleShell32, "SHGetFolderPathA");
+ if (PSHGetFolderPath) {
+ fOk = (PSHGetFolderPath(HWND_DESKTOP,
+ CSIDL_PROGRAM_FILES | CSIDL_FLAG_CREATE,
+ NULL, SHGFP_TYPE_CURRENT, path) == S_OK);
+ }
+ }
+
+ if (!fOk && hModuleShell32) {
+ PSHGetSpecialFolderPath = (PFN_SHGetSpecialFolderPath)
+ GetProcAddress(hModuleShell32, "SHGetSpecialFolderPathA");
+ if (PSHGetSpecialFolderPath) {
+ fOk = PSHGetSpecialFolderPath(HWND_DESKTOP, path,
+ CSIDL_PROGRAM_FILES, TRUE);
+ }
+ }
+
+ if (!fOk) {
+ /* If all else fails (probably Win95), try the registry */
+ LONG rc;
+ HKEY hkey;
+ DWORD cbData;
+ DWORD keytype;
+ rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+ "SOFTWARE\\Microsoft\\Windows\\CurrentVersion", 0, KEY_READ, &hkey);
+ if (rc == ERROR_SUCCESS) {
+ cbData = MAX_PATH;
+ keytype = REG_SZ;
+ if (rc == ERROR_SUCCESS)
+ rc = RegQueryValueEx(hkey, "ProgramFilesDir", 0, &keytype,
+ (LPBYTE)path, &cbData);
+ RegCloseKey(hkey);
+ }
+ fOk = (rc == ERROR_SUCCESS);
+ }
+ return fOk;
+}
+
+
//////////////////////////////////////////////////////////////////////
diff -u src/dwsetup.rc ../gs8.51/src/dwsetup.rc
--- src/dwsetup.rc Fri Feb 11 21:17:24 2005
+++ ../gs8.51/src/dwsetup.rc Sat Feb 12 02:11:28 2005
@@ -140,7 +140,7 @@
STRINGTABLE DISCARDABLE
BEGIN
IDS_APPNAME "AFPL Ghostscript Setup"
- IDS_TARGET_DIR "C:\\gs"
+ IDS_TARGET_DIR "gs"
IDS_TARGET_GROUP "Ghostscript"
END
diff -u src/dwuninst.cpp ../gs8.51/src/dwuninst.cpp
--- src/dwuninst.cpp Fri Feb 11 21:17:26 2005
+++ ../gs8.51/src/dwuninst.cpp Fri Feb 11 22:45:18 2005
@@ -38,6 +38,13 @@
#define MAXSTR 256
#define UNINSTALLKEY TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall")
+#ifdef _WIN64
+#define DLGRETURN INT_PTR
+#else
+#define DLGRETURN BOOL
+#endif
+
+
HWND hDlgModeless;
HWND hText1;
HWND hText2;
@@ -673,7 +680,7 @@
#ifdef __BORLANDC__
#pragma argsused
#endif
-BOOL CALLBACK _export
+DLGRETURN CALLBACK _export
RemoveDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message) {
diff -u src/gp_mswin.c ../gs8.51/src/gp_mswin.c
--- src/gp_mswin.c Fri Feb 11 21:17:26 2005
+++ ../gs8.51/src/gp_mswin.c Fri Feb 11 22:43:02 2005
@@ -149,7 +149,7 @@
/* Dialog box to select printer port */
-BOOL CALLBACK
+DLGRETURN CALLBACK
SpoolDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
LPSTR entry;
diff -u src/gp_mswin.h ../gs8.51/src/gp_mswin.h
--- src/gp_mswin.h Fri Feb 11 21:17:24 2005
+++ ../gs8.51/src/gp_mswin.h Fri Feb 11 22:42:12 2005
@@ -50,6 +50,12 @@
extern BOOL is_win32s;
extern int is_spool(const char *queue);
+#ifdef _WIN64
+#define DLGRETURN INT_PTR
+#else
+#define DLGRETURN BOOL
+#endif
+
#endif /* !defined(RC_INVOKED) */
#endif /* gp_mswin_INCLUDED */
diff -u src/gsdll32.def ../gs8.51/src/gsdll32.def
--- src/gsdll32.def Fri Feb 11 21:17:26 2005
+++ ../gs8.51/src/gsdll32.def Tue Feb 15 23:25:30 2005
@@ -28,4 +28,4 @@
gsapi_set_stdio
gsapi_set_poll
gsapi_set_display_callback
- gsapi_set_visual_tracer
+ gsapi_set_visual_tracer
diff -u src/msvc32.mak ../gs8.51/src/msvc32.mak
--- src/msvc32.mak Fri Feb 11 21:17:25 2005
+++ ../gs8.51/src/msvc32.mak Wed Feb 16 00:32:00 2005
@@ -152,6 +152,12 @@
NOPRIVATE=0
!endif
+# We can compile for a 32-bit or 64-bit target
+# WIN32 and WIN64 are mutually exclusive. WIN32 is the default.
+!if !defined(WIN32) && !defined(Win64)
+WIN32=0
+!endif
+
# Define the name of the executable file.
!ifndef GS
@@ -378,20 +384,37 @@
SHAREDBASE=
!else
COMPBASE=$(DEVSTUDIO)\Vc7
-SHAREDBASE=$(DEVSTUDIO)\Vc7\
+SHAREDBASE=$(DEVSTUDIO)\Vc7
+!ifdef WIN64
+# Windows Server 2003 DDK is needed for the 64-bit compiler
+# but it won't install on Windows XP 64-bit.
+DDKBASE=c:\winddk\3790
+COMPDIR64=$(DDKBASE)\bin\win64\x86\amd64
+LINKLIBPATH=/LIBPATH:"$(DDKBASE)\lib\wnet\amd64"
+INCDIR64A=$(DDKBASE)\inc\wnet
+INCDIR64B=$(DDKBASE)\inc\crt
!endif
!endif
+!endif
!if $(MSVC_VERSION) == 8
! ifndef DEVSTUDIO
+!ifdef WIN64
+DEVSTUDIO=C:\Program Files (x86)\Microsoft Visual Studio 8
+!else
DEVSTUDIO=C:\Program Files\Microsoft Visual Studio 8
+!endif
! endif
!if "$(DEVSTUDIO)"==""
COMPBASE=
SHAREDBASE=
!else
COMPBASE=$(DEVSTUDIO)\VC
-SHAREDBASE=$(DEVSTUDIO)\VC\
+SHAREDBASE=$(DEVSTUDIO)\VC
+!ifdef WIN64
+COMPDIR64=$(COMPBASE)\bin\x86_amd64
+LINKLIBPATH=/LIBPATH:"$(COMPBASE)\lib\amd64" /LIBPATH:"$(COMPBASE)\PlatformSDK\Lib\AMD64"
+!endif
!endif
!endif
@@ -405,17 +428,25 @@
!if "$(COMPBASE)"==""
COMPDIR=
!else
+!ifdef WIN64
+COMPDIR=$(COMPDIR64)
+!else
COMPDIR=$(COMPBASE)\bin
!endif
!endif
+!endif
!ifndef LINKDIR
!if "$(COMPBASE)"==""
LINKDIR=
!else
+!ifdef WIN64
+LINKDIR=$(COMPDIR64)
+!else
LINKDIR=$(COMPBASE)\bin
!endif
!endif
+!endif
!ifndef RCDIR
!if "$(SHAREDBASE)"==""
@@ -452,8 +483,12 @@
COMPCPP=$(COMP)
!endif
!ifndef COMPAUX
+!ifdef WIN64
+COMPAUX="$(COMPBASE)\bin\cl"
+!else
COMPAUX=$(COMP)
!endif
+!endif
!ifndef RCOMP
!if "$(RCDIR)"==""
@@ -491,6 +526,10 @@
!endif
!endif
+!ifndef LINKLIBPATH
+LINKLIBPATH=
+!endif
+
# Define the processor architecture. (i386, ppc, alpha)
!ifndef CPU_FAMILY
@@ -663,20 +702,20 @@
$(GS_XE): $(GSDLL_DLL) $(DWOBJ) $(GSCONSOLE_XE) $(SETUP_XE) $(UNINSTALL_XE)
echo /SUBSYSTEM:WINDOWS > $(PSGEN)gswin32.rsp
echo /DEF:$(PSSRCDIR)\dwmain32.def /OUT:$(GS_XE) >> $(PSGEN)gswin32.rsp
- $(LINK) $(LCT) @$(PSGEN)gswin32.rsp $(DWOBJ) @$(LIBCTR) $(GS_OBJ).res
+ $(LINK) $(LCT) @$(PSGEN)gswin32.rsp $(DWOBJ) $(LINKLIBPATH) @$(LIBCTR) $(GS_OBJ).res
del $(PSGEN)gswin32.rsp
# The console mode small EXE loader
$(GSCONSOLE_XE): $(OBJC) $(GS_OBJ).res $(PSSRCDIR)\dw32c.def
echo /SUBSYSTEM:CONSOLE > $(PSGEN)gswin32.rsp
echo /DEF:$(PSSRCDIR)\dw32c.def /OUT:$(GSCONSOLE_XE) >> $(PSGEN)gswin32.rsp
- $(LINK) $(LCT) @$(PSGEN)gswin32.rsp $(OBJC) @$(LIBCTR) $(GS_OBJ).res
+ $(LINK) $(LCT) @$(PSGEN)gswin32.rsp $(OBJC) $(LINKLIBPATH) @$(LIBCTR) $(GS_OBJ).res
del $(PSGEN)gswin32.rsp
# The big DLL
$(GSDLL_DLL): $(GS_ALL) $(DEVS_ALL) $(GSDLL_OBJS) $(GSDLL_OBJ).res $(PSGEN)lib32.rsp
echo /DLL /DEF:$(PSSRCDIR)\gsdll32.def /OUT:$(GSDLL_DLL) > $(PSGEN)gswin32.rsp
- $(LINK) $(LCT) @$(PSGEN)gswin32.rsp $(GSDLL_OBJS) @$(ld_tr) $(INTASM) @$(PSGEN)lib32.rsp @$(LIBCTR) $(GSDLL_OBJ).res
+ $(LINK) $(LCT) @$(PSGEN)gswin32.rsp $(GSDLL_OBJS) @$(ld_tr) $(INTASM) @$(PSGEN)lib32.rsp $(LINKLIBPATH) @$(LIBCTR) $(GSDLL_OBJ).res
del $(PSGEN)gswin32.rsp
!else
@@ -689,7 +728,7 @@
echo $(GLOBJ)dwtext.obj >> $(PSGEN)gswin32.tr
echo $(GLOBJ)dwreg.obj >> $(PSGEN)gswin32.tr
echo /DEF:$(PSSRCDIR)\dwmain32.def /OUT:$(GS_XE) > $(PSGEN)gswin32.rsp
- $(LINK) $(LCT) @$(PSGEN)gswin32.rsp $(GLOBJ)gsdll @$(PSGEN)gswin32.tr @$(LIBCTR) $(INTASM) @$(PSGEN)lib32.rsp $(GSDLL_OBJ).res $(DWTRACE)
+ $(LINK) $(LCT) @$(PSGEN)gswin32.rsp $(GLOBJ)gsdll @$(PSGEN)gswin32.tr $(LINKLIBPATH) @$(LIBCTR) $(INTASM) @$(PSGEN)lib32.rsp $(GSDLL_OBJ).res $(DWTRACE)
del $(PSGEN)gswin32.tr
del $(PSGEN)gswin32.rsp
@@ -702,7 +741,7 @@
echo $(PSOBJ)dwreg.obj >> $(PSGEN)gswin32c.tr
echo /SUBSYSTEM:CONSOLE > $(PSGEN)gswin32.rsp
echo /DEF:$(PSSRCDIR)\dw32c.def /OUT:$(GSCONSOLE_XE) >> $(PSGEN)gswin32.rsp
- $(LINK) $(LCT) @$(PSGEN)gswin32.rsp $(GLOBJ)gsdll @$(PSGEN)gswin32c.tr @$(LIBCTR) $(INTASM) @$(PSGEN)lib32.rsp $(GS_OBJ).res $(DWTRACE)
+ $(LINK) $(LCT) @$(PSGEN)gswin32.rsp $(GLOBJ)gsdll @$(PSGEN)gswin32c.tr $(LINKLIBPATH) @$(LIBCTR) $(INTASM) @$(PSGEN)lib32.rsp $(GS_OBJ).res $(DWTRACE)
del $(PSGEN)gswin32.rsp
del $(PSGEN)gswin32c.tr
!endif
@@ -717,7 +756,7 @@
copy $(LIBCTR) $(PSGEN)dwsetup.tr
echo ole32.lib >> $(PSGEN)dwsetup.tr
echo uuid.lib >> $(PSGEN)dwsetup.tr
- $(LINK) $(LCT) @$(PSGEN)dwsetup.rsp @$(PSGEN)dwsetup.tr $(PSOBJ)dwsetup.res
+ $(LINK) $(LCT) @$(PSGEN)dwsetup.rsp $(LINKLIBPATH) @$(PSGEN)dwsetup.tr $(PSOBJ)dwsetup.res
del $(PSGEN)dwsetup.rsp
del $(PSGEN)dwsetup.tr
@@ -727,7 +766,7 @@
copy $(LIBCTR) $(PSGEN)dwuninst.tr
echo ole32.lib >> $(PSGEN)dwuninst.tr
echo uuid.lib >> $(PSGEN)dwuninst.tr
- $(LINK) $(LCT) @$(PSGEN)dwuninst.rsp @$(PSGEN)dwuninst.tr $(PSOBJ)dwuninst.res
+ $(LINK) $(LCT) @$(PSGEN)dwuninst.rsp $(LINKLIBPATH) @$(PSGEN)dwuninst.tr $(PSOBJ)dwuninst.res
del $(PSGEN)dwuninst.rsp
del $(PSGEN)dwuninst.tr
diff -u src/msvccmd.mak ../gs8.51/src/msvccmd.mak
--- src/msvccmd.mak Fri Feb 11 21:17:24 2005
+++ ../gs8.51/src/msvccmd.mak Wed Feb 16 00:32:00 2005
@@ -77,15 +77,18 @@
# Define the compilation flags.
# MSVC 8 (2005) warns about deprecated unsafe common functions like strcpy.
-!if $(MSVC_VERSION) == 8
+# MSVC 8 does not support debug compile and continue /Gi /ZI.
+!if ($(MSVC_VERSION) == 8) || defined(WIN64)
VC8WARN=/wd4996 /wd4224
+CDCC=
!else
VC8WARN=
+CDCC=/Gi /ZI
!endif
!if "$(CPU_FAMILY)"=="i386"
-!if $(MSVC_VERSION) >= 8
+!if ($(MSVC_VERSION) >= 8) || defined(WIN64)
# MSVC 8 (2005) attempts to produce code good for all processors.
# and doesn't used /G5 or /GB.
# MSVC 8 (2005) avoids buggy 0F instructions.
@@ -152,7 +155,7 @@
!if $(TDEBUG)!=0
# /Fd designates the directory for the .pdb file.
# Note that it must be followed by a space.
-CT=/ZI /Od /Fd$(GLOBJDIR) $(NULL) /Gi $(CPCH)
+CT=/Od /Fd$(GLOBJDIR) $(NULL) $(CDCC) $(CPCH)
LCT=/DEBUG /INCREMENTAL:YES
COMPILE_FULL_OPTIMIZED= # no optimization when debugging
COMPILE_WITH_FRAMES= # no optimization when debugging
@@ -190,6 +193,13 @@
!endif
!endif
+!if ($(MSVC_VERSION) == 7) && defined(WIN64)
+# Need to specify DDK include directories before .NET 2003 directories.
+MSINCFLAGS=-I"$(INCDIR64A)" -I"$(INCDIR64B)"
+!else
+MSINCFLAGS=
+!endif
+
# Specify output object name
CCOBJNAME=-Fo
@@ -202,7 +212,7 @@
# but it's too much work right now.
GENOPT=$(CP) $(CD) $(CT) $(CS) $(WARNOPT) $(VC8WARN) /nologo $(CMT)
-CCFLAGS=$(PLATOPT) $(FPFLAGS) $(CPFLAGS) $(CFLAGS) $(XCFLAGS)
+CCFLAGS=$(PLATOPT) $(FPFLAGS) $(CPFLAGS) $(CFLAGS) $(XCFLAGS) $(MSINCFLAGS)
CC=$(COMP) /c $(CCFLAGS) @$(GLGENDIR)\ccf32.tr
CPP=$(COMPCPP) /c $(CCFLAGS) @$(GLGENDIR)\ccf32.tr
!if $(MAKEDLL)
diff -u src/msvctail.mak ../gs8.51/src/msvctail.mak
--- src/msvctail.mak Fri Feb 11 21:17:25 2005
+++ ../gs8.51/src/msvctail.mak Wed Feb 16 00:32:00 2005
@@ -38,9 +38,15 @@
# Don't create genarch if it's not needed
!ifdef GENARCH_XE
+!ifdef WIN64
$(GENARCH_XE): $(GLSRC)genarch.c $(GENARCH_DEPS) $(GLGENDIR)\ccf32.tr
+ $(CC) @$(GLGENDIR)\ccf32.tr /Fo$(GLOBJ)genarch.obj $(GLSRC)genarch.c
+ $(LINK) $(LCT) $(LINKLIBPATH) $(GLOBJ)genarch.obj /OUT:$(GENARCH_XE)
+!else
+$(GENARCH_XE): $(GLSRC)genarch.c $(GENARCH_DEPS) $(GLGENDIR)\ccf32.tr
$(CCAUX) @$(GLGENDIR)\ccf32.tr /Fo$(GLOBJ)genarch.obj /Fe$(GENARCH_XE) $(GLSRC)genarch.c $(CCAUX_TAIL)
!endif
+!endif
$(GENCONF_XE): $(GLSRC)genconf.c $(GENCONF_DEPS)
$(CCAUX) $(GLSRC)genconf.c /Fo$(GLOBJ)genconf.obj /Fe$(GENCONF_XE) $(CCAUX_TAIL)
Common subdirectories: src/rinkj and ../gs8.51/src/rinkj
diff -u src/winint.mak ../gs8.51/src/winint.mak
--- src/winint.mak Fri Feb 11 21:17:27 2005
+++ ../gs8.51/src/winint.mak Sat Feb 12 02:08:40 2005
@@ -37,8 +37,12 @@
# Define the location of the WinZip self-extracting-archive-maker.
!ifndef WINZIPSE_XE
+!ifdef WIN64
+WINZIPSE_XE="C:\Program Files (x86)\WinZip Self-Extractor\WZIPSE32.EXE"
+!else
WINZIPSE_XE="C:\Program Files\WinZip Self-Extractor\WZIPSE32.EXE"
!endif
+!endif
# Define the name and location of the zip archive maker.
!ifndef ZIP_XE
@@ -234,6 +238,11 @@
# Make the zip archive.
FILELIST_TXT=filelist.txt
FONTLIST_TXT=fontlist.txt
+!ifdef WIN64
+ZIPTARGET=gs$(GS_VERSION)w64
+!else
+ZIPTARGET=gs$(GS_VERSION)w32
+!endif
zip: $(SETUP_XE) $(UNINSTALL_XE)
cd ..
copy gs$(GS_DOT_VERSION)\$(SETUP_XE) .
@@ -249,22 +258,22 @@
echo $(ZIPPROGFILE9) >> $(ZIPTEMPFILE)
$(SETUP_XE_NAME) -title "AFPL Ghostscript $(GS_DOT_VERSION)" -dir "gs$(GS_DOT_VERSION)" -list "$(FILELIST_TXT)" @$(ZIPTEMPFILE)
$(SETUP_XE_NAME) -title "AFPL Ghostscript Fonts" -dir "fonts" -list "$(FONTLIST_TXT)" $(ZIPFONTFILES)
- -del gs$(GS_VERSION)w32.zip
- $(ZIP_XE) -9 gs$(GS_VERSION)w32.zip $(SETUP_XE_NAME) $(UNINSTALL_XE_NAME) $(FILELIST_TXT) $(FONTLIST_TXT)
- $(ZIP_XE) -9 -r gs$(GS_VERSION)w32.zip $(ZIPFONTDIR)
- $(ZIP_XE) -9 -r gs$(GS_VERSION)w32.zip $(ZIPPROGFILE1)
- $(ZIP_XE) -9 -r gs$(GS_VERSION)w32.zip $(ZIPPROGFILE2)
- $(ZIP_XE) -9 -r gs$(GS_VERSION)w32.zip $(ZIPPROGFILE3)
- $(ZIP_XE) -9 -r gs$(GS_VERSION)w32.zip $(ZIPPROGFILE4)
+ -del $(ZIPTARGET).zip
+ $(ZIP_XE) -9 $(ZIPTARGET).zip $(SETUP_XE_NAME) $(UNINSTALL_XE_NAME) $(FILELIST_TXT) $(FONTLIST_TXT)
+ $(ZIP_XE) -9 -r $(ZIPTARGET).zip $(ZIPFONTDIR)
+ $(ZIP_XE) -9 -r $(ZIPTARGET).zip $(ZIPPROGFILE1)
+ $(ZIP_XE) -9 -r $(ZIPTARGET).zip $(ZIPPROGFILE2)
+ $(ZIP_XE) -9 -r $(ZIPTARGET).zip $(ZIPPROGFILE3)
+ $(ZIP_XE) -9 -r $(ZIPTARGET).zip $(ZIPPROGFILE4)
rem
rem Don't flag error if Win32s spooler file is missing.
rem This occurs when using MSVC++.
rem
- -$(ZIP_XE) -9 -r gs$(GS_VERSION)w32.zip $(ZIPPROGFILE5)
- $(ZIP_XE) -9 -r gs$(GS_VERSION)w32.zip $(ZIPPROGFILE6)
- $(ZIP_XE) -9 -r gs$(GS_VERSION)w32.zip $(ZIPPROGFILE7)
- $(ZIP_XE) -9 -r gs$(GS_VERSION)w32.zip $(ZIPPROGFILE8)
- $(ZIP_XE) -9 -r gs$(GS_VERSION)w32.zip $(ZIPPROGFILE9)
+ -$(ZIP_XE) -9 -r $(ZIPTARGET).zip $(ZIPPROGFILE5)
+ $(ZIP_XE) -9 -r $(ZIPTARGET).zip $(ZIPPROGFILE6)
+ $(ZIP_XE) -9 -r $(ZIPTARGET).zip $(ZIPPROGFILE7)
+ $(ZIP_XE) -9 -r $(ZIPTARGET).zip $(ZIPPROGFILE8)
+ $(ZIP_XE) -9 -r $(ZIPTARGET).zip $(ZIPPROGFILE9)
-del $(ZIPTEMPFILE)
-del $(SETUP_XE_NAME)
-del $(UNINSTALL_XE_NAME)
@@ -291,7 +300,7 @@
$(ECHOGS_XE) -a $(PSOBJ)about.txt See gs$(GS_DOT_VERSION)\doc\Commprod.htm regarding commercial distribution.
$(ECHOGS_XE) -w $(PSOBJ)dialog.txt This installs AFPL Ghostscript $(GS_DOT_VERSION).
$(ECHOGS_XE) -a $(PSOBJ)dialog.txt AFPL Ghostscript displays, prints and converts PostScript and PDF files.
- $(WINZIPSE_XE) ..\gs$(GS_VERSION)w32 @$(PSOBJ)setupgs.rsp
+ $(WINZIPSE_XE) ..\$(ZIPTARGET) @$(PSOBJ)setupgs.rsp
# Don't delete temporary files, because make continues
# before these files are used.
# -del $(ZIP_RSP)
gs64d.txt
(application/octet-stream, 3.3 KB)
Common subdirectories: doc/CVS and ../gs8.51/doc/CVS diff -u doc/Make.htm ../gs8.51/doc/Make.htm --- doc/Make.htm Fri Feb 11 21:17:30 2005 +++ ../gs8.51/doc/Make.htm Wed Feb 16 02:10:02 2005 @@ -51,6 +51,7 @@ <ul> <li><a href="#Borland_build">Borland/Inprise environment</a> <li><a href="#Microsoft_build">Microsoft environment</a> +<li><a href="#Microsoft_build_64">Microsoft environment 64-bit</a> <li><a href="#Self-extracting_executables">Making self-extracting executables</a> <li><a href="#Watcom_build">Watcom environment</a> <li><a href="#Cygwin32_build">Cygwin32 gcc</a> @@ -1339,7 +1340,70 @@ without stack checking. Don't change the setting <b><tt>TDEBUG=1</tt></b> in <b><tt>msvc32.mak</tt></b>. +<h3><a name="Microsoft_build_64"></a>Microsoft Environment for 64-bit</h3> +Building Ghostscript for 64-bit Windows (AMD64 processor) requires +Microsoft Visual Studio .NET 2005 beta on 64-bit Windows, +or Microsoft Visual Studio .NET 2003 and Windows Server 2003 DDK +on 32-bit Windows (cross-compile). +<p> +Compiling for 64-bit is similar to the +<a href="#Microsoft_build">Microsoft Environment</a> instructions above, +but with the addition of a WIN64 define. + +<h4><a name="Microsoft_64on32"></a>Cross compile on 32-bit Windows XP</h4> +Microsoft Visual Studio .NET 2003 is used for 32-bit compilation +of auxiliary programs used by the compile process, +while Windows Server 2003 Device Driver Kit (DDK) +is used for 64-bit compilation. +The DDK cross compilers for the IA64 and AMD64 processors, +however only AMD64 is supported by the makefile. +The DDK is not installed correctly by the setup program. +You need to copy <b><tt>msobj10.dll</tt></b> to the compiler +directory from a nearby directory. +<p> +To make ghostscript use +<blockquote><b><tt> + nmake -f src/msvc32.mak WIN64= +</tt></b></blockquote> +This will fail when it tries to run genconf.exe. +Move <b><tt>./obj/genconf.exe</tt></b> to 64-bit Windows, then run it +<blockquote><b><tt> + genconf arch.h +</tt></b></blockquote> +Move <b><tt>arch.h</tt></b> back to <b><tt>./obj/arch.h</tt></b>. +(Alternatively, use arch.h created by a 32-bit build and change +ARCH_ALIGN_PTR_MOD to 8, +ARCH_ALIGN_STRUCT_MOD to 16, +ARCH_SIZEOF_PTR to 8, +and ARCH_CACHE1_SIZE to 4194304). +Then restart the build +<blockquote><b><tt> + nmake -f src/msvc32.mak WIN64= +</tt></b></blockquote> + +<p> +You can also use Microsoft Visual Studio .NET 2005 beta +to do a similar cross compile, but you will need to +change the DEVSTUDIO path. + +<h4><a name="Microsoft_64on64"></a>Compile on 64-bit Windows XP</h4> +To make ghostscript use +<blockquote><b><tt> + nmake -f src/msvc32.mak WIN64= +</tt></b></blockquote> +The Microsoft Visual Studio .NET 2005 beta does not have +a "go live" licence. You are not permitted to distribute +executables created by this compiler. +<p> +The makefile currently uses the cross compiler (x86_amd64) +rather than the native compiler (amd64). +<p> +You can install Microsoft Visual Studio .NET 2003 on +64-bit Windows, but you can't install Windows Server 2003 DDK. +You may be able to copy the DDK directory <b><tt>c:\winddk</tt></b> +from a 32-bit system to a 64-bit system and compile GS. + <h4><a name="Self-extracting_executables"></a>Making self-extracting executables</h4> <p>