build C and C++ libraries
This commit is contained in:
parent
8895ace52c
commit
c26739b7fc
152
0001-Makerules-scripts-wrap-__main__.py-fix-for-Pyodide-s.patch
Normal file
152
0001-Makerules-scripts-wrap-__main__.py-fix-for-Pyodide-s.patch
Normal file
@ -0,0 +1,152 @@
|
||||
From 1932a672db047da3204a445880007fcc522fa7d7 Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <1932a672db047da3204a445880007fcc522fa7d7.1708103252.git.mjg@fedoraproject.org>
|
||||
From: Julian Smith <julian.smith@artifex.com>
|
||||
Date: Wed, 13 Sep 2023 14:11:47 +0100
|
||||
Subject: [PATCH 01/10] Makerules scripts/wrap/__main__.py: fix for Pyodide
|
||||
shared library builds.
|
||||
|
||||
We need to use environment's $CC (as set in Pyodide venv), not emcc.
|
||||
|
||||
Also, Pyodide builds are now indicated by $OS='pyodide'; previously we used
|
||||
$OS='wasm' && $PYODIDE_ROOT!=''.
|
||||
|
||||
(cherry picked from commit 5b111feae295e52fd25bd7bcaabb5c5a3ea8687e)
|
||||
---
|
||||
Makerules | 28 ++++++++++++++++++++--------
|
||||
scripts/wrap/__main__.py | 26 ++++++++++++++++----------
|
||||
2 files changed, 36 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/Makerules b/Makerules
|
||||
index f25a8ce0b..916e8581a 100644
|
||||
--- a/Makerules
|
||||
+++ b/Makerules
|
||||
@@ -80,6 +80,14 @@ ifeq ($(shared),yes)
|
||||
else ifeq ($(OS),wasm-mt)
|
||||
LIB_LDFLAGS = -shared -sSIDE_MODULE
|
||||
EXE_LDFLAGS = -sMAIN_MODULE
|
||||
+ else ifeq ($(OS),pyodide)
|
||||
+ LIB_LDFLAGS = -shared -sSIDE_MODULE
|
||||
+ EXE_LDFLAGS = -sMAIN_MODULE
|
||||
+
|
||||
+ # Pyodide's ld does not support -b so we cannot use it to create object
|
||||
+ # files containing font data, so leave HAVE_OBJCOPY unset. And we need
|
||||
+ # extra memory when linking.
|
||||
+ LDFLAGS += -sTOTAL_MEMORY=48MB
|
||||
else
|
||||
LIB_LDFLAGS = -shared
|
||||
endif
|
||||
@@ -181,14 +189,7 @@ else ifeq ($(OS),MACOS)
|
||||
endif
|
||||
|
||||
else ifeq ($(OS),Linux)
|
||||
- ifeq ($(PYODIDE_ROOT),)
|
||||
- HAVE_OBJCOPY := yes
|
||||
- else
|
||||
- # Pyodide's ld does not support -b so we cannot use it to create object
|
||||
- # files containing font data, so leave HAVE_OBJCOPY unset. And we need
|
||||
- # extra memory when linking.
|
||||
- LDFLAGS += -sTOTAL_MEMORY=48MB
|
||||
- endif
|
||||
+ HAVE_OBJCOPY := yes
|
||||
|
||||
ifeq ($(shell pkg-config --exists freetype2 && echo yes),yes)
|
||||
SYS_FREETYPE_CFLAGS := $(shell pkg-config --cflags freetype2)
|
||||
@@ -297,6 +298,17 @@ ifeq "$(OS)" "wasm-mt"
|
||||
CFLAGS += -pthread
|
||||
endif
|
||||
|
||||
+ifeq "$(OS)" "pyodide"
|
||||
+ build_prefix += $(OS)/
|
||||
+ # We use the provided $CC and $CXX.
|
||||
+ AR = emar
|
||||
+ HAVE_GLUT=no
|
||||
+ HAVE_X11=no
|
||||
+ HAVE_OBJCOPY=no
|
||||
+ HAVE_LIBCRYPTO=no
|
||||
+ CFLAGS += -pthread
|
||||
+endif
|
||||
+
|
||||
ifeq "$(OS)" "mingw32-cross"
|
||||
build_prefix += $(OS)/
|
||||
SO := dll
|
||||
diff --git a/scripts/wrap/__main__.py b/scripts/wrap/__main__.py
|
||||
index a543a689c..9ae753a72 100644
|
||||
--- a/scripts/wrap/__main__.py
|
||||
+++ b/scripts/wrap/__main__.py
|
||||
@@ -1207,12 +1207,12 @@ def _get_m_command( build_dirs, j=None):
|
||||
build_prefix = ''
|
||||
in_prefix = True
|
||||
for i, flag in enumerate( flags):
|
||||
- if flag in ('x32', 'x64') or flag.startswith('py'):
|
||||
+ if flag in ('x32', 'x64') or re.match('py[0-9]', flag):
|
||||
# setup.py puts cpu and python version
|
||||
# elements into the build directory name
|
||||
# when creating wheels; we need to ignore
|
||||
# them.
|
||||
- pass
|
||||
+ jlib.log('Ignoring {flag=}')
|
||||
else:
|
||||
if 0: pass # lgtm [py/unreachable-statement]
|
||||
elif flag == 'debug':
|
||||
@@ -1438,8 +1438,8 @@ def build_0(
|
||||
|
||||
def link_l_flags(sos):
|
||||
ld_origin = None
|
||||
- if os.environ.get('OS') in ('wasm', 'wasm-mt'):
|
||||
- # Don't add '-Wl,-rpath*' etc if building for wasm.
|
||||
+ if os.environ.get('OS') == 'pyodide':
|
||||
+ # Don't add '-Wl,-rpath*' etc if building for Pyodide.
|
||||
ld_origin = False
|
||||
return jlib.link_l_flags( sos, ld_origin)
|
||||
|
||||
@@ -1472,8 +1472,13 @@ def build( build_dirs, swig_command, args, vs_upgrade):
|
||||
header_git = False
|
||||
j = 0
|
||||
refcheck_if = '#ifndef NDEBUG'
|
||||
- wasm = os.environ.get('OS') in ('wasm', 'wasm-mt')
|
||||
- if wasm:
|
||||
+ pyodide = (os.environ.get('OS') == 'pyodide')
|
||||
+ if pyodide:
|
||||
+ # Looks like Pyodide sets CXX to (for example) /tmp/tmp8h1meqsj/c++.
|
||||
+ # But for some reason using `compiler = os.environ['CXX']` fails when we
|
||||
+ # build libmupdfcpp.so, with:
|
||||
+ # emsdk/upstream/bin/llvm-nm: error: a.out: No such file or directory
|
||||
+ # But using `em++` directly seems to work.
|
||||
compiler = 'em++'
|
||||
elif state.state_.macos:
|
||||
compiler = 'c++ -std=c++14'
|
||||
@@ -1626,7 +1631,7 @@ def build( build_dirs, swig_command, args, vs_upgrade):
|
||||
f'''
|
||||
{compiler}
|
||||
-o {os.path.relpath(libmupdfcpp)}
|
||||
- {"-sSIDE_MODULE" if wasm else ""}
|
||||
+ {"-sSIDE_MODULE" if pyodide else ""}
|
||||
{build_dirs.cpp_flags}
|
||||
-fPIC -shared
|
||||
-I {include1}
|
||||
@@ -1884,10 +1889,11 @@ def build( build_dirs, swig_command, args, vs_upgrade):
|
||||
# todo: maybe instead use sysconfig.get_config_vars() ?
|
||||
#
|
||||
|
||||
- if os.environ.get('PYODIDE_ROOT'):
|
||||
+ if os.environ.get('OS') == 'pyodide':
|
||||
+ assert os.environ.get('PYODIDE_ROOT') is not None
|
||||
_include_dir = os.environ[ 'PYO3_CROSS_INCLUDE_DIR']
|
||||
_lib_dir = os.environ[ 'PYO3_CROSS_LIB_DIR']
|
||||
- jlib.log( 'PYODIDE_ROOT set. {_include_dir=} {_lib_dir=}')
|
||||
+ jlib.log( 'OS is Pyodide. {_include_dir=} {_lib_dir=}')
|
||||
flags_compile = f'-I {_include_dir}'
|
||||
flags_link = f'-L {_lib_dir}'
|
||||
|
||||
@@ -2007,7 +2013,7 @@ def build( build_dirs, swig_command, args, vs_upgrade):
|
||||
f'''
|
||||
{compiler}
|
||||
-o {os.path.relpath(out_so)}
|
||||
- {"-sMAIN_MODULE" if wasm else ""}
|
||||
+ {"-sMAIN_MODULE" if pyodide else ""}
|
||||
{cpp_path}
|
||||
{build_dirs.cpp_flags}
|
||||
-fPIC
|
||||
--
|
||||
2.44.0.rc1.222.g52f20dec8d
|
||||
|
@ -1,37 +0,0 @@
|
||||
From 14598c446c46a6bf4330ba36dd356ea740d59a0b Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <14598c446c46a6bf4330ba36dd356ea740d59a0b.1705676149.git.mjg@fedoraproject.org>
|
||||
From: Michael J Gruber <mjg@fedoraproject.org>
|
||||
Date: Fri, 19 Jan 2024 15:53:59 +0100
|
||||
Subject: [PATCH] fix time type on i686
|
||||
|
||||
Gcc14 turns some warnings into errors. Fix the time type error: mupdf
|
||||
usues int64_t internally, system libs use time_t which coincide in most
|
||||
architectures but not all of them.
|
||||
---
|
||||
platform/gl/gl-main.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/platform/gl/gl-main.c b/platform/gl/gl-main.c
|
||||
index b2eb0a48e..131b6dc83 100644
|
||||
--- a/platform/gl/gl-main.c
|
||||
+++ b/platform/gl/gl-main.c
|
||||
@@ -2556,7 +2556,7 @@ static char *short_signature_error_desc(pdf_signature_error err)
|
||||
}
|
||||
}
|
||||
|
||||
-const char *format_date(int64_t secs)
|
||||
+const char *format_date(int64_t secs64)
|
||||
{
|
||||
static char buf[100];
|
||||
#ifdef _POSIX_SOURCE
|
||||
@@ -2564,6 +2564,7 @@ const char *format_date(int64_t secs)
|
||||
#else
|
||||
struct tm *tm;
|
||||
#endif
|
||||
+ time_t secs = secs64;
|
||||
|
||||
if (secs <= 0)
|
||||
return NULL;
|
||||
--
|
||||
2.43.0.462.gcdfa2ea447
|
||||
|
@ -0,0 +1,59 @@
|
||||
From 06ea458607d54015c39ae42cf6417361e5c4c9f9 Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <06ea458607d54015c39ae42cf6417361e5c4c9f9.1708103252.git.mjg@fedoraproject.org>
|
||||
In-Reply-To: <1932a672db047da3204a445880007fcc522fa7d7.1708103252.git.mjg@fedoraproject.org>
|
||||
References: <1932a672db047da3204a445880007fcc522fa7d7.1708103252.git.mjg@fedoraproject.org>
|
||||
From: Julian Smith <julian.smith@artifex.com>
|
||||
Date: Tue, 5 Sep 2023 08:43:51 +0100
|
||||
Subject: [PATCH 02/10] Makefile: add version numbers and installation targets
|
||||
for shared libraries.
|
||||
|
||||
* Installation targets install-shared-* build+install C/C++/Python/C# bindings.
|
||||
* On non-MacOS we append .FZ_VERSION_MINOR.FZ_VERSION_PATCH to shared
|
||||
libraries.
|
||||
* On Linux we create links such as libmupdf.so -> libmupdf.so.23.1 (not
|
||||
required on OpenBSD).
|
||||
|
||||
For install-shared-* targets we require that USE_SYSTEM_LIBS=yes, otherwise we
|
||||
fail with a diagnostic.
|
||||
|
||||
We install Python mupdf.py and _mupdf.so into location from Python's
|
||||
sysconfig.get_path('platlib').
|
||||
|
||||
In existing calls of ./scripts/mupdfwrap.py:
|
||||
* Add `--venv` so that we automatically get libclang and swig.
|
||||
* Use `-d $(OUT)` so we use the right build directory, e.g. if $(build_prefix)
|
||||
is set.
|
||||
|
||||
$(OUT) is only set correctly (i.e. contains `shared-`) if Make was run with
|
||||
`shared=yes`. So if $(shared) is not 'yes', rules for shared library targets
|
||||
that use $(OUT) rerun make with shared=yes.
|
||||
|
||||
(cherry picked from commit f32df6f6ebc7ff20224de3350914bb89a5417c54)
|
||||
---
|
||||
Makefile | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index f8a8dfaa9..55fda4854 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -621,14 +621,14 @@ install-shared-c: install-shared-check shared install-headers
|
||||
install -d $(DESTDIR)$(libdir)
|
||||
install -m 644 $(OUT)/libmupdf.$(SO)$(SO_VERSION) $(DESTDIR)$(libdir)/
|
||||
ifneq ($(OS),OpenBSD)
|
||||
- ln -sf libmupdf.$(SO)$(SO_VERSION) $(DESTDIR)$(libdir)/libmupdf.$(SO)
|
||||
+ ln -s libmupdf.$(SO)$(SO_VERSION) $(DESTDIR)$(libdir)/libmupdf.$(SO)
|
||||
endif
|
||||
|
||||
install-shared-c++: install-shared-c c++
|
||||
install -m 644 platform/c++/include/mupdf/*.h $(DESTDIR)$(incdir)/mupdf
|
||||
install -m 644 $(OUT)/libmupdfcpp.$(SO)$(SO_VERSION) $(DESTDIR)$(libdir)/
|
||||
ifneq ($(OS),OpenBSD)
|
||||
- ln -sf libmupdfcpp.$(SO)$(SO_VERSION) $(DESTDIR)$(libdir)/libmupdfcpp.$(SO)
|
||||
+ ln -s libmupdfcpp.$(SO)$(SO_VERSION) $(DESTDIR)$(libdir)/libmupdfcpp.$(SO)
|
||||
endif
|
||||
|
||||
install-shared-python: install-shared-c++ python
|
||||
--
|
||||
2.44.0.rc1.222.g52f20dec8d
|
||||
|
284
0003-scripts-Create-shared-libraries-with-version-numbers.patch
Normal file
284
0003-scripts-Create-shared-libraries-with-version-numbers.patch
Normal file
@ -0,0 +1,284 @@
|
||||
From 10de118bdef0325c9b7bc25e03045ecd91be97ec Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <10de118bdef0325c9b7bc25e03045ecd91be97ec.1708103252.git.mjg@fedoraproject.org>
|
||||
In-Reply-To: <1932a672db047da3204a445880007fcc522fa7d7.1708103252.git.mjg@fedoraproject.org>
|
||||
References: <1932a672db047da3204a445880007fcc522fa7d7.1708103252.git.mjg@fedoraproject.org>
|
||||
From: Julian Smith <julian.smith@artifex.com>
|
||||
Date: Wed, 13 Sep 2023 22:51:36 +0100
|
||||
Subject: [PATCH 03/10] scripts/: Create shared libraries with version numbers.
|
||||
|
||||
(We don't include version numbers on MacOS.)
|
||||
|
||||
scripts/wrap/__main__.py:
|
||||
Create .so's with version numbers.
|
||||
|
||||
Allow specification of make command. We use $MUPDF_MAKE if specified
|
||||
instead of 'make'. Also added `--make <make-command>` option.
|
||||
|
||||
macos_patch(): fix to cope with so_name.
|
||||
|
||||
Create softlinks such as libmupdfcpp.so -> libmupdfcpp.so.23.0. (Not on
|
||||
OpenBSD, which does not require them.)
|
||||
|
||||
scripts/jlib.py:link_l_flags():
|
||||
Also accept .so's with version suffix.
|
||||
|
||||
(cherry picked from commit ca530e79f55fd9759d044bd73c1f6a1427b60ca7)
|
||||
---
|
||||
scripts/jlib.py | 6 ++-
|
||||
scripts/wrap/__main__.py | 97 ++++++++++++++++++++++++++++++----------
|
||||
2 files changed, 77 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/scripts/jlib.py b/scripts/jlib.py
|
||||
index a6ded32f7..3df501b3e 100644
|
||||
--- a/scripts/jlib.py
|
||||
+++ b/scripts/jlib.py
|
||||
@@ -2243,9 +2243,11 @@ def link_l_flags( sos, ld_origin=None):
|
||||
dir_ = os.path.dirname( so)
|
||||
name = os.path.basename( so)
|
||||
assert name.startswith( 'lib'), f'name={name}'
|
||||
- if name.endswith( '.so'):
|
||||
+ m = re.search( '(.so[.0-9]*)$', name)
|
||||
+ if m:
|
||||
+ l = len(m.group(1))
|
||||
dirs.add( dir_)
|
||||
- names.append( f'-l {name[3:-3]}')
|
||||
+ names.append( f'-l {name[3:-l]}')
|
||||
elif darwin and name.endswith( '.dylib'):
|
||||
dirs.add( dir_)
|
||||
names.append( f'-l {name[3:-6]}')
|
||||
diff --git a/scripts/wrap/__main__.py b/scripts/wrap/__main__.py
|
||||
index 9ae753a72..fdb61c7a4 100644
|
||||
--- a/scripts/wrap/__main__.py
|
||||
+++ b/scripts/wrap/__main__.py
|
||||
@@ -789,6 +789,11 @@ Usage:
|
||||
Also see '--sync-docs' option for copying these generated
|
||||
documentation files elsewhere.
|
||||
|
||||
+ --make <make-command>
|
||||
+ Override make command, e.g. `--make gmake`.
|
||||
+ If not specified, we use $MUPDF_MAKE. If this is not set, we use
|
||||
+ `make` (or `gmake` on OpenBSD).
|
||||
+
|
||||
--ref
|
||||
Copy generated C++ files to mupdfwrap_ref/ directory for use by --diff.
|
||||
|
||||
@@ -1178,7 +1183,30 @@ def _test_get_m_command():
|
||||
jlib.log( '_get_m_command() ok')
|
||||
|
||||
|
||||
-def _get_m_command( build_dirs, j=None):
|
||||
+def get_so_version( build_dirs):
|
||||
+ '''
|
||||
+ Returns `.<minor>.<patch>` from include/mupdf/fitz/version.h.
|
||||
+
|
||||
+ Returns '' on macos.
|
||||
+ '''
|
||||
+ if state.state_.macos:
|
||||
+ return ''
|
||||
+ d = dict()
|
||||
+ def get_v( name):
|
||||
+ path = f'{build_dirs.dir_mupdf}/include/mupdf/fitz/version.h'
|
||||
+ with open( path) as f:
|
||||
+ for line in f:
|
||||
+ m = re.match(f'^#define {name} (.+)\n$', line)
|
||||
+ if m:
|
||||
+ return m.group(1)
|
||||
+ assert 0, f'Cannot find #define of {name=} in {path=}.'
|
||||
+ major = get_v('FZ_VERSION_MAJOR')
|
||||
+ minor = get_v('FZ_VERSION_MINOR')
|
||||
+ patch = get_v('FZ_VERSION_PATCH')
|
||||
+ return f'.{minor}.{patch}'
|
||||
+
|
||||
+
|
||||
+def _get_m_command( build_dirs, j=None, make=None):
|
||||
'''
|
||||
Generates a `make` command for building with `build_dirs.dir_mupdf`.
|
||||
|
||||
@@ -1186,13 +1214,18 @@ def _get_m_command( build_dirs, j=None):
|
||||
'''
|
||||
assert not state.state_.windows, 'Cannot do "-b m" on Windows; C library is integrated into C++ library built by "-b 01"'
|
||||
#jlib.log( '{build_dirs.dir_mupdf=}')
|
||||
- make = 'make'
|
||||
- if state.state_.openbsd:
|
||||
- # Need to run gmake, not make. Also for some
|
||||
- # reason gmake on OpenBSD sets CC to clang, but
|
||||
- # CXX to g++, so need to force CXX=clang++ too.
|
||||
- #
|
||||
- make = 'CXX=clang++ gmake'
|
||||
+ if not make:
|
||||
+ make = os.environ.get('MUPDF_MAKE')
|
||||
+ jlib.log('Overriding from $MUPDF_MAKE={make}.')
|
||||
+ if not make:
|
||||
+ if state.state_.openbsd:
|
||||
+ # Need to run gmake, not make. Also for some
|
||||
+ # reason gmake on OpenBSD sets CC to clang, but
|
||||
+ # CXX to g++, so need to force CXX=clang++ too.
|
||||
+ #
|
||||
+ make = 'CXX=clang++ gmake'
|
||||
+ if not make:
|
||||
+ make = 'make'
|
||||
|
||||
if j is not None:
|
||||
if j == 0:
|
||||
@@ -1314,6 +1347,7 @@ def macos_patch( library, *sublibraries):
|
||||
jlib.log( f'macos_patch(): library={library} sublibraries={sublibraries}')
|
||||
if not state.state_.macos:
|
||||
return
|
||||
+ # Find what shared libraries are used by `library`.
|
||||
jlib.system( f'otool -L {library}', out='log')
|
||||
command = 'install_name_tool'
|
||||
names = []
|
||||
@@ -1322,7 +1356,13 @@ def macos_patch( library, *sublibraries):
|
||||
name = name.split('\n')
|
||||
assert len(name) == 2 and name[0] == f'{sublibrary}:', f'{name=}'
|
||||
name = name[1]
|
||||
- command += f' -change {name} @rpath/{os.path.basename(name)}'
|
||||
+ # strip trailing so_name.
|
||||
+ leaf = os.path.basename(name)
|
||||
+ m = re.match('^(.+[.]((so)|(dylib)))[0-9.]*$', leaf)
|
||||
+ assert m
|
||||
+ jlib.log(f'Changing {leaf=} to {m.group(1)}')
|
||||
+ leaf = m.group(1)
|
||||
+ command += f' -change {name} @rpath/{leaf}'
|
||||
command += f' {library}'
|
||||
jlib.system( command, out='log')
|
||||
jlib.system( f'otool -L {library}', out='log')
|
||||
@@ -1444,7 +1484,7 @@ def link_l_flags(sos):
|
||||
return jlib.link_l_flags( sos, ld_origin)
|
||||
|
||||
|
||||
-def build( build_dirs, swig_command, args, vs_upgrade):
|
||||
+def build( build_dirs, swig_command, args, vs_upgrade, make_command):
|
||||
'''
|
||||
Handles -b ...
|
||||
'''
|
||||
@@ -1549,6 +1589,7 @@ def build( build_dirs, swig_command, args, vs_upgrade):
|
||||
dir_so_flags = os.path.basename( build_dirs.dir_so).split( '-')
|
||||
|
||||
windows_build_type = build_dirs.windows_build_type()
|
||||
+ so_version = get_so_version( build_dirs)
|
||||
|
||||
for action in actions:
|
||||
with jlib.LogPrefixScope( f'{action}: '):
|
||||
@@ -1563,9 +1604,12 @@ def build( build_dirs, swig_command, args, vs_upgrade):
|
||||
jlib.log( 'Ignoring `-b m` on Windows as not required.')
|
||||
else:
|
||||
jlib.log( 'Building libmupdf.so ...')
|
||||
- command, actual_build_dir, suffix = _get_m_command( build_dirs, j)
|
||||
+ command, actual_build_dir, suffix = _get_m_command( build_dirs, j, make_command)
|
||||
jlib.system( command, prefix=jlib.log_text(), out='log', verbose=1)
|
||||
|
||||
+ suffix2 = '.dylib' if state.state_.macos else '.so'
|
||||
+ assert os.path.isfile(f'{actual_build_dir}/libmupdf{suffix2}{so_version}')
|
||||
+
|
||||
if actual_build_dir != build_dirs.dir_so:
|
||||
# This happens when we are being run by
|
||||
# setup.py - it it might specify '-d
|
||||
@@ -1575,7 +1619,6 @@ def build( build_dirs, swig_command, args, vs_upgrade):
|
||||
# build/shared-release/libmupdf.so, so we need
|
||||
# to copy into build/shared-release-x64-py3.8/.
|
||||
#
|
||||
- suffix2 = '.dylib' if state.state_.macos else '.so'
|
||||
jlib.fs_copy( f'{actual_build_dir}/libmupdf{suffix2}', f'{build_dirs.dir_so}/libmupdf{suffix2}', verbose=1)
|
||||
|
||||
elif action == '0':
|
||||
@@ -1625,8 +1668,8 @@ def build( build_dirs, swig_command, args, vs_upgrade):
|
||||
for i in cpp_files:
|
||||
cpp_files_text += ' ' + os.path.relpath(i)
|
||||
if 'shared' in dir_so_flags:
|
||||
- libmupdfcpp = f'{build_dirs.dir_so}/libmupdfcpp.so'
|
||||
- libmupdf = f'{build_dirs.dir_so}/libmupdf.so'
|
||||
+ libmupdfcpp = f'{build_dirs.dir_so}/libmupdfcpp.so{so_version}'
|
||||
+ libmupdf = f'{build_dirs.dir_so}/libmupdf.so{so_version}'
|
||||
command = ( textwrap.dedent(
|
||||
f'''
|
||||
{compiler}
|
||||
@@ -1646,7 +1689,9 @@ def build( build_dirs, swig_command, args, vs_upgrade):
|
||||
command,
|
||||
force_rebuild,
|
||||
)
|
||||
- macos_patch( libmupdfcpp, f'{build_dirs.dir_so}/libmupdf.dylib')
|
||||
+ macos_patch( libmupdfcpp, f'{build_dirs.dir_so}/libmupdf.dylib{so_version}')
|
||||
+ if so_version:
|
||||
+ jlib.system(f'ln -sf libmupdfcpp.so{so_version} {build_dirs.dir_so}/libmupdfcpp.so')
|
||||
|
||||
elif 'fpic' in dir_so_flags:
|
||||
# We build a .so containing the C and C++ API. This
|
||||
@@ -1920,9 +1965,9 @@ def build( build_dirs, swig_command, args, vs_upgrade):
|
||||
|
||||
dir_so_flags = os.path.basename( build_dirs.dir_so).split( '-')
|
||||
if 'shared' in dir_so_flags:
|
||||
- libmupdf = f'{build_dirs.dir_so}/libmupdf.so'
|
||||
+ libmupdf = f'{build_dirs.dir_so}/libmupdf.so{so_version}'
|
||||
libmupdfthird = f''
|
||||
- libmupdfcpp = f'{build_dirs.dir_so}/libmupdfcpp.so'
|
||||
+ libmupdfcpp = f'{build_dirs.dir_so}/libmupdfcpp.so{so_version}'
|
||||
elif 'fpic' in dir_so_flags:
|
||||
libmupdf = f'{build_dirs.dir_so}/libmupdf.a'
|
||||
libmupdfthird = f'{build_dirs.dir_so}/libmupdf-third.a'
|
||||
@@ -1935,7 +1980,7 @@ def build( build_dirs, swig_command, args, vs_upgrade):
|
||||
out_so = f'{build_dirs.dir_so}/_mupdf.so'
|
||||
elif build_csharp:
|
||||
cpp_path = f'{build_dirs.dir_mupdf}/platform/csharp/mupdfcpp_swig.cpp'
|
||||
- out_so = f'{build_dirs.dir_so}/mupdfcsharp.so'
|
||||
+ out_so = f'{build_dirs.dir_so}/mupdfcsharp.so' # todo: append {so_version} ?
|
||||
|
||||
if state.state_.openbsd:
|
||||
# clang needs around 2G on OpenBSD.
|
||||
@@ -2006,9 +2051,9 @@ def build( build_dirs, swig_command, args, vs_upgrade):
|
||||
# module) using the same underlying C library.
|
||||
#
|
||||
sos = []
|
||||
- sos.append( f'{build_dirs.dir_so}/libmupdfcpp.so')
|
||||
+ sos.append( f'{build_dirs.dir_so}/libmupdfcpp.so{so_version}')
|
||||
if os.path.basename( build_dirs.dir_so).startswith( 'shared-'):
|
||||
- sos.append( f'{build_dirs.dir_so}/libmupdf.so')
|
||||
+ sos.append( f'{build_dirs.dir_so}/libmupdf.so{so_version}')
|
||||
command = ( textwrap.dedent(
|
||||
f'''
|
||||
{compiler}
|
||||
@@ -2043,8 +2088,8 @@ def build( build_dirs, swig_command, args, vs_upgrade):
|
||||
force_rebuild,
|
||||
)
|
||||
macos_patch( out_so,
|
||||
- f'{build_dirs.dir_so}/libmupdf.dylib',
|
||||
- f'{build_dirs.dir_so}/libmupdfcpp.so',
|
||||
+ f'{build_dirs.dir_so}/libmupdf.dylib{so_version}',
|
||||
+ f'{build_dirs.dir_so}/libmupdfcpp.so{so_version}',
|
||||
)
|
||||
else:
|
||||
raise Exception( 'unrecognised --build action %r' % action)
|
||||
@@ -2288,9 +2333,10 @@ def main2():
|
||||
#
|
||||
build_dirs = state.BuildDirs()
|
||||
|
||||
- # Set default swig.
|
||||
+ # Set default swig and make.
|
||||
#
|
||||
swig_command = 'swig'
|
||||
+ make_command = None
|
||||
|
||||
# Whether to use `devenv.com /upgrade`.
|
||||
#
|
||||
@@ -2313,7 +2359,7 @@ def main2():
|
||||
print( __doc__)
|
||||
|
||||
elif arg == '--build' or arg == '-b':
|
||||
- build( build_dirs, swig_command, args, vs_upgrade)
|
||||
+ build( build_dirs, swig_command, args, vs_upgrade, make_command)
|
||||
|
||||
elif arg == '--check-headers':
|
||||
keep_going = False
|
||||
@@ -2394,6 +2440,9 @@ def main2():
|
||||
languages = args.next()
|
||||
make_docs( build_dirs, languages)
|
||||
|
||||
+ elif arg == '--make':
|
||||
+ make_command = args.next()
|
||||
+
|
||||
elif arg == '--ref':
|
||||
assert 'mupdfwrap_ref' in build_dirs.ref_dir
|
||||
jlib.system(
|
||||
--
|
||||
2.44.0.rc1.222.g52f20dec8d
|
||||
|
@ -1,22 +1,24 @@
|
||||
From 3df9a9b2194fc075d7d3c798b379020b98081f95 Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <3df9a9b2194fc075d7d3c798b379020b98081f95.1706899657.git.mjg@fedoraproject.org>
|
||||
From 95a8976c7d0d55a88caec62f5f5d37ac69806f03 Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <95a8976c7d0d55a88caec62f5f5d37ac69806f03.1708103252.git.mjg@fedoraproject.org>
|
||||
In-Reply-To: <1932a672db047da3204a445880007fcc522fa7d7.1708103252.git.mjg@fedoraproject.org>
|
||||
References: <1932a672db047da3204a445880007fcc522fa7d7.1708103252.git.mjg@fedoraproject.org>
|
||||
From: Julian Smith <julian.smith@artifex.com>
|
||||
Date: Thu, 14 Sep 2023 18:57:42 +0100
|
||||
Subject: [PATCH 1/2] Makerules: fixes for shared shared library installs on
|
||||
Subject: [PATCH 04/10] Makerules: fixes for shared shared library installs on
|
||||
OpenBSD.
|
||||
|
||||
We need to use the same pkg-config calls as Linux.
|
||||
|
||||
(cherry picked from commit fbf12be21348aa2ea8977a61d1dac1fcf04c36ed)
|
||||
---
|
||||
Makerules | 18 +++++++++++++++---
|
||||
1 file changed, 15 insertions(+), 3 deletions(-)
|
||||
Makerules | 23 +++++++++++++++++++----
|
||||
1 file changed, 19 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/Makerules b/Makerules
|
||||
index f25a8ce0b..8b2254c4e 100644
|
||||
index 916e8581a..49c04f009 100644
|
||||
--- a/Makerules
|
||||
+++ b/Makerules
|
||||
@@ -154,6 +154,13 @@ ifneq "$(CLUSTER)" ""
|
||||
@@ -162,6 +162,13 @@ ifneq "$(CLUSTER)" ""
|
||||
CFLAGS += -DCLUSTER
|
||||
endif
|
||||
|
||||
@ -30,16 +32,21 @@ index f25a8ce0b..8b2254c4e 100644
|
||||
ifeq ($(OS),MINGW)
|
||||
WINDRES := windres
|
||||
HAVE_WIN32 := yes
|
||||
@@ -180,7 +187,7 @@ else ifeq ($(OS),MACOS)
|
||||
@@ -188,8 +195,11 @@ else ifeq ($(OS),MACOS)
|
||||
endif
|
||||
endif
|
||||
|
||||
-else ifeq ($(OS),Linux)
|
||||
- HAVE_OBJCOPY := yes
|
||||
+else ifeq ($(LINUX_OR_OPENBSD),yes)
|
||||
ifeq ($(PYODIDE_ROOT),)
|
||||
HAVE_OBJCOPY := yes
|
||||
else
|
||||
@@ -239,8 +246,13 @@ else ifeq ($(OS),Linux)
|
||||
+
|
||||
+ ifeq ($(OS),Linux)
|
||||
+ HAVE_OBJCOPY := yes
|
||||
+ endif
|
||||
|
||||
ifeq ($(shell pkg-config --exists freetype2 && echo yes),yes)
|
||||
SYS_FREETYPE_CFLAGS := $(shell pkg-config --cflags freetype2)
|
||||
@@ -240,8 +250,13 @@ else ifeq ($(OS),Linux)
|
||||
|
||||
HAVE_GLUT := yes
|
||||
ifeq ($(HAVE_GLUT),yes)
|
||||
@ -56,5 +63,5 @@ index f25a8ce0b..8b2254c4e 100644
|
||||
|
||||
HAVE_X11 := $(shell pkg-config --exists x11 xext && echo yes)
|
||||
--
|
||||
2.43.0.692.g719022bfa2
|
||||
2.44.0.rc1.222.g52f20dec8d
|
||||
|
243
0005-scripts-wrap-__main__.py-fix-Pyodide-builds-of-share.patch
Normal file
243
0005-scripts-wrap-__main__.py-fix-Pyodide-builds-of-share.patch
Normal file
@ -0,0 +1,243 @@
|
||||
From 7afd21cc1aadee98cb05665900130477effb88b1 Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <7afd21cc1aadee98cb05665900130477effb88b1.1708103252.git.mjg@fedoraproject.org>
|
||||
In-Reply-To: <1932a672db047da3204a445880007fcc522fa7d7.1708103252.git.mjg@fedoraproject.org>
|
||||
References: <1932a672db047da3204a445880007fcc522fa7d7.1708103252.git.mjg@fedoraproject.org>
|
||||
From: Julian Smith <julian.smith@artifex.com>
|
||||
Date: Thu, 19 Oct 2023 12:38:50 +0100
|
||||
Subject: [PATCH 05/10] scripts/wrap/__main__.py: fix Pyodide builds of shared
|
||||
libraries.
|
||||
|
||||
We now use '$CXX', not 'em++', with separate compilation and linking to avoid
|
||||
error:
|
||||
emsdk/upstream/bin/llvm-nm: error: a.out: No such file or directory
|
||||
|
||||
(cherry picked from commit 161f9757f16bd5b6a685e7cd2d3a10d478be8863)
|
||||
---
|
||||
scripts/wrap/__main__.py | 192 +++++++++++++++++++++++++++++----------
|
||||
1 file changed, 146 insertions(+), 46 deletions(-)
|
||||
|
||||
diff --git a/scripts/wrap/__main__.py b/scripts/wrap/__main__.py
|
||||
index fdb61c7a4..3000685a1 100644
|
||||
--- a/scripts/wrap/__main__.py
|
||||
+++ b/scripts/wrap/__main__.py
|
||||
@@ -1514,12 +1514,11 @@ def build( build_dirs, swig_command, args, vs_upgrade, make_command):
|
||||
refcheck_if = '#ifndef NDEBUG'
|
||||
pyodide = (os.environ.get('OS') == 'pyodide')
|
||||
if pyodide:
|
||||
- # Looks like Pyodide sets CXX to (for example) /tmp/tmp8h1meqsj/c++.
|
||||
- # But for some reason using `compiler = os.environ['CXX']` fails when we
|
||||
- # build libmupdfcpp.so, with:
|
||||
- # emsdk/upstream/bin/llvm-nm: error: a.out: No such file or directory
|
||||
- # But using `em++` directly seems to work.
|
||||
- compiler = 'em++'
|
||||
+ # Looks like Pyodide sets CXX to (for example) /tmp/tmp8h1meqsj/c++. We
|
||||
+ # don't evaluate it here, because that would force a rebuild each time
|
||||
+ # because of the command changing.
|
||||
+ assert os.environ.get('CXX', None), 'Pyodide build but $CXX not defined.'
|
||||
+ compiler = '$CXX'
|
||||
elif state.state_.macos:
|
||||
compiler = 'c++ -std=c++14'
|
||||
# Add extra flags for MacOS cross-compilation, where ARCHFLAGS can be
|
||||
@@ -1667,14 +1666,58 @@ def build( build_dirs, swig_command, args, vs_upgrade, make_command):
|
||||
cpp_files_text = ''
|
||||
for i in cpp_files:
|
||||
cpp_files_text += ' ' + os.path.relpath(i)
|
||||
- if 'shared' in dir_so_flags:
|
||||
- libmupdfcpp = f'{build_dirs.dir_so}/libmupdfcpp.so{so_version}'
|
||||
- libmupdf = f'{build_dirs.dir_so}/libmupdf.so{so_version}'
|
||||
+ libmupdfcpp = f'{build_dirs.dir_so}/libmupdfcpp.so{so_version}'
|
||||
+ libmupdf = f'{build_dirs.dir_so}/libmupdf.so{so_version}'
|
||||
+ if pyodide:
|
||||
+ # Compile/link separately. Otherwise
|
||||
+ # emsdk/upstream/bin/llvm-nm: error: a.out: No such
|
||||
+ # file or directory
|
||||
+ o_files = list()
|
||||
+ for cpp_file in cpp_files:
|
||||
+ o_file = f'{os.path.relpath(cpp_file)}.o'
|
||||
+ o_files.append(o_file)
|
||||
+ command = textwrap.dedent(
|
||||
+ f'''
|
||||
+ {compiler}
|
||||
+ -c
|
||||
+ -o {o_file}
|
||||
+ {build_dirs.cpp_flags}
|
||||
+ -fPIC
|
||||
+ -I {include1}
|
||||
+ -I {include2}
|
||||
+ {cpp_file}
|
||||
+ ''').strip().replace( '\n', ' \\\n')
|
||||
+ jlib.build(
|
||||
+ [include1, include2, cpp_file],
|
||||
+ o_file,
|
||||
+ command,
|
||||
+ force_rebuild,
|
||||
+ )
|
||||
+ command = ( textwrap.dedent(
|
||||
+ f'''
|
||||
+ {compiler}
|
||||
+ -o {os.path.relpath(libmupdfcpp)}
|
||||
+ -sSIDE_MODULE
|
||||
+ {build_dirs.cpp_flags}
|
||||
+ -fPIC -shared
|
||||
+ -I {include1}
|
||||
+ -I {include2}
|
||||
+ {" ".join(o_files)}
|
||||
+ {link_l_flags(libmupdf)}
|
||||
+ ''').strip().replace( '\n', ' \\\n')
|
||||
+ )
|
||||
+ jlib.build(
|
||||
+ [include1, include2] + o_files,
|
||||
+ libmupdfcpp,
|
||||
+ command,
|
||||
+ force_rebuild,
|
||||
+ )
|
||||
+
|
||||
+ elif 'shared' in dir_so_flags:
|
||||
command = ( textwrap.dedent(
|
||||
f'''
|
||||
{compiler}
|
||||
-o {os.path.relpath(libmupdfcpp)}
|
||||
- {"-sSIDE_MODULE" if pyodide else ""}
|
||||
{build_dirs.cpp_flags}
|
||||
-fPIC -shared
|
||||
-I {include1}
|
||||
@@ -2054,43 +2097,100 @@ def build( build_dirs, swig_command, args, vs_upgrade, make_command):
|
||||
sos.append( f'{build_dirs.dir_so}/libmupdfcpp.so{so_version}')
|
||||
if os.path.basename( build_dirs.dir_so).startswith( 'shared-'):
|
||||
sos.append( f'{build_dirs.dir_so}/libmupdf.so{so_version}')
|
||||
- command = ( textwrap.dedent(
|
||||
- f'''
|
||||
- {compiler}
|
||||
- -o {os.path.relpath(out_so)}
|
||||
- {"-sMAIN_MODULE" if pyodide else ""}
|
||||
- {cpp_path}
|
||||
- {build_dirs.cpp_flags}
|
||||
- -fPIC
|
||||
- -shared
|
||||
- -I {include1}
|
||||
- -I {include2}
|
||||
- {flags_compile}
|
||||
- -Wno-deprecated-declarations
|
||||
- -Wno-free-nonheap-object
|
||||
- -DSWIG_PYTHON_SILENT_MEMLEAK
|
||||
- {flags_link}
|
||||
- {link_l_flags( sos)}
|
||||
- ''').strip().replace( '\n', ' \\\n')
|
||||
- )
|
||||
- infiles = [
|
||||
- cpp_path,
|
||||
- include1,
|
||||
- include2,
|
||||
- libmupdf,
|
||||
- ]
|
||||
- infiles += sos
|
||||
+ if pyodide:
|
||||
+ # Need to use separate compilation/linking.
|
||||
+ o_file = f'{os.path.relpath(cpp_path)}.o'
|
||||
+ command = ( textwrap.dedent(
|
||||
+ f'''
|
||||
+ {compiler}
|
||||
+ -c
|
||||
+ -o {o_file}
|
||||
+ {cpp_path}
|
||||
+ {build_dirs.cpp_flags}
|
||||
+ -fPIC
|
||||
+ -I {include1}
|
||||
+ -I {include2}
|
||||
+ {flags_compile}
|
||||
+ -Wno-deprecated-declarations
|
||||
+ -Wno-free-nonheap-object
|
||||
+ -DSWIG_PYTHON_SILENT_MEMLEAK
|
||||
+ ''').strip().replace( '\n', ' \\\n')
|
||||
+ )
|
||||
+ infiles = [
|
||||
+ cpp_path,
|
||||
+ include1,
|
||||
+ include2,
|
||||
+ ]
|
||||
+ jlib.build(
|
||||
+ infiles,
|
||||
+ o_file,
|
||||
+ command,
|
||||
+ force_rebuild,
|
||||
+ )
|
||||
|
||||
- jlib.build(
|
||||
- infiles,
|
||||
- out_so,
|
||||
- command,
|
||||
- force_rebuild,
|
||||
- )
|
||||
- macos_patch( out_so,
|
||||
- f'{build_dirs.dir_so}/libmupdf.dylib{so_version}',
|
||||
- f'{build_dirs.dir_so}/libmupdfcpp.so{so_version}',
|
||||
- )
|
||||
+ command = ( textwrap.dedent(
|
||||
+ f'''
|
||||
+ {compiler}
|
||||
+ -o {os.path.relpath(out_so)}
|
||||
+ -sSIDE_MODULE
|
||||
+ {o_file}
|
||||
+ {build_dirs.cpp_flags}
|
||||
+ -shared
|
||||
+ {flags_link}
|
||||
+ {link_l_flags( sos)}
|
||||
+ ''').strip().replace( '\n', ' \\\n')
|
||||
+ )
|
||||
+ infiles = [
|
||||
+ o_file,
|
||||
+ libmupdf,
|
||||
+ ]
|
||||
+ infiles += sos
|
||||
+
|
||||
+ jlib.build(
|
||||
+ infiles,
|
||||
+ out_so,
|
||||
+ command,
|
||||
+ force_rebuild,
|
||||
+ )
|
||||
+ else:
|
||||
+ # Not Pyodide.
|
||||
+ command = ( textwrap.dedent(
|
||||
+ f'''
|
||||
+ {compiler}
|
||||
+ -o {os.path.relpath(out_so)}
|
||||
+ {"-sMAIN_MODULE" if 0 and pyodide else ""}
|
||||
+ {cpp_path}
|
||||
+ {build_dirs.cpp_flags}
|
||||
+ -fPIC
|
||||
+ -shared
|
||||
+ -I {include1}
|
||||
+ -I {include2}
|
||||
+ {flags_compile}
|
||||
+ -Wno-deprecated-declarations
|
||||
+ -Wno-free-nonheap-object
|
||||
+ -DSWIG_PYTHON_SILENT_MEMLEAK
|
||||
+ {flags_link}
|
||||
+ {link_l_flags( sos)}
|
||||
+ ''').strip().replace( '\n', ' \\\n')
|
||||
+ )
|
||||
+ infiles = [
|
||||
+ cpp_path,
|
||||
+ include1,
|
||||
+ include2,
|
||||
+ libmupdf,
|
||||
+ ]
|
||||
+ infiles += sos
|
||||
+
|
||||
+ jlib.build(
|
||||
+ infiles,
|
||||
+ out_so,
|
||||
+ command,
|
||||
+ force_rebuild,
|
||||
+ )
|
||||
+ macos_patch( out_so,
|
||||
+ f'{build_dirs.dir_so}/libmupdf.dylib{so_version}',
|
||||
+ f'{build_dirs.dir_so}/libmupdfcpp.so{so_version}',
|
||||
+ )
|
||||
else:
|
||||
raise Exception( 'unrecognised --build action %r' % action)
|
||||
|
||||
--
|
||||
2.44.0.rc1.222.g52f20dec8d
|
||||
|
176
0006-scripts-wrap-__main__.py-Allow-customisation-of-lang.patch
Normal file
176
0006-scripts-wrap-__main__.py-Allow-customisation-of-lang.patch
Normal file
@ -0,0 +1,176 @@
|
||||
From cb26b6c33f761f592e21f22301368319395d6ad2 Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <cb26b6c33f761f592e21f22301368319395d6ad2.1708103252.git.mjg@fedoraproject.org>
|
||||
In-Reply-To: <1932a672db047da3204a445880007fcc522fa7d7.1708103252.git.mjg@fedoraproject.org>
|
||||
References: <1932a672db047da3204a445880007fcc522fa7d7.1708103252.git.mjg@fedoraproject.org>
|
||||
From: Julian Smith <julian.smith@artifex.com>
|
||||
Date: Sun, 5 Nov 2023 18:03:50 +0000
|
||||
Subject: [PATCH 06/10] scripts/wrap/__main__.py: Allow customisation of
|
||||
language bindings builds.
|
||||
|
||||
If $CXX is set in environment, we use its value instead of default `c++`.
|
||||
|
||||
Also, on MacOS, avoid unnecessary rebuilds - only run post-processing otool
|
||||
command if we ran the link command.
|
||||
|
||||
Allow customisation of mupdf make command: new options in `-b` sub-command
|
||||
allow overriding of make target (e.g. `-b --m-target libs`) and setting of
|
||||
Makefile variables (e.g. `-b --m-vars 'HAVE_LIBCRYPTO=no'`).
|
||||
|
||||
Fix `--venv` arg, recent pipcl.py requires setuptools.
|
||||
|
||||
(cherry picked from commit 8cdf891d85c8c302f56d295c8acc37c2e3e6b6b5)
|
||||
---
|
||||
scripts/wrap/__main__.py | 49 ++++++++++++++++++++++++++++++----------
|
||||
1 file changed, 37 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/scripts/wrap/__main__.py b/scripts/wrap/__main__.py
|
||||
index 3000685a1..d7e86c755 100644
|
||||
--- a/scripts/wrap/__main__.py
|
||||
+++ b/scripts/wrap/__main__.py
|
||||
@@ -402,7 +402,10 @@ Tools required to build:
|
||||
|
||||
pip install libclang
|
||||
|
||||
- SWIG for Python bindings:
|
||||
+ setuptools:
|
||||
+ Used internally.
|
||||
+
|
||||
+ SWIG for Python/C# bindings:
|
||||
|
||||
We work with swig-3 and swig-4. If swig-4 is used, we propogate
|
||||
doxygen-style comments for structures and functions into the generated
|
||||
@@ -637,6 +640,13 @@ Usage:
|
||||
Set -j arg used when action 'm' calls make (not
|
||||
Windows). If <N> is 0 we use the number of CPUs
|
||||
(from Python's multiprocessing.cpu_count()).
|
||||
+ --m-target
|
||||
+ Set target for action 'm'. Default is blank, so make will
|
||||
+ build the default `all` target.
|
||||
+ --m-vars
|
||||
+ Text to insert near start of the action 'm' make command,
|
||||
+ typically to set MuPDF build flags, for example:
|
||||
+ --m-vars 'HAVE_LIBCRYPTO=no'
|
||||
--regress
|
||||
Checks for regressions in generated C++ code and SWIG .i
|
||||
file (actions 0 and 2 below). If a generated file already
|
||||
@@ -1206,7 +1216,7 @@ def get_so_version( build_dirs):
|
||||
return f'.{minor}.{patch}'
|
||||
|
||||
|
||||
-def _get_m_command( build_dirs, j=None, make=None):
|
||||
+def _get_m_command( build_dirs, j=None, make=None, m_target=None, m_vars=None):
|
||||
'''
|
||||
Generates a `make` command for building with `build_dirs.dir_mupdf`.
|
||||
|
||||
@@ -1236,6 +1246,8 @@ def _get_m_command( build_dirs, j=None, make=None):
|
||||
actual_build_dir = f'{build_dirs.dir_mupdf}/build/'
|
||||
make_env = ''
|
||||
make_args = ' HAVE_GLUT=no HAVE_PTHREAD=yes verbose=yes'
|
||||
+ if m_vars:
|
||||
+ make_args += f' {m_vars}'
|
||||
suffix = None
|
||||
build_prefix = ''
|
||||
in_prefix = True
|
||||
@@ -1286,6 +1298,8 @@ def _get_m_command( build_dirs, j=None, make=None):
|
||||
assert suffix, f'Leaf must contain "shared-" or "fpic-": build_dirs.dir_so={build_dirs.dir_so}'
|
||||
if build_prefix:
|
||||
make_args += f' build_prefix={build_prefix}'
|
||||
+ if m_target:
|
||||
+ make_args += f' {m_target}'
|
||||
command = f'cd {build_dirs.dir_mupdf} &&'
|
||||
if make_env:
|
||||
command += make_env
|
||||
@@ -1510,6 +1524,8 @@ def build( build_dirs, swig_command, args, vs_upgrade, make_command):
|
||||
clang_info_verbose = False
|
||||
force_rebuild = False
|
||||
header_git = False
|
||||
+ m_target = None
|
||||
+ m_vars = None
|
||||
j = 0
|
||||
refcheck_if = '#ifndef NDEBUG'
|
||||
pyodide = (os.environ.get('OS') == 'pyodide')
|
||||
@@ -1519,6 +1535,9 @@ def build( build_dirs, swig_command, args, vs_upgrade, make_command):
|
||||
# because of the command changing.
|
||||
assert os.environ.get('CXX', None), 'Pyodide build but $CXX not defined.'
|
||||
compiler = '$CXX'
|
||||
+ elif 'CXX' in os.environ:
|
||||
+ compiler = os.environ['CXX']
|
||||
+ jlib.log(f'Setting compiler to {os.environ["CXX"]=}.')
|
||||
elif state.state_.macos:
|
||||
compiler = 'c++ -std=c++14'
|
||||
# Add extra flags for MacOS cross-compilation, where ARCHFLAGS can be
|
||||
@@ -1577,6 +1596,10 @@ def build( build_dirs, swig_command, args, vs_upgrade, make_command):
|
||||
elif actions == '--refcheck-if':
|
||||
refcheck_if = args.next()
|
||||
jlib.log( 'Have set {refcheck_if=}')
|
||||
+ elif actions == '--m-target':
|
||||
+ m_target = args.next()
|
||||
+ elif actions == '--m-vars':
|
||||
+ m_vars = args.next()
|
||||
elif actions.startswith( '-'):
|
||||
raise Exception( f'Unrecognised --build flag: {actions}')
|
||||
else:
|
||||
@@ -1603,7 +1626,7 @@ def build( build_dirs, swig_command, args, vs_upgrade, make_command):
|
||||
jlib.log( 'Ignoring `-b m` on Windows as not required.')
|
||||
else:
|
||||
jlib.log( 'Building libmupdf.so ...')
|
||||
- command, actual_build_dir, suffix = _get_m_command( build_dirs, j, make_command)
|
||||
+ command, actual_build_dir, suffix = _get_m_command( build_dirs, j, make_command, m_target, m_vars)
|
||||
jlib.system( command, prefix=jlib.log_text(), out='log', verbose=1)
|
||||
|
||||
suffix2 = '.dylib' if state.state_.macos else '.so'
|
||||
@@ -1726,13 +1749,14 @@ def build( build_dirs, swig_command, args, vs_upgrade, make_command):
|
||||
{link_l_flags(libmupdf)}
|
||||
''').strip().replace( '\n', ' \\\n')
|
||||
)
|
||||
- jlib.build(
|
||||
+ command_was_run = jlib.build(
|
||||
[include1, include2] + cpp_files,
|
||||
libmupdfcpp,
|
||||
command,
|
||||
force_rebuild,
|
||||
)
|
||||
- macos_patch( libmupdfcpp, f'{build_dirs.dir_so}/libmupdf.dylib{so_version}')
|
||||
+ if command_was_run:
|
||||
+ macos_patch( libmupdfcpp, f'{build_dirs.dir_so}/libmupdf.dylib{so_version}')
|
||||
if so_version:
|
||||
jlib.system(f'ln -sf libmupdfcpp.so{so_version} {build_dirs.dir_so}/libmupdfcpp.so')
|
||||
|
||||
@@ -2181,16 +2205,17 @@ def build( build_dirs, swig_command, args, vs_upgrade, make_command):
|
||||
]
|
||||
infiles += sos
|
||||
|
||||
- jlib.build(
|
||||
+ command_was_run = jlib.build(
|
||||
infiles,
|
||||
out_so,
|
||||
command,
|
||||
force_rebuild,
|
||||
)
|
||||
- macos_patch( out_so,
|
||||
- f'{build_dirs.dir_so}/libmupdf.dylib{so_version}',
|
||||
- f'{build_dirs.dir_so}/libmupdfcpp.so{so_version}',
|
||||
- )
|
||||
+ if command_was_run:
|
||||
+ macos_patch( out_so,
|
||||
+ f'{build_dirs.dir_so}/libmupdf.dylib{so_version}',
|
||||
+ f'{build_dirs.dir_so}/libmupdfcpp.so{so_version}',
|
||||
+ )
|
||||
else:
|
||||
raise Exception( 'unrecognised --build action %r' % action)
|
||||
|
||||
@@ -2994,9 +3019,9 @@ def main2():
|
||||
command += f' && python -m pip install --upgrade pip'
|
||||
if state.state_.openbsd:
|
||||
jlib.log( 'Not installing libclang on openbsd; we assume py3-llvm is installed.')
|
||||
- command += f' && python -m pip install --upgrade swig'
|
||||
+ command += f' && python -m pip install --upgrade swig setuptools'
|
||||
else:
|
||||
- command += f' && python -m pip install{force_reinstall} --upgrade libclang swig'
|
||||
+ command += f' && python -m pip install{force_reinstall} --upgrade libclang swig setuptools'
|
||||
command += f' && python {shlex.quote(sys.argv[0])}'
|
||||
while 1:
|
||||
try:
|
||||
--
|
||||
2.44.0.rc1.222.g52f20dec8d
|
||||
|
@ -0,0 +1,40 @@
|
||||
From 3ae336ca60d721c1de764ee36d4ed931a9f3af45 Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <3ae336ca60d721c1de764ee36d4ed931a9f3af45.1708103252.git.mjg@fedoraproject.org>
|
||||
In-Reply-To: <1932a672db047da3204a445880007fcc522fa7d7.1708103252.git.mjg@fedoraproject.org>
|
||||
References: <1932a672db047da3204a445880007fcc522fa7d7.1708103252.git.mjg@fedoraproject.org>
|
||||
From: Julian Smith <julian.smith@artifex.com>
|
||||
Date: Wed, 3 Jan 2024 16:42:17 +0000
|
||||
Subject: [PATCH 07/10] Makefile: fix build failures with library soft-links.
|
||||
|
||||
We need to use `ln -f` when creating shared library soft-links, otherwise we
|
||||
fail if they already exist.
|
||||
|
||||
(cherry picked from commit 032af8acbfdfcfaf7d7fa63df7f22dacf6b4f630)
|
||||
---
|
||||
Makefile | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 55fda4854..f8a8dfaa9 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -621,14 +621,14 @@ install-shared-c: install-shared-check shared install-headers
|
||||
install -d $(DESTDIR)$(libdir)
|
||||
install -m 644 $(OUT)/libmupdf.$(SO)$(SO_VERSION) $(DESTDIR)$(libdir)/
|
||||
ifneq ($(OS),OpenBSD)
|
||||
- ln -s libmupdf.$(SO)$(SO_VERSION) $(DESTDIR)$(libdir)/libmupdf.$(SO)
|
||||
+ ln -sf libmupdf.$(SO)$(SO_VERSION) $(DESTDIR)$(libdir)/libmupdf.$(SO)
|
||||
endif
|
||||
|
||||
install-shared-c++: install-shared-c c++
|
||||
install -m 644 platform/c++/include/mupdf/*.h $(DESTDIR)$(incdir)/mupdf
|
||||
install -m 644 $(OUT)/libmupdfcpp.$(SO)$(SO_VERSION) $(DESTDIR)$(libdir)/
|
||||
ifneq ($(OS),OpenBSD)
|
||||
- ln -s libmupdfcpp.$(SO)$(SO_VERSION) $(DESTDIR)$(libdir)/libmupdfcpp.$(SO)
|
||||
+ ln -sf libmupdfcpp.$(SO)$(SO_VERSION) $(DESTDIR)$(libdir)/libmupdfcpp.$(SO)
|
||||
endif
|
||||
|
||||
install-shared-python: install-shared-c++ python
|
||||
--
|
||||
2.44.0.rc1.222.g52f20dec8d
|
||||
|
@ -1,10 +1,10 @@
|
||||
From 3a6f6398e32157badcdf354d62abeef602bd7742 Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <3a6f6398e32157badcdf354d62abeef602bd7742.1706899657.git.mjg@fedoraproject.org>
|
||||
In-Reply-To: <3df9a9b2194fc075d7d3c798b379020b98081f95.1706899657.git.mjg@fedoraproject.org>
|
||||
References: <3df9a9b2194fc075d7d3c798b379020b98081f95.1706899657.git.mjg@fedoraproject.org>
|
||||
From 65545bbe5248cc0850ba9eeb20f60e8498794c17 Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <65545bbe5248cc0850ba9eeb20f60e8498794c17.1708103252.git.mjg@fedoraproject.org>
|
||||
In-Reply-To: <1932a672db047da3204a445880007fcc522fa7d7.1708103252.git.mjg@fedoraproject.org>
|
||||
References: <1932a672db047da3204a445880007fcc522fa7d7.1708103252.git.mjg@fedoraproject.org>
|
||||
From: Julian Smith <julian.smith@artifex.com>
|
||||
Date: Tue, 9 Jan 2024 18:47:47 +0000
|
||||
Subject: [PATCH 2/2] Makefile scripts/wrap/__main__.py: Set SONAME when
|
||||
Subject: [PATCH 08/10] Makefile scripts/wrap/__main__.py: Set SONAME when
|
||||
linking shared libs on Linux.
|
||||
|
||||
We add link arg `-Wl,-soname,libmupdf[cpp].so,MAJOR.MINOR`.
|
||||
@ -14,8 +14,8 @@ Also only create libmupdf[cpp].so softlinks if we are on Linux.
|
||||
(cherry picked from commit 82db7fcd5bdf59652d03a56b06bf2e853140282b)
|
||||
---
|
||||
Makefile | 9 +++++++--
|
||||
scripts/wrap/__main__.py | 4 ++++
|
||||
2 files changed, 11 insertions(+), 2 deletions(-)
|
||||
scripts/wrap/__main__.py | 6 +++++-
|
||||
2 files changed, 12 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index f8a8dfaa9..369127981 100644
|
||||
@ -46,26 +46,33 @@ index f8a8dfaa9..369127981 100644
|
||||
|
||||
$(OUT)/%.def: $(OUT)/%.$(SO)$(SO_VERSION)
|
||||
diff --git a/scripts/wrap/__main__.py b/scripts/wrap/__main__.py
|
||||
index a543a689c..52e92dfa4 100644
|
||||
index d7e86c755..80dd2bf1e 100644
|
||||
--- a/scripts/wrap/__main__.py
|
||||
+++ b/scripts/wrap/__main__.py
|
||||
@@ -1620,12 +1620,16 @@ def build( build_dirs, swig_command, args, vs_upgrade):
|
||||
for i in cpp_files:
|
||||
cpp_files_text += ' ' + os.path.relpath(i)
|
||||
if 'shared' in dir_so_flags:
|
||||
@@ -1737,10 +1737,14 @@ def build( build_dirs, swig_command, args, vs_upgrade, make_command):
|
||||
)
|
||||
|
||||
elif 'shared' in dir_so_flags:
|
||||
+ link_soname_arg = ''
|
||||
+ if state.state_.linux:
|
||||
+ link_soname_arg = f'-Wl,-soname,{os.path.basename(libmupdfcpp)}'
|
||||
libmupdfcpp = f'{build_dirs.dir_so}/libmupdfcpp.so'
|
||||
libmupdf = f'{build_dirs.dir_so}/libmupdf.so'
|
||||
command = ( textwrap.dedent(
|
||||
f'''
|
||||
{compiler}
|
||||
-o {os.path.relpath(libmupdfcpp)}
|
||||
+ {link_soname_arg}
|
||||
{"-sSIDE_MODULE" if wasm else ""}
|
||||
{build_dirs.cpp_flags}
|
||||
-fPIC -shared
|
||||
-I {include1}
|
||||
@@ -1757,7 +1761,7 @@ def build( build_dirs, swig_command, args, vs_upgrade, make_command):
|
||||
)
|
||||
if command_was_run:
|
||||
macos_patch( libmupdfcpp, f'{build_dirs.dir_so}/libmupdf.dylib{so_version}')
|
||||
- if so_version:
|
||||
+ if so_version and state.state_.linux:
|
||||
jlib.system(f'ln -sf libmupdfcpp.so{so_version} {build_dirs.dir_so}/libmupdfcpp.so')
|
||||
|
||||
elif 'fpic' in dir_so_flags:
|
||||
--
|
||||
2.43.0.692.g719022bfa2
|
||||
2.44.0.rc1.222.g52f20dec8d
|
||||
|
@ -0,0 +1,37 @@
|
||||
From 813b492d9cb1fdf0fa763af07031c7506f5a7d01 Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <813b492d9cb1fdf0fa763af07031c7506f5a7d01.1708103252.git.mjg@fedoraproject.org>
|
||||
In-Reply-To: <1932a672db047da3204a445880007fcc522fa7d7.1708103252.git.mjg@fedoraproject.org>
|
||||
References: <1932a672db047da3204a445880007fcc522fa7d7.1708103252.git.mjg@fedoraproject.org>
|
||||
From: Robin Watts <Robin.Watts@artifex.com>
|
||||
Date: Wed, 31 Jan 2024 17:00:16 +0000
|
||||
Subject: [PATCH 09/10] Bug 707503: Make cast from int64_t to time_t explicit.
|
||||
|
||||
(cherry picked from commit be277ad92b55a74dac4495c25d2ca29f60b3fa1d)
|
||||
---
|
||||
platform/gl/gl-main.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/platform/gl/gl-main.c b/platform/gl/gl-main.c
|
||||
index b2eb0a48e..d5b02f340 100644
|
||||
--- a/platform/gl/gl-main.c
|
||||
+++ b/platform/gl/gl-main.c
|
||||
@@ -2556,7 +2556,7 @@ static char *short_signature_error_desc(pdf_signature_error err)
|
||||
}
|
||||
}
|
||||
|
||||
-const char *format_date(int64_t secs)
|
||||
+const char *format_date(int64_t secs64)
|
||||
{
|
||||
static char buf[100];
|
||||
#ifdef _POSIX_SOURCE
|
||||
@@ -2564,6 +2564,7 @@ const char *format_date(int64_t secs)
|
||||
#else
|
||||
struct tm *tm;
|
||||
#endif
|
||||
+ time_t secs = (time_t)secs64;
|
||||
|
||||
if (secs <= 0)
|
||||
return NULL;
|
||||
--
|
||||
2.44.0.rc1.222.g52f20dec8d
|
||||
|
86
0010-Makefile-allow-control-of-file-modes-and-venv-s.patch
Normal file
86
0010-Makefile-allow-control-of-file-modes-and-venv-s.patch
Normal file
@ -0,0 +1,86 @@
|
||||
From 7d775873398406d0d98b9d4f3ab171b4d8a3cc70 Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <7d775873398406d0d98b9d4f3ab171b4d8a3cc70.1708103252.git.mjg@fedoraproject.org>
|
||||
In-Reply-To: <1932a672db047da3204a445880007fcc522fa7d7.1708103252.git.mjg@fedoraproject.org>
|
||||
References: <1932a672db047da3204a445880007fcc522fa7d7.1708103252.git.mjg@fedoraproject.org>
|
||||
From: Julian Smith <julian.smith@artifex.com>
|
||||
Date: Sat, 27 Jan 2024 20:18:27 +0000
|
||||
Subject: [PATCH 10/10] Makefile: allow control of file modes and venv's.
|
||||
|
||||
For `install*` targets, `SO_INSTALL_MODE` will override `install` commands'
|
||||
default `-m 644` setting for .so files.
|
||||
|
||||
For C++, Python and C# builds, `VENV_FLAG` will override the default `--venv`
|
||||
passed to ./scripts/mupdfwrap.py; so if set to an empty string, the build will
|
||||
not be done in a venv.
|
||||
|
||||
Defaults for `SO_INSTALL_MODE` and `VENV_FLAG` are set using `?=` so they can
|
||||
be overridden either in the environment or as `make` parameters. For example
|
||||
`INSTALL_MODE=755 make ...` or `make INSTALL_MODE=755 ...`.
|
||||
|
||||
(cherry picked from commit 010404d06200115fbf146434234fdd99b5df6f66)
|
||||
---
|
||||
Makefile | 19 ++++++++++++-------
|
||||
1 file changed, 12 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 369127981..1d901a389 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -449,6 +449,7 @@ incdir ?= $(prefix)/include
|
||||
mandir ?= $(prefix)/share/man
|
||||
docdir ?= $(prefix)/share/doc/mupdf
|
||||
pydir ?= $(shell python3 -c "import sysconfig; print(sysconfig.get_path('platlib'))")
|
||||
+SO_INSTALL_MODE ?= 644
|
||||
|
||||
third: $(THIRD_LIB)
|
||||
extra-libs: $(THIRD_GLUT_LIB)
|
||||
@@ -604,13 +605,17 @@ $(error OUT=$(OUT) does not contain shared)
|
||||
endif
|
||||
|
||||
# C++, Python and C# shared libraries.
|
||||
+#
|
||||
+# To disable automatic use of a venv, use `make VENV_FLAG= ...` or `VENV_FLAG=
|
||||
+# make ...`.
|
||||
+#
|
||||
+VENV_FLAG ?= --venv
|
||||
c++-%: shared-%
|
||||
- ./scripts/mupdfwrap.py --venv -d $(OUT) -b 01
|
||||
+ ./scripts/mupdfwrap.py $(VENV_FLAG) -d $(OUT) -b 01
|
||||
python-%: c++-%
|
||||
- ./scripts/mupdfwrap.py --venv -d $(OUT) -b 23
|
||||
+ ./scripts/mupdfwrap.py $(VENV_FLAG) -d $(OUT) -b 23
|
||||
csharp-%: c++-%
|
||||
- ./scripts/mupdfwrap.py --venv -d $(OUT) -b --csharp 23
|
||||
-
|
||||
+ ./scripts/mupdfwrap.py $(VENV_FLAG) -d $(OUT) -b --csharp 23
|
||||
|
||||
# Installs of C, C++, Python and C# shared libraries
|
||||
#
|
||||
@@ -624,21 +629,21 @@ endif
|
||||
|
||||
install-shared-c: install-shared-check shared install-headers
|
||||
install -d $(DESTDIR)$(libdir)
|
||||
- install -m 644 $(OUT)/libmupdf.$(SO)$(SO_VERSION) $(DESTDIR)$(libdir)/
|
||||
+ install -m $(SO_INSTALL_MODE) $(OUT)/libmupdf.$(SO)$(SO_VERSION) $(DESTDIR)$(libdir)/
|
||||
ifneq ($(OS),OpenBSD)
|
||||
ln -sf libmupdf.$(SO)$(SO_VERSION) $(DESTDIR)$(libdir)/libmupdf.$(SO)
|
||||
endif
|
||||
|
||||
install-shared-c++: install-shared-c c++
|
||||
install -m 644 platform/c++/include/mupdf/*.h $(DESTDIR)$(incdir)/mupdf
|
||||
- install -m 644 $(OUT)/libmupdfcpp.$(SO)$(SO_VERSION) $(DESTDIR)$(libdir)/
|
||||
+ install -m $(SO_INSTALL_MODE) $(OUT)/libmupdfcpp.$(SO)$(SO_VERSION) $(DESTDIR)$(libdir)/
|
||||
ifneq ($(OS),OpenBSD)
|
||||
ln -sf libmupdfcpp.$(SO)$(SO_VERSION) $(DESTDIR)$(libdir)/libmupdfcpp.$(SO)
|
||||
endif
|
||||
|
||||
install-shared-python: install-shared-c++ python
|
||||
install -d $(DESTDIR)$(pydir)/mupdf
|
||||
- install -m 644 $(OUT)/_mupdf.$(SO) $(DESTDIR)$(pydir)/mupdf
|
||||
+ install -m $(SO_INSTALL_MODE) $(OUT)/_mupdf.$(SO) $(DESTDIR)$(pydir)/mupdf
|
||||
install -m 644 $(OUT)/mupdf.py $(DESTDIR)$(pydir)/mupdf/__init__.py
|
||||
|
||||
else
|
||||
--
|
||||
2.44.0.rc1.222.g52f20dec8d
|
||||
|
53
mupdf.spec
53
mupdf.spec
@ -21,10 +21,18 @@ Source0: http://mupdf.com/downloads/archive/%{name}-%{upversion}-source.tar.gz
|
||||
Source1: %{name}.desktop
|
||||
Source2: %{name}-gl.desktop
|
||||
# https://github.com/ArtifexSoftware/mupdf/pull/42
|
||||
Patch1: dc339ceab37d962e91527068321790768262a42c.patch
|
||||
Patch2: 0001-fix-time-type-on-i686.patch
|
||||
Patch3: 0001-Makerules-fixes-for-shared-shared-library-installs-o.patch
|
||||
Patch4: 0002-Makefile-scripts-wrap-__main__.py-Set-SONAME-when-li.patch
|
||||
Patch: dc339ceab37d962e91527068321790768262a42c.patch
|
||||
# Upstream patches backported from master branch (build system fixes for shared builds)
|
||||
Patch: 0001-Makerules-scripts-wrap-__main__.py-fix-for-Pyodide-s.patch
|
||||
Patch: 0002-Makefile-add-version-numbers-and-installation-target.patch
|
||||
Patch: 0003-scripts-Create-shared-libraries-with-version-numbers.patch
|
||||
Patch: 0004-Makerules-fixes-for-shared-shared-library-installs-o.patch
|
||||
Patch: 0005-scripts-wrap-__main__.py-fix-Pyodide-builds-of-share.patch
|
||||
Patch: 0006-scripts-wrap-__main__.py-Allow-customisation-of-lang.patch
|
||||
Patch: 0007-Makefile-fix-build-failures-with-library-soft-links.patch
|
||||
Patch: 0008-Makefile-scripts-wrap-__main__.py-Set-SONAME-when-li.patch
|
||||
Patch: 0009-Bug-707503-Make-cast-from-int64_t-to-time_t-explicit.patch
|
||||
Patch: 0010-Makefile-allow-control-of-file-modes-and-venv-s.patch
|
||||
BuildRequires: gcc gcc-c++ make binutils desktop-file-utils coreutils pkgconfig
|
||||
BuildRequires: openjpeg2-devel desktop-file-utils
|
||||
BuildRequires: libjpeg-devel freetype-devel libXext-devel curl-devel
|
||||
@ -35,6 +43,7 @@ BuildRequires: freeglut-devel
|
||||
BuildRequires: jbig2dec-devel = %{jbig2dec_version}
|
||||
BuildRequires: jbig2dec-libs = %{jbig2dec_version}
|
||||
Requires: jbig2dec-libs = %{jbig2dec_version}
|
||||
BuildRequires: swig python3-clang python3-devel
|
||||
# We need to build against the Artifex fork of lcms2 so that we are thread safe
|
||||
# (see bug #1553915). Artifex make sure to rebase against upstream, who refuse
|
||||
# to integrate Artifex's changes.
|
||||
@ -61,18 +70,32 @@ bookmarks, encrypting PDF files, extracting fonts, images, and
|
||||
searchable text, and rendering pages to image files is provided.
|
||||
|
||||
%package devel
|
||||
Summary: Development files for %{name}
|
||||
Summary: C Development files for %{name}
|
||||
Requires: %{name}-libs%{_isa} = %{version}-%{release}
|
||||
|
||||
%description devel
|
||||
The mupdf-devel package contains library and header files for developing
|
||||
applications that use the mupdf library.
|
||||
C applications that use the mupdf library.
|
||||
|
||||
%package libs
|
||||
Summary: Library files for %{name}
|
||||
Summary: C Library files for %{name}
|
||||
|
||||
%description libs
|
||||
The mupdf-libs package contains the mupdf library files.
|
||||
The mupdf-libs package contains the mupdf C library files.
|
||||
|
||||
%package cpp-devel
|
||||
Summary: C++ Development files for %{name}
|
||||
Requires: %{name}-cpp-libs%{_isa} = %{version}-%{release}
|
||||
|
||||
%description cpp-devel
|
||||
The mupdf-cpp-devel package contains library and header files for developing
|
||||
C++ applications that use the mupdf library.
|
||||
|
||||
%package cpp-libs
|
||||
Summary: C++ Library files for %{name}
|
||||
|
||||
%description cpp-libs
|
||||
The mupdf-cpp-libs package contains the mupdf C++ library files.
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n %{name}-%{upversion}-source
|
||||
@ -102,9 +125,9 @@ echo > user.make "\
|
||||
%build
|
||||
export XCFLAGS="%{optflags} -fPIC -DJBIG_NO_MEMENTO -DTOFU -DTOFU_CJK_EXT"
|
||||
|
||||
make %{?_smp_mflags} build=debug shared=yes verbose=yes
|
||||
make %{?_smp_mflags} build=debug shared=yes verbose=yes c++ python VENV_FLAG=
|
||||
%install
|
||||
make DESTDIR=%{buildroot} install install-shared-c prefix=%{_prefix} libdir=%{_libdir} build=debug shared=yes verbose=yes
|
||||
make DESTDIR=%{buildroot} install install-shared-c install-shared-c++ prefix=%{_prefix} libdir=%{_libdir} build=debug shared=yes verbose=yes VENV_FLAG= SO_INSTALL_MODE=755
|
||||
## handle docs on our own
|
||||
rm -rf %{buildroot}/%{_docdir}
|
||||
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE1}
|
||||
@ -116,8 +139,6 @@ find %{buildroot}/%{_mandir} -type f -exec chmod 0644 {} \;
|
||||
find %{buildroot}/%{_includedir} -type f -exec chmod 0644 {} \;
|
||||
cd %{buildroot}/%{_bindir} && ln -s %{name}-x11 %{name}
|
||||
|
||||
chmod +x %{buildroot}/%{_libdir}/%{libname}.so.%{soname}
|
||||
|
||||
%files
|
||||
%license COPYING
|
||||
%doc README CHANGES docs/*
|
||||
@ -134,5 +155,13 @@ chmod +x %{buildroot}/%{_libdir}/%{libname}.so.%{soname}
|
||||
%license COPYING
|
||||
%{_libdir}/%{libname}.so.%{soname}
|
||||
|
||||
%files cpp-devel
|
||||
%{_includedir}/%{name}
|
||||
%{_libdir}/%{libname}cpp.so
|
||||
|
||||
%files cpp-libs
|
||||
%license COPYING
|
||||
%{_libdir}/%{libname}cpp.so.%{soname}
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
||||
|
Loading…
Reference in New Issue
Block a user