423 Commits

Author SHA1 Message Date
Eric Biggers
2d2bc2cc8a Makefile: fix up coding style 2021-11-24 19:41:30 -08:00
nick black
0a2b40203d Generate a pkg-config support file #140
We pull the version out of libdeflate.h into the
Makefile, and then sed a few macros out of the new
file libdeflate.pc.in. Set the necessary Cflags
and Libs (CFLAGS and LFLAGS) based off compile-time
definitions. Depend on the Makefile to pick up
version changes. Update uninstall target.

Signed-off-by: nick black <dankamongmen@gmail.com>
2021-11-23 23:28:38 -08:00
Eric Biggers
22c0dd7afd ci.yml: remove ubuntu-16.04
This is no longer supported by GitHub Actions.
2021-11-03 23:07:44 -07:00
Dmitry Bogatov
ee4d18872b Add environment variable to disable building shared library
Environment variable DISABLE_SHARED (following convention of --disable-shared
of ./configure script) disables building of shared library and shared lib
symlink. It makes life of downstream maintainer easier when maintaining package
for environment that supports only static libraries.

See https://github.com/NixOS/nixpkgs/pull/144438
2021-11-03 22:25:22 -07:00
Eric Biggers
047aa84e01 v1.8 v1.8 2021-07-15 09:31:09 -05:00
Eric Biggers
8efdabddae Convert NEWS file to markdown 2021-07-15 09:24:13 -05:00
cielavenir
9b565afd99 Fix ICC compilation
- crc32: On ICC, __v2di is defined in immintrin.h
- adler32.c: __v64qi etc are not available on ICC
2021-05-06 23:10:58 -07:00
tansy
72c81b3332 programs/gzip: add support for the '-t' option (test file integrity)
The '-t' option of GNU gzip allows checking whether a gzip file is valid
without writing the data anywhere.  It's relatively straightforward to
support in libdeflate-gzip too, so add support for it.

Resolves https://github.com/ebiggers/libdeflate/issues/125

[EB - updated commit message]
2021-05-06 22:48:02 -07:00
Eric Biggers
fbada10aa9 prog_util: make it clear that posix_[fm]advise errors are ignored 2021-03-14 21:04:26 -07:00
Eric Biggers
ea2f7569b0 benchmark: clarify what the -g and -z options do
Update https://github.com/ebiggers/libdeflate/issues/120
2021-03-12 00:07:40 -08:00
Eric Biggers
83a1bbf1d3 lib: consistently use include guards
A lot of the internal library headers don't have include guards because
they aren't needed.  It might look like a bug, though, and it doesn't
hurt to add them.  So do this.

Update https://github.com/ebiggers/libdeflate/issues/117
2021-03-12 00:07:30 -08:00
J. Zebedee
4d3c0f00d5 Add C# to bindings list 2021-02-23 22:23:11 -08:00
Ingvar Stepanyan
a07ed5824a Assume fast unaligned access on WebAssembly
I saw this tweet claiming this flag makes libdeflate run 20% faster on
WebAssembly: https://twitter.com/Algunenano/status/1317098341377900550.

Indeed, when tried even in a complex PNG compression benchmark I've
observed 10-15% improvement when this flag is enabled.

Even though WebAssembly might be running on top of a variety of
underlying platforms, the spec requires it to support unaligned access,
and on majority of platforms it will translate to a faster code.

Hence, I think it makes sense to enable this flag by default.
2021-01-19 10:31:25 -08:00
Fabrice Fontaine
e1803dc145 programs/prog_util.h: include sys/types.h
Include sys/types.h to avoid the following build failure on uclibc:

In file included from programs/gzip.c:28:0:
programs/prog_util.h:159:1: error: unknown type name ‘ssize_t’
 ssize_t xread(struct file_stream *strm, void *buf, size_t count);
 ^

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-12-28 10:40:02 -08:00
Eric Biggers
60b6197fa6 ci.yml: run 'apt-get update' prior to 'apt-get install'
This hopefully will prevent the following error:

    E: Failed to fetch http://azure.archive.ubuntu.com/ubuntu/pool/main/g/glibc/libc6-dbg_2.27-3ubuntu1.3_amd64.deb  404  Not Found
    E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
