Skip to content

Commit

Permalink
feat: Init commit
Browse files Browse the repository at this point in the history
init lz4

Log:
  • Loading branch information
Deepin Developer committed Aug 15, 2022
0 parents commit 217ebfe
Show file tree
Hide file tree
Showing 183 changed files with 35,403 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# This configuration was automatically generated from a CircleCI 1.0 config.
# It should include any build commands you had along with commands that CircleCI
# inferred from your project structure. We strongly recommend you read all the
# comments in this file to understand the structure of CircleCI 2.0, as the idiom
# for configuration has changed substantially in 2.0 to allow arbitrary jobs rather
# than the prescribed lifecycle of 1.0. In general, we recommend using this generated
# configuration as a reference rather than using it in production, though in most
# cases it should duplicate the execution of your original 1.0 config.
version: 2
jobs:
build:
working_directory: ~/lz4/lz4
# Parallelism is broken in this file : it just plays the same tests twice.
# The script will have to be modified to support parallelism properly
# In the meantime, set it to 1.
parallelism: 1
shell: /bin/bash --login
# CircleCI 2.0 does not support environment variables that refer to each other the same way as 1.0 did.
# If any of these refer to each other, rewrite them so that they don't or see https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables .
environment:
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
# In CircleCI 1.0 we used a pre-configured image with a large number of languages and other packages.
# In CircleCI 2.0 you can now specify your own image, or use one of our pre-configured images.
# The following configuration line tells CircleCI to use the specified docker image as the runtime environment for you job.
# We have selected a pre-built image that mirrors the build environment we use on
# the 1.0 platform, but we recommend you choose an image more tailored to the needs
# of each job. For more information on choosing an image (or alternatively using a
# VM instead of a container) see https://circleci.com/docs/2.0/executor-types/
# To see the list of pre-built images that CircleCI provides for most common languages see
# https://circleci.com/docs/2.0/circleci-images/
docker:
- image: fbopensource/lz4-circleci-primary:0.0.4
steps:
# Machine Setup
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
# The following `checkout` command checks out your code to your working directory. In 1.0 we did this implicitly. In 2.0 you can choose where in the course of a job your code should be checked out.
- checkout
# Prepare for artifact and test results collection equivalent to how it was done on 1.0.
# In many cases you can simplify this from what is generated here.
# 'See docs on artifact collection here https://circleci.com/docs/2.0/artifacts/'
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
# Test
# This would typically be a build job when using workflows, possibly combined with build
# This is based on your 1.0 configuration file or project settings
- run: CFLAGS= make clangtest && make clean
- run: g++ -v; make gpptest && make clean
- run: gcc -v; g++ -v; make ctocpptest && make clean
- run: gcc-5 -v; CC=gcc-5 CFLAGS="-O2 -Werror" make check && make clean
- run: gcc-5 -v; CC=gcc-5 CFLAGS="-O2 -m32 -Werror" CPPFLAGS=-I/usr/include/x86_64-linux-gnu make check && make clean
- run: gcc-6 -v; CC=gcc-6 MOREFLAGS="-O2 -Werror" make check && make clean
- run: make cmake && make clean
- run: make -C tests test-lz4
- run: make -C tests test-lz4c
- run: make -C tests test-frametest
- run: make -C tests test-fuzzer && make clean
- run: make -C lib all && make clean
- run: pyenv global 3.4.4; make versionsTest MOREFLAGS=-I/usr/include/x86_64-linux-gnu && make clean
- run: make travis-install && make clean
- run: gcc -v; CFLAGS="-O2 -m32 -Werror" CPPFLAGS=-I/usr/include/x86_64-linux-gnu make check && make clean
- run: clang -v; make staticAnalyze && make clean
- run: make platformTest CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static && make clean
- run: make platformTest CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static MOREFLAGS=-m64 && make clean
- run: make platformTest CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static && make clean
- run: make platformTest CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static && make clean
# Teardown
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
# Save test results
- store_test_results:
path: /tmp/circleci-test-results
# Save artifacts
- store_artifacts:
path: /tmp/circleci-artifacts
- store_artifacts:
path: /tmp/circleci-test-results
12 changes: 12 additions & 0 deletions .circleci/images/primary/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM circleci/buildpack-deps:bionic

