Skip to content

Commit

Permalink
update mupdf
Browse files Browse the repository at this point in the history
  • Loading branch information
kjk committed Oct 31, 2023
1 parent aea88c8 commit 79bfd4d
Show file tree
Hide file tree
Showing 43 changed files with 2,701 additions and 6,780 deletions.
13 changes: 13 additions & 0 deletions mupdf/Makerules
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ ifeq ($(tofu_cjk_lang),yes)
XCFLAGS += -DTOFU_CJK_LANG
endif

ifeq ($(archive),yes)
build_suffix := $(build_suffix)-archive
XCFLAGS += -DHAVE_LIBARCHIVE
HAVE_LIBARCHIVE := yes
endif

# System specific features

ifeq ($(findstring -fembed-bitcode,$(XCFLAGS)),)
Expand Down Expand Up @@ -159,6 +165,7 @@ SYS_OPENJPEG_LIBS := -lopenjp2
SYS_ZLIB_LIBS := -lz
SYS_TESSERACT_LIBS := -ltesseract
SYS_LEPTONICA_LIBS := -llept
SYS_LIBARCHIVE_LIBS := -larchive

ifneq "$(CLUSTER)" ""
CFLAGS += -DCLUSTER
Expand Down Expand Up @@ -244,6 +251,12 @@ else ifeq ($(LINUX_OR_OPENBSD),yes)
SYS_TESSERACT_LIBS := $(shell pkg-config --libs tesseract)
endif

HAVE_SYS_LIBARCHIVE := $(shell pkg-config --exists 'libarchive' && echo yes)
ifeq ($(HAVE_SYS_LIBARCHIVE),yes)
SYS_LIBARCHIVE_CFLAGS := $(shell pkg-config --cflags libarchive)
SYS_LIBARCHIVE_LIBS := $(shell pkg-config --libs libarchive)
endif

HAVE_SYS_CURL := $(shell pkg-config --exists libcurl && echo yes)
ifeq ($(HAVE_SYS_CURL),yes)
SYS_CURL_CFLAGS := $(shell pkg-config --cflags libcurl)
Expand Down
20 changes: 20 additions & 0 deletions mupdf/Makethird
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ ifeq ($(USE_SYSTEM_LIBS),yes)
USE_SYSTEM_TESSERACT := yes
endif

# Unlike the other libraries, we default to using system
# libarchive if it is requested - because we offer no
# packaged version.
USE_SYSTEM_LIBARCHIVE ?= yes

ifeq ($(OS),MACOS)
USE_SYSTEM_GLUT := yes
endif
Expand Down Expand Up @@ -278,3 +283,18 @@ thirdparty/extract/src/odt_template.c: thirdparty/extract/src/template.odt third
@touch $@

generate: thirdparty/extract/src/docx_template.c

# --- LIBARCHIVE ---

