summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2008-09-03 19:12:00 +0200
committerTor Andersson <tor@ghostscript.com>2008-09-03 19:12:00 +0200
commitdfc2300866efe3c4e313de84f0aea5250b890236 (patch)
tree1c55f866d1200c6d6400e5fd96cddf7c24bbb21f
parent98a12532a6df4cf6f13d109e93e3e236bf3489a4 (diff)
downloadmupdf-dfc2300866efe3c4e313de84f0aea5250b890236.tar.xz
Revamp build system to compile in windows under both MSVC and MinGW.
-rw-r--r--Jamfile7
-rw-r--r--Jamrules226
-rw-r--r--apps/Jamfile120
-rw-r--r--apps/unix/x11pdf.c4
-rw-r--r--apps/windows/winmain.c24
-rw-r--r--apps/windows/winres.rc4
-rw-r--r--base/Jamfile1
-rw-r--r--fonts/Jamfile48
-rw-r--r--hexdump.c76
-rw-r--r--include/fitz/base_runtime.h4
-rw-r--r--include/fitz/base_sysdep.h7
11 files changed, 233 insertions, 288 deletions
diff --git a/Jamfile b/Jamfile
index 95dbd238..01c536ab 100644
--- a/Jamfile
+++ b/Jamfile
@@ -5,15 +5,10 @@
#
# http://public.perforce.com/public/jam/src/Jam.html
#
-# Set environment variable BUILD to one of: debug release profile
-#
-# jam -sBUILD=release
-#
SubDir TOP ;
-InstallFile $(BINDIR) : PUBLIC ;
-InstallFile $(BINDIR) : CHANGES ;
+Main hexdump : hexdump.c ;
SubInclude TOP base ;
SubInclude TOP stream ;
diff --git a/Jamrules b/Jamrules
index 6544878a..1308e75a 100644
--- a/Jamrules
+++ b/Jamrules
@@ -1,190 +1,112 @@
# -------------------------------------------------------------------------
#
-# Jamrules -- the build flags for Fitz and GhostPDF
-# This file is sourced by Jamfile when making
-# Put all configuration stuff here
+# Jamrules -- the build flags for Fitz and MuPDF.
+# This file is sourced by Jamfile when building.
+# Put all system configuration stuff here.
#
-OPTIM = ; # disable jam's built-in optimization flags
-if $(OS) = MINGW
-{
- FREETYPECC ?= -Ic:/msys/1.0/local/include -Ic:/msys/1.0/local/include/freetype2 ;
- FREETYPELD ?= -Lc:/msys/1.0/local/lib -lfreetype ;
-}
+HDRS = [ FDirName $(TOP) include ] ;
-FREETYPECC ?= "`freetype-config --cflags`" ;
-FREETYPELD ?= "`freetype-config --libs`" ;
+ALL_LOCATE_TARGET = [ FDirName $(TOP) build $(BUILD) ] ;
-# Optional modules:
+HAVE_JBIG2DEC ?= yes ; # set to "yes" to include JBIG2 support
+HAVE_JASPER ?= no ; # set to "yes" to include JPEG2000 support
-HAVE_JBIG2DEC ?= no ;
-HAVE_JASPER ?= no ;
+BUILD_X11APP ?= no ; # set to "yes" to build unix/x11 viewer
+BUILD_WINAPP ?= no ; # set to "yes" to build windows viewer
+BUILD_PLUGIN ?= no ; # set to "yes" to build mozilla plugin
# -------------------------------------------------------------------------
-# Default optimize/profile/debug compiler/linker switches
-# Basic system should be mostly SUSv3 compliant
-# These are good for GCC
+CCFLAGS ?= "`freetype-config --cflags`" -Wall -std=c99 -DHAVE_C99 ;
+LINKFLAGS ?= "`freetype-config --libs`" ;
+LINKLIBS ?= -lfreetype -ljpeg -lz -lm ;
-# FLAG_CCALL = -Wall -D_XOPEN_SOURCE=600 $(FREETYPECC) ;
-FLAG_CCALL = -Wall $(FREETYPECC) ;
-FLAG_CCDEBUG = -g ;
-FLAG_CCRELEASE = -O3 ;
-FLAG_CCPROFILE = -g -pg ;
-FLAG_LDPROFILE = -pg ;
+if $(JAM_TOOLSET) = MINGW
+{
+ BUILD_WINAPP = yes ;
+ BUILD_PLUGIN = yes ;
+ CCFLAGS =
+ -Ic:/local/include -Wall -std=c99 -DHAVE_C99 -DWIN32 ;
+ LINKFLAGS = -Lc:/local/lib ;
+ LINKLIBS = -lfreetype -ljpeg -lz -ljbig2dec ;
+ WINLIBS = -lgdi32 -lcomdlg32 -luser32 -ladvapi32 -lshell32 ;
+}
-# Now it gets hairy...
+if $(JAM_TOOLSET) = VISUALC
+{
+ BUILD_WINAPP = yes ;
+ CCFLAGS = /Ic:/local/include /DWIN32 ;
+ LINKFLAGS = /LIBPATH:c:/local/lib ;
+ LINKLIBS = freetype.lib jpeg.lib z.lib jbig2dec.lib ;
+ WINLIBS = gdi32.lib comdlg32.lib user32.lib advapi32.lib shell32.lib ;
+ NEED_GETTIMEOFDAY = yes ;
+}
switch $(OS)
{
- case LINUX :
- HAVE_X11 = yes ;
- NEED_STRLCPY = yes ;
- NEED_STRLCAT = yes ;
- FLAG_CCALL += -std=gnu99 -DHAVE_C99 ;
- FLAG_LDALL += -L/opt/local/lib -L/usr/X11R6/lib ;
-
- switch $(CC)-$(OSPLAT)
- {
- case icc-X86 :
- FLAG_CCRELEASE = -DARCH_X86 -O3 -ip -tpp6 -xM ;
- FLAG_CCPROFILE = -g -qp ;
- case gcc-X86 :
- # add -msse -msse2 when such functions exist...
- FLAG_CCRELEASE = -DARCH_X86 -O3 -g -march=k8 -mmmx -std=gnu99 -ftree-vectorize -ftree-vectorizer-verbose=2 ;
- }
-
- case MACOSX :
- FLAG_LDALL += -L/opt/local/lib -L/usr/X11R6/lib ;
- FLAG_CCALL += -I/opt/local/include -I/usr/X11R6/include -std=gnu99 -DHAVE_C99 -Wno-pointer-sign ;
- # FLAG_CCRELEASE = -DARCH_PPC -faltivec -fast ; # not true on intel macs
- FLAG_CCRELEASE = -fast ;
-
- case MINGW :
- NEED_GETOPT = yes ;
- NEED_STRSEP = yes ;
- NEED_STRLCAT = yes ;
- NEED_STRLCPY = yes ;
- FLAG_CCALL += -std=gnu99 -DHAVE_C99 -DWIN32 ;
- NOARSCAN = yes ;
-
- case SOLARIS :
- HAVE_X11 = yes ;
- NEED_STRSEP = yes ;
- FLAG_CCALL += -std=c89 ;
- FLAG_CCRELEASE += -DARCH_SPARC ;
-
- # Additional platforms go here
-
- case * :
- Echo "OS '$(OS)' not known by build system." ;
- Echo "If you get errors, please edit Jamrules." ;
- FLAG_CCALL += -std=c89 ;
+ case LINUX :
+ BUILD_X11APP = yes ;
+ X11LIBS = -lX11 -lXext ;
+ NEED_STRLCPY = yes ;
+ NEED_STRLCAT = yes ;
+
+ case MACOSX :
+ BUILD_X11APP = yes ;
+ CCFLAGS += -I/opt/local/include -I/usr/X11R6/include ;
+ LINKFLAGS += -L/opt/local/lib -L/usr/X11R6/lib ;
+ X11LIBS = -lX11 -lXext ;
+
+ case NT :
+ NEED_GETOPT = yes ;
+ NEED_STRSEP = yes ;
+ NEED_STRLCAT = yes ;
+ NEED_STRLCPY = yes ;
+ NEED_MATH = yes ;
+
+ case * :
+ Echo "OS '$(OS)' not known by build system." ;
+ Echo "If you get errors, please edit Jamrules." ;
}
# -------------------------------------------------------------------------
-#
-# Switch on BUILD type (profile, debug or release)
-#
-BUILD ?= debug ;
+if $(HAVE_JASPER) = yes { DEFINES += HAVE_JASPER ; }
+if $(HAVE_JBIG2DEC) = yes { DEFINES += HAVE_JBIG2DEC ; }
-switch $(BUILD)
-{
- case debug :
- Echo "Building DEBUG target" ;
- CCFLAGS = $(FLAG_CCALL) $(FLAG_CCDEBUG) ;
- LINKFLAGS = $(FLAG_LDALL) $(FLAG_LDDEBUG) ;
- case release :
- Echo "Building RELEASE target" ;
- CCFLAGS = $(FLAG_CCALL) $(FLAG_CCRELEASE) ;
- LINKFLAGS = $(FLAG_LDALL) $(FLAG_LDRELEASE) ;
- case profile :
- Echo "Building PROFILE target" ;
- CCFLAGS = $(FLAG_CCALL) $(FLAG_CCPROFILE) ;
- LINKFLAGS = $(FLAG_LDALL) $(FLAG_LDPROFILE) ;
- case * :
- Exit "Unknown BUILD target:" $(BUILD) ;
-}
+if $(NEED_GETOPT) = yes { DEFINES += NEED_GETOPT ; }
+if $(NEED_STRLCAT) = yes { DEFINES += NEED_STRLCAT ; }
+if $(NEED_STRLCPY) = yes { DEFINES += NEED_STRLCPY ; }
+if $(NEED_STRSEP) = yes { DEFINES += NEED_STRSEP ; }
+if $(NEED_MATH) = yes { DEFINES += NEED_MATH ; }
# -------------------------------------------------------------------------
#
-# Fitz specific rules
+# WindRes rule for compiling the windows viewer and plugin
#
-ALL_LOCATE_TARGET = [ FDirName $(TOP) build $(BUILD) ] ;
-
-HDRS = [ FDirName $(TOP) include ] ;
-
-BINDIR = [ FDirName $(TOP) dist ] ;
-
-LINKLIBS = $(FREETYPELD) -ljpeg -lz -lm ;
-FITZLIBS =
- libmupdf libfonts
- libraster
- libworld
- libstream
- libbase
-;
-
-if $(HAVE_JASPER) = yes
-{
- DEFINES += HAVE_JASPER ;
- LINKLIBS += -ljasper ;
-}
-
-if $(HAVE_JBIG2DEC) = yes
-{
- DEFINES += HAVE_JBIG2DEC ;
- LINKLIBS += -ljbig2dec ;
-}
-
-if $(NEED_GETOPT) = yes { DEFINES += NEED_GETOPT ; }
-if $(NEED_STRLCAT) = yes { DEFINES += NEED_STRLCAT ; }
-if $(NEED_STRLCPY) = yes { DEFINES += NEED_STRLCPY ; }
-if $(NEED_STRSEP) = yes { DEFINES += NEED_STRSEP ; }
-
rule UserObject
{
- switch $(>)
- {
- case *.rc :
- WindRes $(<) : $(>) ;
-
- case *.cff :
- Cc $(<) : $(<:S=.c) ;
- HexDump $(<:S=.c) : $(>) ;
-
- case * :
- Echo "unknown suffix on" $(>) ;
- }
+ switch $(>)
+ {
+ case *.rc : WindRes $(<) : $(>) ;
+ case * : Echo "unknown suffix on" $(>) ;
+ }
}
-rule HexDump
+rule WindRes
{
- Depends $(<) : $(>) ;
- MakeLocate $(<) : $(LOCATE_SOURCE) ;
- Clean clean : $(<) ;
+ Depends $(<) : $(>) ;
+ Clean clean : $(<) ;
}
-rule WindRes
+if $(JAM_TOOLSET) = MINGW
{
- Depends $(<) : $(>) ;
- Clean clean : $(<) ;
+ actions WindRes { windres -i $(>) -o $(<) --include-dir=$(>:D) }
}
-actions HexDump { xxd -i $(>) | sed -e 's/unsigned/const unsigned/' > $(<) }
-actions WindRes { windres -i $(>) -o $(<) --include-dir=$(>:D) }
-
-rule XCopy
+if $(JAM_TOOLSET) = VISUALC
{
- for i in $(<)
- {
- local d = [ FDirName $(ALL_LOCATE_TARGET) $(i:D) ] ;
- LOCATE on $(i:G=xcopy) = $(ALL_LOCATE_TARGET) ;
- Depends $(i:G=xcopy) : $(d:G=dir) ;
- MkDir $(d:G=dir) ;
- File $(i:G=xcopy) : $(i) ;
- }
+ actions WindRes { rc /fo $(<) $(>) }
}
diff --git a/apps/Jamfile b/apps/Jamfile
index b3fffb3a..9c9af761 100644
--- a/apps/Jamfile
+++ b/apps/Jamfile
@@ -1,113 +1,37 @@
-# --------------------------------------------------------------------------
#
-# Build simple portable apps
-#
-
-SubDir TOP apps ;
-
-APPLIST =
- pdftool
- ;
-for APP in $(APPLIST)
-{
- Main $(APP) : $(APP).c ;
- LinkLibraries $(APP) : $(FITZLIBS) ;
- InstallBin $(BINDIR) : $(APP)$(SUFEXE) ;
-}
+FITZLIBS = libmupdf libbase libstream libworld libraster libfonts ;
-# --------------------------------------------------------------------------
-#
-# Build non-portable GUI frontend apps
-#
+SubDir TOP apps ;
+Main pdftool : pdftool.c ;
+LinkLibraries pdftool : $(FITZLIBS) ;
SubDir TOP apps common ;
+Library libpdfapp : pdfapp.c ;
-Library libpdfapp :
- pdfapp.c
- ;
-
-if $(OS) = MINGW
+if $(BUILD_WINAPP) = yes
{
- SubDir TOP apps windows ;
-
- Main apparition :
- winmain.c
- winres.rc
- ;
-
- WINLIBS = -lgdi32 -lcomdlg32 ;
- if $(BUILD) = release { WINLIBS += -mwindows ; }
-
- LinkLibraries apparition : libpdfapp $(FITZLIBS) ;
-
- LINKLIBS on apparition$(SUFEXE) = $(LINKLIBS) $(WINLIBS) ;
-
- InstallBin $(BINDIR) : apparition$(SUFEXE) ;
+ SubDir TOP apps windows ;
+ Main pdfview : winmain.c winres.rc ;
+ LinkLibraries pdfview : libpdfapp $(FITZLIBS) ;
+ LINKLIBS on pdfview$(SUFEXE) = $(LINKLIBS) $(WINLIBS) ;
}
-if $(HAVE_X11) = yes
+if $(BUILD_X11APP) = yes
{
- SubDir TOP apps unix ;
- Main apparition : x11pdf.c ximage.c ;
- LinkLibraries apparition : libpdfapp $(FITZLIBS) ;
- LINKLIBS on apparition$(SUFEXE) = $(LINKLIBS) -lX11 -lXext ;
+ SubDir TOP apps unix ;
+ Main pdfview : x11pdf.c ximage.c ;
+ LinkLibraries pdfview : libpdfapp $(FITZLIBS) ;
+ LINKLIBS on pdfview$(SUFEXE) = $(LINKLIBS) $(X11LIBS) ;
}
-if $(HAVE_GLX) = yes
+if $(BUILD_PLUGIN) = yes
{
- SubDir TOP apps unix ;
- Main glxview : glxpdf.c ;
- LinkLibraries glxview : libpdfapp $(FITZLIBS) ;
- LINKLIBS on glxview$(SUFEXE) = $(LINKLIBS) -lX11 -lGL ;
-}
-
-if $(OS) = noMACOSX
-{
- SubDir TOP apps macosx ;
-
- MACBUNDLE = FzView.app ;
-
- XCopy
- $(MACBUNDLE)/Contents/Info.plist
- $(MACBUNDLE)/Contents/PkgInfo
- ;
- XCopy
- $(MACBUNDLE)/Contents/Resources/English.lproj/InfoPlist.strings
- $(MACBUNDLE)/Contents/Resources/English.lproj/main.nib/classes.nib
- $(MACBUNDLE)/Contents/Resources/English.lproj/main.nib/info.nib
- $(MACBUNDLE)/Contents/Resources/English.lproj/main.nib/objects.xib
- $(MACBUNDLE)/Contents/Resources/macpdf.icns
- ;
-
- MACPDF = $(MACBUNDLE)/Contents/MacOS/fzview ;
- MkDir $(ALL_LOCATE_TARGET)/$(MACPDF:D) ;
- Depends $(MACPDF) : $(ALL_LOCATE_TARGET)/$(MACPDF:D) ;
- Main $(MACPDF) : macpdf.c ;
- LinkLibraries $(MACPDF) : libpdfapp $(FITZLIBS) ;
- LINKLIBS on $(MACPDF) = $(LINKLIBS) -framework Carbon ;
-}
-
-# --------------------------------------------------------------------------
-#
-# Mozilla plugins
-#
-
-SubDir TOP apps mozilla ;
-
-if $(OS) = MINGW
-{
- SUFEXE on npmupdf.dll = ;
- LINKFLAGS on npmupdf.dll = -shared -Wl,--kill-at ;
- LINKLIBS on npmupdf.dll = $(LINKLIBS) -lgdi32 ;
-
- Main npmupdf.dll :
- npwin.c
- moz_winres.rc
- moz_main.c
- ;
-
- LinkLibraries npmupdf.dll : $(FITZLIBS) ;
- InstallBin $(BINDIR) : npmupdf.dll ;
+ SubDir TOP apps mozilla ;
+ SUFEXE on npmupdf.dll = ;
+ LINKFLAGS on npmupdf.dll = $(LINKFLAGS) -shared -Wl,--kill-at ;
+ LINKLIBS on npmupdf.dll = $(LINKLIBS) -lgdi32 ;
+ Main npmupdf.dll : npwin.c moz_winres.rc moz_main.c ;
+ LinkLibraries npmupdf.dll : $(FITZLIBS) ;
}
diff --git a/apps/unix/x11pdf.c b/apps/unix/x11pdf.c
index d9f0d036..c7f2e31b 100644
--- a/apps/unix/x11pdf.c
+++ b/apps/unix/x11pdf.c
@@ -54,7 +54,7 @@ static pdfapp_t gapp;
void winwarn(pdfapp_t *app, char *msg)
{
- fprintf(stderr, "apparition: %s\n", msg);
+ fprintf(stderr, "pdfview: %s\n", msg);
}
void winerror(pdfapp_t *app, fz_error *error)
@@ -432,7 +432,7 @@ void onmouse(int x, int y, int btn, int modifiers, int state)
void usage(void)
{
- fprintf(stderr, "usage: apparition [-d password] [-z zoom] [-p pagenumber] file.pdf\n");
+ fprintf(stderr, "usage: pdfview [-d password] [-z zoom] [-p pagenumber] file.pdf\n");
exit(1);
}
diff --git a/apps/windows/winmain.c b/apps/windows/winmain.c
index 5307ed3b..b5fd2a67 100644
--- a/apps/windows/winmain.c
+++ b/apps/windows/winmain.c
@@ -27,7 +27,7 @@ static int justcopied = 0;
static pdfapp_t gapp;
/*
- * Associate Apparition with PDF files.
+ * Associate PDFView with PDF files.
*/
void associate(char *argv0)
@@ -44,22 +44,22 @@ void associate(char *argv0)
KEY_WRITE, NULL, &key, &disp))
return;
- if (RegSetValueEx(key, "", 0, REG_SZ, "Apparition", strlen("Apparition")+1))
+ if (RegSetValueEx(key, "", 0, REG_SZ, "MuPDF", strlen("MuPDF")+1))
return;
RegCloseKey(key);
- /* HKEY_CLASSES_ROOT\Apparition */
+ /* HKEY_CLASSES_ROOT\MuPDF */
if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
- "Apparition", 0, NULL, REG_OPTION_NON_VOLATILE,
+ "MuPDF", 0, NULL, REG_OPTION_NON_VOLATILE,
KEY_WRITE, NULL, &key, &disp))
return;
if (RegSetValueEx(key, "", 0, REG_SZ, name, strlen(name)+1))
return;
- /* HKEY_CLASSES_ROOT\Apparition\DefaultIcon */
+ /* HKEY_CLASSES_ROOT\MuPDF\DefaultIcon */
if (RegCreateKeyEx(key,
"DefaultIcon", 0, NULL, REG_OPTION_NON_VOLATILE,
@@ -72,7 +72,7 @@ void associate(char *argv0)
RegCloseKey(kicon);
- /* HKEY_CLASSES_ROOT\Apparition\Shell\Open\Command */
+ /* HKEY_CLASSES_ROOT\MuPDF\Shell\Open\Command */
if (RegCreateKeyEx(key,
"shell", 0, NULL, REG_OPTION_NON_VOLATILE,
@@ -104,12 +104,12 @@ void associate(char *argv0)
void winwarn(pdfapp_t *app, char *msg)
{
- MessageBoxA(hwndframe, msg, "Apparition: Warning", MB_ICONWARNING);
+ MessageBoxA(hwndframe, msg, "MuPDF: Warning", MB_ICONWARNING);
}
void winerror(pdfapp_t *app, fz_error *error)
{
- MessageBoxA(hwndframe, error->msg, "Apparition: Error", MB_ICONERROR);
+ MessageBoxA(hwndframe, error->msg, "MuPDF: Error", MB_ICONERROR);
exit(1);
}
@@ -123,7 +123,7 @@ int winfilename(char *buf, int len)
ofn.lpstrFile = buf;
ofn.nMaxFile = len;
ofn.lpstrInitialDir = NULL;
- ofn.lpstrTitle = "Apparition: Open PDF file";
+ ofn.lpstrTitle = "MuPDF: Open PDF file";
ofn.lpstrFilter = "PDF Files (*.pdf)\0*.pdf\0All Files\0*\0\0";
ofn.Flags = OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;
return GetOpenFileName(&ofn);
@@ -261,7 +261,7 @@ dlogaboutproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
case WM_INITDIALOG:
SetDlgItemTextA(hwnd, 0x10, gapp.filename);
- SetDlgItemTextA(hwnd, 2, "Apparition is Copyright (C) 2006 artofcode, LLC");
+ SetDlgItemTextA(hwnd, 2, "MuPDF is Copyright (C) 2006-2008 artofcode, LLC");
SetDlgItemTextA(hwnd, 3, pdfapp_usage(&gapp));
return TRUE;
case WM_COMMAND:
@@ -360,11 +360,11 @@ void winopen()
hdc = NULL;
- SetWindowTextA(hwndframe, "Apparition");
+ SetWindowTextA(hwndframe, "MuPDF");
menu = GetSystemMenu(hwndframe, 0);
AppendMenu(menu, MF_SEPARATOR, 0, NULL);
- AppendMenu(menu, MF_STRING, ID_ABOUT, "About Apparition...");
+ AppendMenu(menu, MF_STRING, ID_ABOUT, "About MuPDF...");
AppendMenu(menu, MF_STRING, ID_DOCINFO, "Document Properties...");
SetCursor(arrowcurs);
diff --git a/apps/windows/winres.rc b/apps/windows/winres.rc
index af941f03..3a5ae390 100644
--- a/apps/windows/winres.rc
+++ b/apps/windows/winres.rc
@@ -4,7 +4,7 @@ IDI_ICONDOC ICON "gsdoc.ico"
IDD_DLOGPASS DIALOG 50, 50, 204, 60
//STYLE DS_MODALFRAME | WS_POPUP
STYLE 128 | 0x80000000
-CAPTION " Apparition: Password "
+CAPTION " MuPDF: Password "
FONT 8, "MS Shell Dlg"
BEGIN
EDITTEXT 3, 57,20,140,12, 32
@@ -52,7 +52,7 @@ END
IDD_DLOGABOUT DIALOG 50, 50, 200, 210
STYLE 128 | 0x80000000
-CAPTION " About Apparition "
+CAPTION " About MuPDF "
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "Okay", 1, 200-10-50,210-7-14,50,14, 0x50010001
diff --git a/base/Jamfile b/base/Jamfile
index 91bde812..95470425 100644
--- a/base/Jamfile
+++ b/base/Jamfile
@@ -15,4 +15,5 @@ if $(NEED_GETOPT) = yes { Library libbase : util_getopt.c ; }
if $(NEED_STRLCAT) = yes { Library libbase : util_strlcat.c ; }
if $(NEED_STRLCPY) = yes { Library libbase : util_strlcpy.c ; }
if $(NEED_STRSEP) = yes { Library libbase : util_strsep.c ; }
+if $(NEED_GETTIMEOFDAY) = yes { Library libbase : util_gettimeofday.c ; }
diff --git a/fonts/Jamfile b/fonts/Jamfile
index d443b93d..2e0067b5 100644
--- a/fonts/Jamfile
+++ b/fonts/Jamfile
@@ -1,20 +1,36 @@
SubDir TOP fonts ;
+GenFile font_dingbats.c : hexdump Dingbats.cff ;
+GenFile font_symbol.c : hexdump StandardSymL.cff ;
+GenFile font_script.c : hexdump URWChanceryL-MediItal.cff ;
+GenFile font_mono_r.c : hexdump NimbusMonL-Regu.cff ;
+GenFile font_mono_i.c : hexdump NimbusMonL-ReguObli.cff ;
+GenFile font_mono_b.c : hexdump NimbusMonL-Bold.cff ;
+GenFile font_mono_bi.c : hexdump NimbusMonL-BoldObli.cff ;
+GenFile font_serif_r.c : hexdump NimbusRomNo9L-Regu.cff ;
+GenFile font_serif_ri.c : hexdump NimbusRomNo9L-ReguItal.cff ;
+GenFile font_serif_b.c : hexdump NimbusRomNo9L-Medi.cff ;
+GenFile font_serif_bi.c : hexdump NimbusRomNo9L-MediItal.cff ;
+GenFile font_sans_b.c : hexdump NimbusSanL-Bold.cff ;
+GenFile font_sans_bi.c : hexdump NimbusSanL-BoldItal.cff ;
+GenFile font_sans_r.c : hexdump NimbusSanL-Regu.cff ;
+GenFile font_sans_ri.c : hexdump NimbusSanL-ReguItal.cff ;
+
Library libfonts :
- Dingbats.cff
- StandardSymL.cff
- URWChanceryL-MediItal.cff
- NimbusMonL-Bold.cff
- NimbusMonL-BoldObli.cff
- NimbusMonL-Regu.cff
- NimbusMonL-ReguObli.cff
- NimbusRomNo9L-Medi.cff
- NimbusRomNo9L-MediItal.cff
- NimbusRomNo9L-Regu.cff
- NimbusRomNo9L-ReguItal.cff
- NimbusSanL-Bold.cff
- NimbusSanL-BoldItal.cff
- NimbusSanL-Regu.cff
- NimbusSanL-ReguItal.cff
- ;
+ font_dingbats.c
+ font_symbol.c
+ font_script.c
+ font_mono_r.c
+ font_mono_i.c
+ font_mono_b.c
+ font_mono_bi.c
+ font_serif_r.c
+ font_serif_ri.c
+ font_serif_b.c
+ font_serif_bi.c
+ font_sans_b.c
+ font_sans_bi.c
+ font_sans_r.c
+ font_sans_ri.c
+ ;
diff --git a/hexdump.c b/hexdump.c
new file mode 100644
index 00000000..5ad4452b
--- /dev/null
+++ b/hexdump.c
@@ -0,0 +1,76 @@
+/* hexdump.c -- an "xxd -i" workalike */
+
+#include <stdio.h>
+
+int
+hexdump(FILE *fo, FILE *fi)
+{
+ int c, n;
+
+ n = 0;
+ c = fgetc(fi);
+ while (c != -1)
+ {
+ fprintf(fo, "0x%02x,", c);
+ if (n % 16 == 15)
+ fprintf(fo, "\n");
+ c = fgetc(fi);
+ n ++;
+ }
+
+ return n;
+}
+
+int
+main(int argc, char **argv)
+{
+ FILE *fo;
+ FILE *fi;
+ unsigned char name[256];
+ unsigned char *p;
+ int i, n, len;
+
+ if (argc < 3)
+ {
+ fprintf(stderr, "usage: hexdump output.c input.dat\n");
+ return 1;
+ }
+
+ fo = fopen(argv[1], "wb");
+ if (!fo)
+ {
+ fprintf(stderr, "hexdump: could not open output file\n");
+ return 1;
+ }
+
+ for (i = 2; i < argc; i++)
+ {
+ fi = fopen(argv[i], "rb");
+ if (!fi)
+ {
+ fprintf(stderr, "hexdump: could not open input file\n");
+ return 1;
+ }
+
+ strcpy(name, argv[i]);
+ p = name;
+ while (*p)
+ {
+ if ((*p == '/') || (*p == '.') || (*p == '\\') || (*p == '-'))
+ *p = '_';
+ p ++;
+ }
+
+ fprintf(fo, "const unsigned char %s[] = {\n", name);
+
+ len = hexdump(fo, fi);
+
+ fprintf(fo, "};\n");
+ fprintf(fo, "const unsigned int %s_len = %d;\n", name, len);
+
+ fclose(fi);
+ }
+
+ return 0;
+}
+
diff --git a/include/fitz/base_runtime.h b/include/fitz/base_runtime.h
index 0bb00292..fc7ad920 100644
--- a/include/fitz/base_runtime.h
+++ b/include/fitz/base_runtime.h
@@ -64,6 +64,10 @@ void fz_printerror(fz_error *eo);
void fz_droperror(fz_error *eo);
void fz_warn(char *fmt, ...) __printflike(1,2);
+#ifdef WIN32
+#define __func__ __FUNCTION__
+#endif
+
#define fz_throw(...) fz_throwimp(nil, __func__, __FILE__, __LINE__, __VA_ARGS__)
#define fz_rethrow(cause, ...) fz_throwimp(cause, __func__, __FILE__, __LINE__, __VA_ARGS__)
#define fz_okay ((fz_error*)0)
diff --git a/include/fitz/base_sysdep.h b/include/fitz/base_sysdep.h
index c3b7e0ff..4e1e250a 100644
--- a/include/fitz/base_sysdep.h
+++ b/include/fitz/base_sysdep.h
@@ -39,6 +39,10 @@
#define va_copy(a,b) (a) = (b)
#endif
+#ifndef R_OK
+#define R_OK 4
+#endif
+
#ifndef O_BINARY
#define O_BINARY 0
#endif
@@ -65,6 +69,9 @@
#define M_2_SQRTPI 1.12837916709551257390
#define M_SQRT2 1.41421356237309504880
#define M_SQRT_2 0.707106781186547524401
+#ifndef isnan
+#define isnan _isnan
+#endif
#endif
#ifdef NEED_STRLCPY