RUN sudo apt-get -y -qq update
RUN sudo apt-get -y install software-properties-common
RUN sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
RUN sudo apt-get -y install cmake
RUN sudo apt-get -y install qemu-system-ppc qemu-user-static qemu-system-arm
RUN sudo apt-get -y install libc6-dev-armel-cross libc6-dev-arm64-cross libc6-dev-i386
RUN sudo apt-get -y install clang clang-tools
RUN sudo apt-get -y install gcc-5 gcc-5-multilib gcc-6
RUN sudo apt-get -y install valgrind
RUN sudo apt-get -y install gcc-multilib-powerpc-linux-gnu gcc-powerpc-linux-gnu gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu
5 changes: 5 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
freebsd_instance:
image_family: freebsd-12-1

task:
script: pkg install -y gmake && gmake test
21 changes: 21 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Set the default behavior
* text eol=lf

# Explicitly declare source files
*.c text eol=lf
*.h text eol=lf

# Denote files that should not be modified.
*.odt binary
*.png binary

# Visual Studio
*.sln text eol=crlf
*.vcxproj* text eol=crlf
*.vcproj* text eol=crlf
*.suo binary
*.rc text eol=crlf

# Windows
*.bat text eol=crlf
*.cmd text eol=crlf
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.pc/
1 change: 1 addition & 0 deletions .projectinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"project":"lz4","type":"","version":" 1.9.3-2","hierarchy":"base","priority":"","maintainer":"","packager":"","builddeps":" debhelper-compat (= 13), python3:any \u003c!nocheck\u003e, ","homepage":" https://github.com/Cyan4973/lz4","git":"https://github.com/lz4/lz4"}
236 changes: 236 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
language: c

matrix:
fast_finish: true
include:
# OS X Mavericks
- name: (macOS) General Test
os: osx
compiler: clang
script:
- make # test library build
- make clean
- make test MOREFLAGS='-Werror -Wconversion -Wno-sign-conversion' | tee # test scenario where `stdout` is not the console

# Container-based 12.04 LTS Server Edition 64 bit (doesn't support 32-bit includes)
- name: (Precise) benchmark test
dist: precise
script:
- make -C tests test-lz4 test-lz4c test-fullbench

- name: (Precise) frame and fuzzer test
dist: precise
install:
- sudo sysctl -w vm.mmap_min_addr=4096
script:
- make -C tests test-frametest test-fuzzer

- name: ASAN tests with fuzzer and frametest
install:
- sudo sysctl -w vm.mmap_min_addr=4096
script:
- CC=clang MOREFLAGS=-fsanitize=address make -C tests test-frametest test-fuzzer

- name: Custom LZ4_DISTANCE_MAX ; lz4-wlib (CLI linked to dynamic library); LZ4_USER_MEMORY_FUNCTIONS
script:
- MOREFLAGS=-DLZ4_DISTANCE_MAX=8000 make check
- make clean
- make -C programs lz4-wlib
- make clean
- make -C tests fullbench-wmalloc # test LZ4_USER_MEMORY_FUNCTIONS
- make clean
- CC="c++ -Wno-deprecated" make -C tests fullbench-wmalloc # stricter function signature check

- name: (Precise) g++ and clang CMake test
dist: precise
script:
- make gpptest
- make clean
- make examples
- make clean cmake
- make clean travis-install
- make clean clangtest

- name: x32 compatibility test
addons:
apt:
packages:
- gcc-multilib
script:
- make -C tests test MOREFLAGS=-mx32

# 14.04 LTS Server Edition 64 bit
# presume clang >= v3.9.0
- name: (Trusty) USan test
dist: trusty
compiler: clang
script:
- make usan MOREFLAGS=-Wcomma -Werror

- name: (Trusty) valgrind test
dist: trusty
install:
- sudo apt-get install -qq valgrind
script:
- make c_standards
- make -C tests test-lz4 test-mem

- name: (Trusty) c-to-c++ test
dist: trusty
script:
- make ctocpptest

- name: (Trusty) i386 benchmark + version test
dist: trusty
install:
- sudo apt-get install -qq python3 libc6-dev-i386 gcc-multilib
script:
- make -C tests test-lz4c32 test-fullbench32 versionsTest

- name: (Trusty) i386 frame + fuzzer test
dist: trusty
install:
- sudo apt-get install -qq libc6-dev-i386 gcc-multilib
- sudo sysctl -w vm.mmap_min_addr=4096
script:
- make -C tests test-frametest32 test-fuzzer32