2020-12-25 12:08:45 -08:00
Eric Biggers
4a0bb736c9 lib: make freestanding memset() et al. symbols "weak"
This allows these symbols to be overridden by another definition of
these symbols somewhere else in the binary.

Resolves https://github.com/ebiggers/libdeflate/issues/107
2020-11-23 18:47:15 -08:00
Eric Biggers
e2f9d07050 Remove Travis CI badge
No longer applicable, now that we're using GitHub Actions instead.
2020-11-21 15:31:23 -08:00
Eric Biggers
72e9ef0791 Switch from Travis CI to GitHub Actions 2020-11-21 13:31:29 -08:00
Eric Biggers
e958f1c997 scripts/gzip_tests.sh: eliminate dependency on xxd
Use an equivalent echo command so that the xxd program doesn't have to
be installed.
2020-11-21 13:31:29 -08:00
Eric Biggers
7be9d514f8 scripts/gzip_tests.sh: when root, skip test that requires non-root 2020-11-21 13:31:29 -08:00
Eric Biggers
9f257c0123 scripts/android_tests.sh: add missing executable bit 2020-11-21 13:31:29 -08:00
Eric Biggers
5e57cbd70c scripts/android_tests.sh: clean up all temporary files
bash traps don't stack, so libdeflate_testdata wasn't being deleted.

Also sync the code with run_tests.sh.
2020-11-21 13:31:29 -08:00
Eric Biggers
6c41ede3ac scripts/run_tests.sh: allow skipping more types of tests 2020-11-21 13:31:29 -08:00
Eric Biggers
3e8bdbb401 scripts/run_tests.sh: clean up all temporary files
bash traps don't stack, so libdeflate_testdata wasn't being deleted.
2020-11-21 13:31:29 -08:00
Eric Biggers
8aedcdc12b scripts/run_tests.sh: use llvm-ar for CFI build
This is needed on Ubuntu 20.04, otherwise creating the static library
fails with -flto.
2020-11-21 13:31:29 -08:00
Eric Biggers
448e3f3b04 v1.7 v1.7 2020-11-09 19:29:50 -08:00
4kills
fc1acab71a readme: added table of contents 2020-11-07 10:42:37 -08:00
djytw
bef1e93b70 Makefile.msc: fix clean task 2020-11-07 09:21:16 -08:00
Eric Biggers
f8057e8805 lib/matchfinder: document matchfinder_rebase() preconditions 2020-10-28 19:20:30 -07:00
Eric Biggers
6d66819651 scripts/run_tests.sh: show ldd output if binary isn't dynamically linked 2020-10-28 19:19:48 -07:00
Eric Biggers
952329aeb9 scripts/run_tests.sh: silence some build output 2020-10-26 00:05:30 -07:00
Eric Biggers
ff8634427b lib/matchfinder: simplify init and rebase
Remove the ability of matchfinder_init() and matchfinder_rebase() to
fail due to the matchfinder memory size being misaligned.  Instead,
require that the size always be 128-byte aligned -- which is already the
case.  Also, make the matchfinder memory always be 32-byte aligned --
which doesn't really have any downside.
2020-10-25 22:42:25 -07:00
Eric Biggers
f2f6a6e396 Makefile: support linking programs to shared library
Most Linux distributions want dynamic linking rather than static
linking, so support this via 'make USE_SHARED_LIB=1'.
2020-10-25 22:03:08 -07:00
Eric Biggers
2bfee0204c Makefile: add missing settings to rebuild logic
The Makefile didn't trigger a rebuild if some settings changed, e.g.
LDFLAGS or DECOMPRESSION_ONLY.  Fix this.

