- add a new generator supplied by Roberto Fernandez which

greatly reduces memory use building font tables. tested arm,
sparc64, amd64, i386.

- enable CJK fonts on small mem arch, remove VMEM_WARNING.

- bump.
This commit is contained in:
sthen 2009-06-19 13:42:29 +00:00
parent b87a4a800d
commit 0368121d47
3 changed files with 168 additions and 11 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.2 2009/06/19 00:51:49 sthen Exp $
# $OpenBSD: Makefile,v 1.3 2009/06/19 13:42:29 sthen Exp $
COMMENT = graphic library, pdf parser, viewer and utilities
DISTNAME = fitz-0.0.20090616
PKGNAME = mupdf-0.0.20090616
PKGNAME = mupdf-0.0.20090616p0
CATEGORIES = textproc x11
@ -46,17 +46,11 @@ JAMFLAGS = \
-sTHIRDPARTYINC="`freetype-config --cflags` -I${LOCALBASE}/include" \
-sTHIRDPARTYLIB="`freetype-config --libs` -L${LOCALBASE}/lib"
# built-in CJK fonts and data files use way too much compiler
# memory, even with -O0.
.if (${MACHINE_ARCH} != "i386" && ${MACHINE_ARCH} != "sparc64" && \
${MACHINE_ARCH} != "amd64" && ${MACHINE_ARCH} != "hppa")
JAMFLAGS += -sDEFINES=NOCJK
.else
VMEM_WARNING = Yes
.endif
SEPARATE_BUILD = concurrent
pre-configure:
cp ${FILESDIR}/fontres.c ${WRKSRC}/
do-build:
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} jam ${JAMDEBUG} ${JAMFLAGS}

View File

@ -0,0 +1,95 @@
/*
* Copyright (c) 2009 Roberto Fernandez
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <string.h>
int
main(int argc, char **argv)
{
FILE *fi, *fo;
char name[256], *basename, *p;
int i;
long len;
if (argc < 3)
{
fprintf(stderr, "usage: %s output.s input.dat [input2.dat ...]\n",
argv[0]);
return 1;
}
fo = fopen(argv[1], "wb");
if (!fo)
{
fprintf(stderr, "%s: could not open output file \"%s\"\n",
argv[0], argv[1]);
return 1;
}
for (i = 2; i < argc; i++)
{
fi = fopen(argv[i], "rb");
if (!fi)
{
fprintf(stderr, "%s: could not open input file \"%s\"\n",
argv[0], argv[i]);
return 1;
}
basename = strrchr(argv[i], '/');
#ifdef WIN32
if (!basename)
basename = strrchr(argv[i], '\\');
#endif
if (basename)
basename++;
else
basename = argv[i];
#ifdef WIN32
strncpy(name, "_pdf_font_", 255);
strncat(name, basename, 245);
#else
strncpy(name, "pdf_font_", 255);
strncat(name, basename, 246);
#endif
p = name;
while (*p)
{
if ((*p == '.') || (*p == '\\') || (*p == '-'))
*p = '_';
p ++;
}
fseek(fi, 0, SEEK_END);
len = ftell(fi);
fprintf(fo, ".globl %s_buf\n", name);
fprintf(fo, ".balign 8\n");
fprintf(fo, "%s_buf:\n", name);
fprintf(fo, ".incbin \"%s\"\n\n", argv[i]);
fprintf(fo, ".globl %s_len\n", name);
fprintf(fo, ".balign 4\n");
fprintf(fo, "%s_len:\n", name);
fprintf(fo, ".long %d\n\n\n", len);
fclose(fi);
}
return 0;
}

View File

@ -0,0 +1,68 @@
$OpenBSD: patch-mupdf_Jamfile,v 1.1 2009/06/19 13:42:29 sthen Exp $
--- mupdf/Jamfile.orig Thu Jun 18 23:31:10 2009
+++ mupdf/Jamfile Fri Jun 19 14:07:32 2009
@@ -4,7 +4,7 @@
SubDir TOP mupdf ;
-Main fontdump : fontdump.c ;
+Main fontres : fontres.c ;
Main cmapdump : cmapdump.c ;
LinkLibraries cmapdump : libfitz ;
@@ -167,27 +167,27 @@ Library libcmaps : cmap_korean.c ;
SubDir TOP fonts ;
-GenFile font_misc.c : fontdump
+GenFile font_misc.s : fontres
Dingbats.cff
StandardSymL.cff
URWChanceryL-MediItal.cff
;
-GenFile font_mono.c : fontdump
+GenFile font_mono.s : fontres
NimbusMonL-Regu.cff
NimbusMonL-ReguObli.cff
NimbusMonL-Bold.cff
NimbusMonL-BoldObli.cff
;
-GenFile font_serif.c : fontdump
+GenFile font_serif.s : fontres
NimbusRomNo9L-Regu.cff
NimbusRomNo9L-ReguItal.cff
NimbusRomNo9L-Medi.cff
NimbusRomNo9L-MediItal.cff
;
-GenFile font_sans.c : fontdump
+GenFile font_sans.s : fontres
NimbusSanL-Bold.cff
NimbusSanL-BoldItal.cff
NimbusSanL-Regu.cff
@@ -195,17 +195,17 @@ GenFile font_sans.c : fontdump
;
Library libfonts :
- font_misc.c
- font_mono.c
- font_serif.c
- font_sans.c
+ font_misc.s
+ font_mono.s
+ font_serif.s
+ font_sans.s
;
if ! ( NOCJK in $(DEFINES) )
{
SubDir TOP fonts droid ;
- GenFile font_cjk.c : fontdump DroidSansFallback.ttf ;
- Library libfonts : font_cjk.c ;
+ GenFile font_cjk.s : fontres DroidSansFallback.ttf ;
+ Library libfonts : font_cjk.s ;
}