-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1c5a17e
commit aefb855
Showing
11 changed files
with
325 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[wrap-file] | ||
directory = jbig2dec-0.20 | ||
source_url = https://github.com/ArtifexSoftware/jbig2dec/archive/refs/tags/0.20.tar.gz | ||
source_filename = jbig2dec-0.20.tar.gz | ||
source_hash = a9705369a6633aba532693450ec802c562397e1b824662de809ede92f67aff21 | ||
patch_directory = jbig2dec | ||
|
||
[provide] | ||
dependency_names = jbig2dec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
jbig2_h = fs.copyfile( | ||
'../jbig2.h', | ||
'jbig2.h', | ||
install: true, | ||
install_dir: get_option('includedir'), | ||
install_tag: 'devel', | ||
) | ||
|
||
public_include = include_directories('.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
project( | ||
'jbig2dec', | ||
'c', | ||
version: '0.20', | ||
meson_version: '>=0.64.0', | ||
) | ||
|
||
cc = meson.get_compiler('c') | ||
|
||
fs = import('fs') | ||
|
||
progs_opt = get_option('progs') | ||
tests_opt = get_option('tests') | ||
|
||
lib_inc = [ | ||
'jbig2_arith.h', | ||
'jbig2_arith_iaid.h', | ||
'jbig2_arith_int.h', | ||
'jbig2_generic.h', | ||
'jbig2_halftone.h', | ||
'jbig2_huffman.h', | ||
'jbig2_hufftab.h', | ||
'jbig2_image.h', | ||
'jbig2_image_rw.h', | ||
'jbig2_mmr.h', | ||
'jbig2_page.h', | ||
'jbig2_priv.h', | ||
'jbig2_refinement.h', | ||
'jbig2_segment.h', | ||
'jbig2_symbol_dict.h', | ||
'jbig2_text.h', | ||
'memento.h', | ||
'os_types.h', | ||
'sha1.h', | ||
] | ||
lib_src = [ | ||
'jbig2.c', | ||
'jbig2_arith.c', | ||
'jbig2_arith_iaid.c', | ||
'jbig2_arith_int.c', | ||
'jbig2_generic.c', | ||
'jbig2_halftone.c', | ||
'jbig2_huffman.c', | ||
'jbig2_hufftab.c', | ||
'jbig2_image.c', | ||
'jbig2_image_pbm.c', | ||
'jbig2_mmr.c', | ||
'jbig2_page.c', | ||
'jbig2_refinement.c', | ||
'jbig2_segment.c', | ||
'jbig2_symbol_dict.c', | ||
'jbig2_text.c', | ||
] | ||
progs_src = [ | ||
'jbig2dec.c', | ||
'sha1.c', | ||
] | ||
tests_src = [ | ||
] | ||
|
||
m_dep = cc.find_library('m', required: false) | ||
|
||
png_dep = dependency('libpng', required: progs_opt.disabled() ? progs_opt : false) | ||
if png_dep.found() | ||
progs_src += 'jbig2_image_png.c' | ||
endif | ||
|
||
add_project_arguments('-DHAVE_CONFIG_H', language: 'c') | ||
|
||
cdata = configuration_data() | ||
cdata.set('HAVE_LIBPNG', png_dep.found()) | ||
cdata.set('WORDS_BIGENDIAN', host_machine.endian() == 'big' ? 1 : false) | ||
|
||
foreach _header : [ | ||
'stdint.h', | ||
'string.h', | ||
] | ||
cdata.set( | ||
'HAVE_' + _header.underscorify().to_upper(), | ||
cc.has_header(_header) ? 1 : false, | ||
) | ||
endforeach | ||
|
||
if ( | ||
progs_opt.allowed() | ||
and cc.has_function('getopt_long', prefix: '#include<getopt.h>') | ||
) | ||
cdata.set('HAVE_GETOPT_H', 1) | ||
else | ||
progs_src += [ | ||
'getopt.c', | ||
'getopt.h', | ||
'getopt1.c', | ||
] | ||
endif | ||
|
||
# Optional replacement for int…_t / uint…_t types. | ||
cdata.set('JBIG2_STDINT_H', '') | ||
cdata.set('JBIG2_INT8_T' , '') | ||
cdata.set('JBIG2_INT16_T' , '') | ||
cdata.set('JBIG2_INT32_T' , '') | ||
if cdata.get('HAVE_STDINT_H').to_string() != '1' | ||
sizeof_types = {} | ||
foreach _type : ['char', 'short', 'int', 'long'] | ||
sizeof_types += {_type: cc.sizeof(_type)} | ||
endforeach | ||
foreach _spec : [ | ||
['int8' , 1, 'char' ], | ||
['int16', 2, 'short char int'], | ||
['int32', 4, 'int long short'], | ||
] | ||
_name = _spec[0] | ||
_size = _spec[1] | ||
_typelist = _spec[2] | ||
_type = '' | ||
foreach _candidate : _typelist.split() | ||
if _size == sizeof_types[_candidate] | ||
_type = _candidate | ||
break | ||
endif | ||
endforeach | ||
if _type == '' | ||
error('could not find a suitable replacement type for @0@_t / u@0@_t'.format(_name)) | ||
endif | ||
message('using @0@ for @1@_t / u@1@_t'.format(_type, _name)) | ||
cdata.set('JBIG2_@0@_T'.format(_name.to_upper()), _type) | ||
endforeach | ||
endif | ||
|
||
subdir('include') | ||
subdir('src') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
option('progs', type: 'feature') | ||
option('tests', type: 'feature') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* config.h. Generated from config.h.meson by meson. */ | ||
|
||
/* Define to 1 if you have the <getopt.h> header | ||
* with a compatible `getopt_long` function. */ | ||
#mesondefine HAVE_GETOPT_H | ||
|
||
/* Define to 1 if you have the <libintl.h> header file. */ | ||
#mesondefine HAVE_LIBINTL_H | ||
|
||
/* Define if libpng is available (-lpng) */ | ||
#mesondefine HAVE_LIBPNG | ||
|
||
/* Define to 1 if you have the <stdint.h> header file. */ | ||
#mesondefine HAVE_STDINT_H | ||
|
||
/* Define to 1 if you have the <string.h> header file. */ | ||
#mesondefine HAVE_STRING_H | ||
|
||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most | ||
significant byte first (like Motorola and SPARC, unlike Intel). */ | ||
#mesondefine WORDS_BIGENDIAN | ||
|
||
/* vim: set ft=c: */ |
23 changes: 23 additions & 0 deletions
23
subprojects/packagefiles/jbig2dec/src/config_types.h.meson
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
generated header with missing types for the | ||
jbig2dec program and library. include this | ||
after config.h, within the HAVE_CONFIG_H | ||
ifdef | ||
*/ | ||
|
||
#ifdef HAVE_STDINT_H | ||
# include <stdint.h> | ||
#else | ||
# ifdef JBIG2_REPLACE_STDINT_H | ||
# include <@JBIG2_STDINT_H@> | ||
# else | ||
typedef unsigned @JBIG2_INT32_T@ uint32_t; | ||
typedef unsigned @JBIG2_INT16_T@ uint16_t; | ||
typedef unsigned @JBIG2_INT8_T@ uint8_t; | ||
typedef signed @JBIG2_INT32_T@ int32_t; | ||
typedef signed @JBIG2_INT16_T@ int16_t; | ||
typedef signed @JBIG2_INT8_T@ int8_t; | ||
# endif /* JBIG2_REPLACE_STDINT */ | ||
#endif /* HAVE_STDINT_H */ | ||
|
||
/* vim: set ft=c: */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
EXPORTS | ||
; Public API. | ||
jbig2_complete_page | ||
jbig2_ctx_free | ||
jbig2_ctx_new_imp | ||
jbig2_data_in | ||
jbig2_global_ctx_free | ||
jbig2_make_global_ctx | ||
jbig2_page_out | ||
jbig2_release_page | ||
; Private, but used by the jbig2dec executable. | ||
jbig2_error | ||
jbig2_image_write_pbm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# Because of the presence of `getopt.h` alongside the standard source files, | ||
# and the mix of private and public headers in the same directory, we copy | ||
# only the files needed to the build directory. | ||
foreach _listname, _needed : { | ||
'lib_inc' : true, | ||
'lib_src' : true, | ||
'progs_src': progs_opt.allowed(), | ||
'tests_src': progs_opt.allowed(), | ||
} | ||
if not _needed | ||
continue | ||
endif | ||
_srclist = get_variable(_listname) | ||
_dstlist = [] | ||
foreach _file : _srclist | ||
_filecopy = fs.copyfile('..' / _file, _file) | ||
set_variable(_file.underscorify(), _filecopy) | ||
_dstlist += _filecopy | ||
endforeach | ||
set_variable(_listname, _dstlist) | ||
endforeach | ||
|
||
config_h = configure_file( | ||
configuration: cdata, | ||
input: 'config.h.meson', | ||
output: 'config.h', | ||
) | ||
|
||
config_types_h = configure_file( | ||
configuration: cdata, | ||
input: 'config_types.h.meson', | ||
output: 'config_types.h', | ||
) | ||
|
||
lib_inc += [ | ||
config_h, | ||
config_types_h, | ||
jbig2_h, | ||
] | ||
|
||
jbig2dec_lib = library( | ||
'jbig2dec', | ||
[ | ||
lib_inc, | ||
lib_src, | ||
], | ||
dependencies: m_dep, | ||
install: true, | ||
version: '0.0.0', | ||
vs_module_defs: 'jbig2dec.def', | ||
) | ||
|
||
jbig2dec_dep = declare_dependency( | ||
include_directories: public_include, | ||
link_with: jbig2dec_lib, | ||
sources: jbig2_h, | ||
) | ||
meson.override_dependency('jbig2dec', jbig2dec_dep) | ||
|
||
pkg = import('pkgconfig') | ||
pkg.generate( | ||
jbig2dec_lib, | ||
description: 'JBIG2 decoder library.', | ||
filebase: 'jbig2dec', | ||
name: 'libjbig2dec', | ||
) | ||
|
||
if progs_opt.allowed() | ||
executable( | ||
'jbig2dec', | ||
[lib_inc, progs_src], | ||
dependencies: [jbig2dec_dep, png_dep], | ||
install: true, | ||
) | ||
endif | ||
|
||
if tests_opt.allowed() | ||
# Tests need access to all symbols, including on Windows. | ||
jbig2dec_priv_lib = static_library( | ||
'jbig2dec_priv', | ||
objects: jbig2dec_lib.extract_all_objects(recursive: true), | ||
) | ||
foreach _name, _src : { | ||
'arith' : jbig2_arith_c, | ||
'huffman': jbig2_huffman_c, | ||
'sha1' : sha1_c, | ||
} | ||
test( | ||
_name, | ||
executable( | ||
_name, | ||
[lib_inc, _src], | ||
c_args: '-DTEST', | ||
include_directories: public_include, | ||
link_with: jbig2dec_priv_lib, | ||
), | ||
) | ||
endforeach | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters