grub/grub-core
Nick Terrell 461f1d8af1 zstd: Import upstream zstd-1.3.6
- Import zstd-1.3.6 from upstream
- Add zstd's module.c file
- Add the zstd module to Makefile.core.def

Import zstd-1.3.6 from upstream [1]. Only the files need for decompression
are imported. I used the latest zstd release, which includes patches [2] to
build cleanly in GRUB.

I included the script used to import zstd-1.3.6 below at the bottom of the
commit message.

Upstream zstd commit hash: 4fa456d7f12f8b27bd3b2f5dfd4f46898cb31c24
Upstream zstd commit name: Merge pull request #1354 from facebook/dev

Zstd requires some posix headers, which it gets from posix_wrap.
This can be checked by inspecting the .Po files generated by automake,
which contain the header dependencies. After building run the command
`cat grub-core/lib/zstd/.deps-core/*.Po` to see the dependencies [3].
The only OS dependencies are:

- stddef.h, which is already a dependency in posix_wrap, and used for size_t
  by lzo and xz.
- stdarg.h, which comes from the grub/misc.h header, and we don't use in zstd.

All the types like uint64_t are typedefed to grub_uint64_t under the hood.
The only exception is size_t, which comes from stddef.h. This is already the
case for lzo and xz. I don't think there are any cross-compilation concerns,
because cross-compilers provide their own system headers (and it would already
be broken).

[1] https://github.com/facebook/zstd/releases/tag/v1.3.6
[2] https://github.com/facebook/zstd/pull/1344
[3] https://gist.github.com/terrelln/7a16b92f5a1b3aecf980f944b4a966c4

```

curl -L -O https://github.com/facebook/zstd/releases/download/v1.3.6/zstd-1.3.6.tar.gz
curl -L -O https://github.com/facebook/zstd/releases/download/v1.3.6/zstd-1.3.6.tar.gz.sha256
sha256sum --check zstd-1.3.6.tar.gz.sha256
tar xzf zstd-1.3.6.tar.gz

SRC_LIB="zstd-1.3.6/lib"
DST_LIB="grub-core/lib/zstd"
rm -rf $DST_LIB
mkdir -p $DST_LIB
cp $SRC_LIB/zstd.h $DST_LIB/
cp $SRC_LIB/common/*.[hc] $DST_LIB/
cp $SRC_LIB/decompress/*.[hc] $DST_LIB/
rm $DST_LIB/{pool.[hc],threading.[hc]}
rm -rf zstd-1.3.6*
echo SUCCESS!
```

Signed-off-by: Nick Terrell <terrelln@fb.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2018-11-26 23:09:45 +01:00
..
boot diskboot: Trivial correction on stale comments 2018-04-23 13:04:58 +02:00
bus ehci: Fix compilation on i386 2017-07-09 21:31:19 +02:00
commands verifiers: fix double close on pgp's sig file descriptor 2018-11-21 14:46:53 +01:00
disk verifiers: File type for fine-grained signature-verification controlling 2018-11-09 13:25:31 +01:00
efiemu verifiers: File type for fine-grained signature-verification controlling 2018-11-09 13:25:31 +01:00
font verifiers: File type for fine-grained signature-verification controlling 2018-11-09 13:25:31 +01:00
fs verifiers: File type for fine-grained signature-verification controlling 2018-11-09 13:25:31 +01:00
gdb i386, x86_64, ppc: fix switch fallthrough cases with GCC7 2017-04-04 19:23:55 +03:00
gettext verifiers: File type for fine-grained signature-verification controlling 2018-11-09 13:25:31 +01:00
gfxmenu verifiers: File type for fine-grained signature-verification controlling 2018-11-09 13:25:31 +01:00
gnulib i386, x86_64, ppc: fix switch fallthrough cases with GCC7 2017-04-04 19:23:55 +03:00
hello * grub-core/commands/gptsync.c: Fix typographic quoting. 2012-03-03 13:05:08 +01:00
hook * grub-core/hook/datehook.c (grub_read_hook_datetime): Small stylistic 2011-11-11 21:03:49 +01:00
io verifiers: File type for fine-grained signature-verification controlling 2018-11-09 13:25:31 +01:00
kern verifiers: File type for fine-grained signature-verification controlling 2018-11-09 13:25:31 +01:00
lib zstd: Import upstream zstd-1.3.6 2018-11-26 23:09:45 +01:00
loader arm64/xen: Fix too few arguments to function grub_create_loader_cmdline() 2018-11-21 14:44:50 +01:00
mmap Translate UEFI persistent memory type 2015-12-15 10:25:34 +03:00
net ofnet: Initialize structs in bootpath parser 2018-09-13 11:03:05 +02:00
normal verifiers: File type for fine-grained signature-verification controlling 2018-11-09 13:25:31 +01:00
osdep generic/blocklist: Fix implicit declaration of function grub_file_filter_disable_compression() 2018-11-21 14:45:33 +01:00
partmap msdos: Fix overflow in converting partition start and length into 512B blocks 2018-09-27 14:56:45 +02:00
parttool * grub-core/net/http.c: Add TRANSLATORS comments. 2012-03-05 16:42:26 +01:00
script yylex: Explicilty cast fprintf to void. 2017-08-14 14:11:43 +02:00
term efi/console: Fix the "enter" key not working on x86 tablets 2018-07-11 11:53:28 +02:00
tests Regenerate checksum.h with newer unifont. 2017-08-30 17:12:04 +02:00
video verifiers: File type for fine-grained signature-verification controlling 2018-11-09 13:25:31 +01:00
gdb_grub.in * grub-core/gdb_grub.in: Fix overflow and wrong field. 2013-10-14 03:40:20 +02:00
genemuinit.sh use MODULE_FILES for genemuinit* instead of MOD_FILES 2014-01-18 23:15:40 +04:00
genemuinitheader.sh use MODULE_FILES for genemuinit* instead of MOD_FILES 2014-01-18 23:15:40 +04:00
genmod.sh.in .mod files: Strip annobin annotations and .eh_frame, and their relocations 2018-03-05 14:08:22 +01:00
genmoddep.awk enforcing fixup 2017-08-14 16:27:10 +02:00
gensyminfo.sh.in Fix shebang for termux. 2017-05-03 12:49:31 +02:00
gensymlist.sh Make 'make check' work on emu. 2013-04-27 02:00:16 +02:00
gentrigtables.c * grub-core/gentrigtables.c: Make tables const. 2013-03-01 11:15:09 +01:00
gmodule.pl.in * grub-core/gmodule.pl.in: Accept newer binutils which output 2014-09-21 18:23:23 +02:00
gnulib-fix-gcc7-fallthrough.diff Add gnulib-fix-gcc7-fallthrough.diff 2017-04-04 19:37:47 +03:00
gnulib-fix-null-deref.diff Import new gnulib. 2013-04-11 21:12:46 +02:00
gnulib-fix-width.diff Import new gnulib. 2013-04-11 21:12:46 +02:00
gnulib-no-abort.diff Import new gnulib. 2013-04-11 21:12:46 +02:00
gnulib-no-gets.diff Import new gnulib. 2013-04-11 21:12:46 +02:00
Makefile.am arm: Delete unused efi support from loader/arm 2018-07-25 14:18:11 +02:00
Makefile.core.def zstd: Import upstream zstd-1.3.6 2018-11-26 23:09:45 +01:00
modinfo.sh.in Fix shebang for termux. 2017-05-03 12:49:31 +02:00