- name: (Trusty) gcc-6 standard C compilation
dist: trusty
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-6
env:
- CC=gcc-6
script:
- make c_standards
- make -C tests test-lz4 MOREFLAGS=-Werror

- name: (Trusty) arm + aarch64 compilation
dist: trusty
install:
- sudo apt-get install -qq
qemu-system-arm
qemu-user-static
gcc-arm-linux-gnueabi
libc6-dev-armel-cross
gcc-aarch64-linux-gnu
libc6-dev-arm64-cross
script:
- make platformTest CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static
- make platformTest CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static

- name: aarch64 real-hw tests
arch: arm64
script:
- make test

- name: PPC64LE real-hw tests
arch: ppc64le
script:
- make test

- name: IBM s390x real-hw tests
arch: s390x
script:
- make test

- name: (Xenial) gcc-5 compilation
dist: xenial
install:
- sudo apt-get install -qq libc6-dev-i386 gcc-multilib
script:
- make -C tests test-lz4 clean test-lz4c32 MOREFLAGS=-Werror

- name: (Trusty) clang-3.8 compilation
dist: trusty
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
packages:
- clang-3.8
script:
- make -C tests test-lz4 CC=clang-3.8

- name: (Trusty) PowerPC + PPC64 compilation
dist: trusty
install:
- sudo apt-get install -qq qemu-system-ppc qemu-user-static gcc-powerpc-linux-gnu
script:
- make platformTest CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static
- make platformTest CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static MOREFLAGS=-m64

- name: (Trusty) scan-build + cppcheck
dist: trusty
compiler: clang
install:
- sudo apt-get install -qq cppcheck
script:
- make staticAnalyze
- make cppcheck

- name: (Trusty) gcc-4.4 compilation
dist: trusty
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libc6-dev-i386
- gcc-multilib
- gcc-4.4
script:
- make clean all CC=gcc-4.4 MOREFLAGS=-Werror
- make clean
- CFLAGS=-fPIC LDFLAGS='-pie -fPIE -D_FORTIFY_SOURCE=2' make -C programs

# tag-specific test
- name: tag build
if: tag =~ ^v[0-9]\.[0-9]
os: linux
script:
- make -C tests checkTag
- tests/checkTag "$TRAVIS_BRANCH"

- name: (Xenial) Meson + clang build
#env: ALLOW_FAILURES=true
dist: xenial
language: cpp
compiler: clang
install:
- sudo apt-get install -qq python3 tree
- |
travis_retry curl -o ~/ninja.zip -L 'https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip' &&
unzip ~/ninja.zip -d ~/.local/bin
- |
travis_retry curl -o ~/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' &&
python3 ~/get-pip.py --user &&
pip3 install --user meson
script:
- |
meson setup \
--buildtype=debug \
-Db_lundef=false \
-Dauto_features=enabled \
-Ddefault_library=both \
-Dbin_programs=true \
-Dbin_contrib=true \
-Dbin_tests=true \
-Dbin_examples=true \
contrib/meson build
- pushd build
- DESTDIR=./staging ninja install
- tree ./staging

# oss-fuzz compilation test
- name: Compile OSS-Fuzz targets
script:
- ./ossfuzz/travisoss.sh

allow_failures:
- env: ALLOW_FAILURES=true
16 changes: 16 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Installation
=============

```
make
make install # this command may require root access
```

LZ4's `Makefile` supports standard [Makefile conventions],
including [staged installs], [redirection], or [command redefinition].
It is compatible with parallel builds (`-j#`).

[Makefile conventions]: https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html
[staged installs]: https://www.gnu.org/prep/standards/html_node/DESTDIR.html
[redirection]: https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
[command redefinition]: https://www.gnu.org/prep/standards/html_node/Utilities-in-Makefiles.html
11 changes: 11 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
This repository uses 2 different licenses :
- all files in the `lib` directory use a BSD 2-Clause license
- all other files use a GPLv2 license, unless explicitly stated otherwise

Relevant license is reminded at the top of each source file,
and with presence of COPYING or LICENSE file in associated directories.

This model is selected to emphasize that
files in the `lib` directory are designed to be included into 3rd party applications,
while all other files, in `programs`, `tests` or `examples`,
receive more limited attention and support for such scenario.
Loading

0 comments on commit 217ebfe

Please sign in to comment.