ifeq ($(HAVE_LIBARCHIVE),yes)
THIRD_CFLAGS += -DHAVE_LIBARCHIVE
ifeq ($(USE_SYSTEM_LIBARCHIVE),yes)
THIRD_CFLAGS += $(SYS_LIBARCHIVE_CFLAGS)
THIRD_LIBS += $(SYS_LIBARCHIVE_LIBS) -lstdc++
else
THIRD_CFLAGS += $(LIBARCHIVE_CFLAGS)
THIRD_LIBS += $(LIBARCHIVE_LIBS)
THIRD_SRC += $(LIBARCHIVE_SRC)
THIRD_SRC += $(LIBARCHIVE_SRC)
endif
endif
37 changes: 32 additions & 5 deletions mupdf/include/mupdf/fitz/archive.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,23 @@ fz_buffer *fz_try_read_archive_entry(fz_context *ctx, fz_archive *arch, const ch
*/

/**
Detect if stream object is a tar achieve.
Detect if stream object is a tar archive.
Assumes that the stream object is seekable.
*/
int fz_is_tar_archive(fz_context *ctx, fz_stream *file);

/**
Detect if stream object is an archive supported by libarchive.
Assumes that the stream object is seekable.
*/
int fz_is_libarchive_archive(fz_context *ctx, fz_stream *file);

/**
Open a tar archive file.
An exception is throw if the file is not a tar archive as
An exception is thrown if the file is not a tar archive as
indicated by the presence of a tar signature.
filename: a path to a tar archive file as it would be given to
Expand All @@ -217,12 +224,32 @@ fz_archive *fz_open_tar_archive(fz_context *ctx, const char *filename);
Open an archive using a seekable stream object rather than
opening a file or directory on disk.
An exception is throw if the stream is not a tar archive as
An exception is thrown if the stream is not a tar archive as
indicated by the presence of a tar signature.
*/
fz_archive *fz_open_tar_archive_with_stream(fz_context *ctx, fz_stream *file);

/**
Open an archive using libarchive.
An exception is thrown if the file is not supported by libarchive.
filename: a path to an archive file as it would be given to
open(2).
*/
fz_archive *fz_open_libarchive_archive(fz_context *ctx, const char *filename);

/**
Open an archive using libarchive.
Open an archive using a seekable stream object rather than
opening a file or directory on disk.
An exception is thrown if the stream is not supported by libarchive.
*/
fz_archive *fz_open_libarchive_archive_with_stream(fz_context *ctx, fz_stream *file);

/**
fz_archive: zip implementation
*/
Expand All @@ -237,7 +264,7 @@ int fz_is_zip_archive(fz_context *ctx, fz_stream *file);
/**
Open a zip archive file.
An exception is throw if the file is not a zip archive as
An exception is thrown if the file is not a zip archive as
indicated by the presence of a zip signature.
filename: a path to a zip archive file as it would be given to
Expand All @@ -251,7 +278,7 @@ fz_archive *fz_open_zip_archive(fz_context *ctx, const char *path);
Open an archive using a seekable stream object rather than
opening a file or directory on disk.
An exception is throw if the stream is not a zip archive as
An exception is thrown if the stream is not a zip archive as
indicated by the presence of a zip signature.
*/
Expand Down
4 changes: 2 additions & 2 deletions mupdf/platform/gl/gl-winres.rc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
IDI_ICONAPP ICON "mupdf.ico"
GLUT_ICON ICON "mupdf.ico"
IDI_ICONAPP ICON "mupdf.ico"
GLUT_ICON ICON "mupdf.ico"
2 changes: 1 addition & 1 deletion mupdf/platform/win32/README.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
This MSVC project needs the thirdparty sources to be in place.
This MSVC project needs the thirdparty sources to be in place.
104 changes: 52 additions & 52 deletions mupdf/platform/win32/bin2coff.rules
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<VisualStudioToolFile
Name="bin2coff"
Version="8.00"
>
<Rules>
<CustomBuildRule
Name="bin2coff (ttf)"
DisplayName="bin2coff (ttf)"
CommandLine="Release\bin2coff.exe &quot;$(InputPath)&quot; &quot;$(IntDir)\$(InputName)_ttf.obj&quot; _binary_$(InputName)_ttf $(PlatformName)"
Outputs="$(IntDir)\$(InputName)_ttf.obj"
FileExtensions="*.ttf"
ExecutionDescription="Embedding TTF"
>
<Properties>
</Properties>
</CustomBuildRule>
<CustomBuildRule
Name="bin2coff (otf)"
DisplayName="bin2coff (otf)"
CommandLine="Release\bin2coff.exe &quot;$(InputPath)&quot; &quot;$(IntDir)\$(InputName)_otf.obj&quot; _binary_$(InputName)_otf $(PlatformName)"
Outputs="$(IntDir)\$(InputName)_otf.obj"
FileExtensions="*.otf"
ExecutionDescription="Embedding OTF"
>
<Properties>
</Properties>
</CustomBuildRule>
<CustomBuildRule
Name="bin2coff (cff)"
DisplayName="bin2coff (cff)"
CommandLine="Release\bin2coff.exe &quot;$(InputPath)&quot; &quot;$(IntDir)\$(InputName)_cff.obj&quot; _binary_$(InputName)_cff $(PlatformName)"
Outputs="$(IntDir)\$(InputName)_cff.obj"
FileExtensions="*.cff"
ExecutionDescription="Embedding CFF"
>
<Properties>
</Properties>
</CustomBuildRule>
<CustomBuildRule
Name="bin2coff (ttc)"
DisplayName="bin2coff (ttc)"
CommandLine="Release\bin2coff.exe &quot;$(InputPath)&quot; &quot;$(IntDir)\$(InputName)_ttc.obj&quot; _binary_$(InputName)_ttc $(PlatformName)"
Outputs="$(IntDir)\$(InputName)_ttc.obj"
FileExtensions="*.ttc"
ExecutionDescription="Embedding TTC"
>
<Properties>
</Properties>
</CustomBuildRule>
</Rules>
</VisualStudioToolFile>
<?xml version="1.0" encoding="utf-8"?>
<VisualStudioToolFile
Name="bin2coff"
Version="8.00"
>
<Rules>
<CustomBuildRule
Name="bin2coff (ttf)"
DisplayName="bin2coff (ttf)"
CommandLine="Release\bin2coff.exe &quot;$(InputPath)&quot; &quot;$(IntDir)\$(InputName)_ttf.obj&quot; _binary_$(InputName)_ttf $(PlatformName)"
Outputs="$(IntDir)\$(InputName)_ttf.obj"
FileExtensions="*.ttf"
ExecutionDescription="Embedding TTF"
>
<Properties>
</Properties>
</CustomBuildRule>
<CustomBuildRule
Name="bin2coff (otf)"
DisplayName="bin2coff (otf)"
CommandLine="Release\bin2coff.exe &quot;$(InputPath)&quot; &quot;$(IntDir)\$(InputName)_otf.obj&quot; _binary_$(InputName)_otf $(PlatformName)"
Outputs="$(IntDir)\$(InputName)_otf.obj"
FileExtensions="*.otf"
ExecutionDescription="Embedding OTF"
>
<Properties>
</Properties>
</CustomBuildRule>
<CustomBuildRule
Name="bin2coff (cff)"
DisplayName="bin2coff (cff)"
CommandLine="Release\bin2coff.exe &quot;$(InputPath)&quot; &quot;$(IntDir)\$(InputName)_cff.obj&quot; _binary_$(InputName)_cff $(PlatformName)"
Outputs="$(IntDir)\$(InputName)_cff.obj"
FileExtensions="*.cff"
ExecutionDescription="Embedding CFF"
>
<Properties>
</Properties>
</CustomBuildRule>
<CustomBuildRule
Name="bin2coff (ttc)"
DisplayName="bin2coff (ttc)"
CommandLine="Release\bin2coff.exe &quot;$(InputPath)&quot; &quot;$(IntDir)\$(InputName)_ttc.obj&quot; _binary_$(InputName)_ttc $(PlatformName)"
Outputs="$(IntDir)\$(InputName)_ttc.obj"
FileExtensions="*.ttc"
ExecutionDescription="Embedding TTC"
>
<Properties>
</Properties>
</CustomBuildRule>
</Rules>
</VisualStudioToolFile>
120 changes: 60 additions & 60 deletions mupdf/platform/win32/bin2coff.vcxproj
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{BFE316B3-BD90-433A-A20D-C73975F1CAA7}</ProjectGuid>
<RootNamespace>bin2coff</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>15.0.28307.799</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\$(ProjectName)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MinimalRebuild>
</MinimalRebuild>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\scripts\bin2coff.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{BFE316B3-BD90-433A-A20D-C73975F1CAA7}</ProjectGuid>
<RootNamespace>bin2coff</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>15.0.28307.799</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\$(ProjectName)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MinimalRebuild>
</MinimalRebuild>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\scripts\bin2coff.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
Loading

0 comments on commit 79bfd4d

Please sign in to comment.