Also simplify the rebuild logic by not handling the library and programs
separately, as this optimization doesn't seem to be worthwhile.
2020-10-25 21:36:19 -07:00
Eric Biggers
7ba3155c17 programs: rename program_invocation_name to prog_invocation_name
Avoid confusion with the GNU extension 'program_invocation_name', which
is described by 'man 3 program_invocation_name'.  The GNU version isn't
supposed to be exposed without defining _GNU_SOURCE, which we don't in
any of the relevant files, but it's best to avoid any confusion.
2020-10-25 20:49:27 -07:00
Eric Biggers
25a591b94e libdeflate.h: fix adler parameter name
This is supposed to be just 'adler', not 'adler32'.
2020-10-18 23:07:03 -07:00
Eric Biggers
166084acaa lib/deflate_compress: select min_size_to_compress based on level
The cutoff for outputting uncompressed data is currently < 16 bytes for
all compression levels.  That isn't ideal, since the higher the
compression level, the more we should bother with very small inputs; and
the lower the compression level, the less we should bother.

Use a formula that produces the following cutoffs:

        Level  Cutoff
        -----  ------
        0      56
        1      52
        2      48
        3      44
        4      40
        5      36
        6      32
        7      28
        8      24
        9      20
        10     16
        11     12
        12     8

Update https://github.com/ebiggers/libdeflate/issues/67
2020-10-18 18:37:51 -07:00
Eric Biggers
a2d92667b5 scripts/run_tests.sh: add CFI tests 2020-10-18 15:14:15 -07:00
Eric Biggers
3b4a590f10 scripts/run_tests.sh: add ASAN tests 2020-10-18 15:14:15 -07:00
Eric Biggers
3b12acdf32 scripts/run_tests.sh: test for correct symbol prefixes 2020-10-18 15:14:15 -07:00
Eric Biggers
3a378845c4 scripts/run_tests.sh: test 'make install' and 'make uninstall' 2020-10-18 15:14:15 -07:00
Eric Biggers
ef5a23a65f travis.yml: add shellcheck job 2020-10-18 15:14:15 -07:00
Eric Biggers
5c06c57435 Makefile: add shellcheck target 2020-10-18 15:14:15 -07:00
Eric Biggers
6eb61145a0 travis.yml: improve job specifications
Improve the list of Travis CI jobs by using the build matrix feature to
test all combinations of compilers and architectures on the latest
version of Ubuntu, and by adding more jobs for older versions of Ubuntu.
2020-10-18 15:14:15 -07:00
Eric Biggers
0a9254fb49 scripts/run_tests.sh: refactor and allow specifying CC and CFLAGS
Don't try to detect and use different compilers, since it's better to
specify this via the environment (e.g. via the Travis CI build matrix).

While doing this, also deduplicate the logic for testing with valgrind
and UBSAN, improve the log messages, and add a test with -O3.
2020-10-18 15:14:15 -07:00
Eric Biggers
0a32a34da5 scripts/run_tests.sh: fix a shellcheck warning 2020-10-18 15:14:15 -07:00
Eric Biggers
fb3bbaad0b scripts/run_tests.sh: define $MAKE variable
... so that we don't have to remember to add -j everytime.  Also switch
to a better way of getting the number of processors.
2020-10-18 15:14:15 -07:00
Eric Biggers
de4f3f4bb7 scripts/run_tests.sh: remove concept of skipping tests
Just require that the needed programs have been installed.
2020-10-18 15:14:15 -07:00
Eric Biggers
634291abd6 scripts/run_tests.sh: remove concept of test groups
Now that run_tests.sh has been cleaned up to remove (or move) test
groups that weren't very useful, remove the concept of test groups and
just run all the tests.
2020-10-18 15:14:15 -07:00
Eric Biggers
63efed8dee scripts/run_tests.sh: remove windows_tests
To further trim down run_tests.sh, move the functionality of
windows_tests() directly into .travis.yml.
2020-10-18 15:14:15 -07:00