-
Notifications
You must be signed in to change notification settings - Fork 203
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
Showing
5 changed files
with
157 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[wrap-file] | ||
directory = bzip2-1.0.8 | ||
source_url = https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz | ||
source_filename = bzip2-1.0.8.tar.gz | ||
source_hash = ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269 | ||
patch_directory = bzip2 | ||
|
||
[provide] | ||
dependency_names = bzip2 |
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,101 @@ | ||
project('bzip2', 'c', version: '1.0.8', meson_version: '>=1.0.0') | ||
|
||
libbz2_lib = static_library( | ||
'bz2', | ||
'blocksort.c', | ||
'huffman.c', | ||
'crctable.c', | ||
'randtable.c', | ||
'compress.c', | ||
'decompress.c', | ||
'bzlib.c', | ||
pic: true, | ||
install: true, | ||
) | ||
|
||
bzip2_exe = executable('bzip2', 'bzip2.c', link_with: libbz2_lib) | ||
|
||
if meson.can_run_host_binaries() | ||
python = find_program('python3', native: true, version: ['>=3.5', '<4']) | ||
_testargs = [files('test.py')] | ||
test( | ||
'compress sample1', | ||
python, | ||
args: [ | ||
_testargs, | ||
files('sample1.ref'), | ||
files('sample1.bz2'), | ||
'--', | ||
bzip2_exe, | ||
'-1', | ||
], | ||
) | ||
test( | ||
'compress sample2', | ||
python, | ||
args: [ | ||
_testargs, | ||
files('sample2.ref'), | ||
files('sample2.bz2'), | ||
'--', | ||
bzip2_exe, | ||
'-2', | ||
], | ||
) | ||
test( | ||
'compress sample3', | ||
python, | ||
args: [ | ||
_testargs, | ||
files('sample3.ref'), | ||
files('sample3.bz2'), | ||
'--', | ||
bzip2_exe, | ||
'-3', | ||
], | ||
) | ||
test( | ||
'decompress sample1', | ||
python, | ||
args: [ | ||
_testargs, | ||
files('sample1.bz2'), | ||
files('sample1.ref'), | ||
'--', | ||
bzip2_exe, | ||
'-d', | ||
], | ||
) | ||
test( | ||
'decompress sample2', | ||
python, | ||
args: [ | ||
_testargs, | ||
files('sample2.bz2'), | ||
files('sample2.ref'), | ||
'--', | ||
bzip2_exe, | ||
'-d', | ||
], | ||
) | ||
test( | ||
'decompress sample3', | ||
python, | ||
args: [ | ||
_testargs, | ||
files('sample3.bz2'), | ||
files('sample3.ref'), | ||
'--', | ||
bzip2_exe, | ||
'-ds', | ||
], | ||
) | ||
endif | ||
|
||
install_headers('bzlib.h') | ||
|
||
bzip2_dep = declare_dependency( | ||
link_with: libbz2_lib, | ||
include_directories: include_directories('.'), | ||
) | ||
meson.override_dependency('bzip2', bzip2_dep) |
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,36 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import subprocess | ||
import argparse | ||
from pathlib import Path | ||
import tempfile | ||
import os | ||
import shlex | ||
import sys | ||
|
||
|
||
def run_command(command, stdinfile): | ||
if "MESON_EXE_WRAPPER" in os.environ: | ||
command = shlex.split(os.environ["MESON_EXE_WRAPPER"]) + command | ||
with tempfile.TemporaryFile("w+b") as outf: | ||
with open(stdinfile, "rb") as inf: | ||
subprocess.run(command, stdin=inf, stdout=outf) | ||
outf.seek(0) | ||
return outf.read() | ||
|
||
|
||
def compare(result, reffile): | ||
with open(reffile, "rb") as reff: | ||
return result == reff.read() | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("input", type=Path) | ||
parser.add_argument("reference", type=Path) | ||
parser.add_argument("command", nargs="+") | ||
args = parser.parse_args() | ||
|
||
if not compare(run_command(args.command, args.input), args.reference): | ||
print("Output did not match reference file!") | ||
sys.exit(1) |
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 |
---|---|---|
|
@@ -34,6 +34,9 @@ | |
'box2d': [ | ||
'doctest.h' | ||
], | ||
'bzip2': [ | ||
'test.py', | ||
], | ||
'curl': [ | ||
'extract.mk', | ||
'rewrite.mk', | ||
|