Move files & update paths (#541)

* Move files & update paths

* Rename build to scripts.

* Fix paths

* Fix script.
This commit is contained in:
Eugene Kliuchnikov 2017-04-23 14:07:08 +02:00 committed by GitHub
parent 04de756ad2
commit 6ece1d8791
98 changed files with 150 additions and 152 deletions

2
.gitmodules vendored
View File

@ -1,5 +1,5 @@
[submodule "terryfy"]
path = terryfy
path = scripts/terryfy
url = https://github.com/MacPython/terryfy.git
[submodule "research/esaxx"]
path = research/esaxx

View File

@ -250,17 +250,17 @@ before_install:
###
- if [ -n "${C_COMPILER}" ]; then export CC="${C_COMPILER}"; fi
- if [ -n "${CXX_COMPILER}" ]; then export CXX="${CXX_COMPILER}"; fi
- ./.travis.sh before_install
- scripts/.travis.sh before_install
install:
- ./.travis.sh install
- scripts/.travis.sh install
script:
- ./.travis.sh script
- scripts/.travis.sh script
after_success:
- ./.travis.sh after_success
- scripts/.travis.sh after_success
before_deploy:
- if [ "${BUILD_SYSTEM}" = "python" ] && [ "${TRAVIS_OS_NAME}" = "osx" ]; then export WHEELS=$(ls ./dist/*.whl); fi
- ./.travis.sh before_deploy
- scripts/.travis.sh before_deploy
deploy:
- provider: releases
@ -273,7 +273,7 @@ deploy:
tags: true
condition: "${BUILD_SYSTEM} = python && ${TRAVIS_OS_NAME} = osx"
- provider: bintray
file: ".bintray.json"
file: "scripts/.bintray.json"
user: "eustas"
key:
secure: "Kbam/lTAdz72fZivbs6riJT+Y4PbuKP7r6t5PAWxJxAAykjwnYTRe3zF472g9HCE14KYMsdB+KSYSgg6TGJnqGC9gL9xhhGU9U/WmA+vbMWS/MSnMWpK9IRpp77pM2i2NKZD4v33JuEwKFCBJP3Vj6QQ5Qd1NKdobuXJyznhgnw="

18
BUILD
View File

@ -25,44 +25,44 @@ STRICT_C_OPTIONS = [
filegroup(
name = "public_headers",
srcs = glob(["include/brotli/*.h"]),
srcs = glob(["c/include/brotli/*.h"]),
)
filegroup(
name = "common_headers",
srcs = glob(["common/*.h"]),
srcs = glob(["c/common/*.h"]),
)
filegroup(
name = "common_sources",
srcs = glob(["common/*.c"]),
srcs = glob(["c/common/*.c"]),
)
filegroup(
name = "dec_headers",
srcs = glob(["dec/*.h"]),
srcs = glob(["c/dec/*.h"]),
)
filegroup(
name = "dec_sources",
srcs = glob(["dec/*.c"]),
srcs = glob(["c/dec/*.c"]),
)
filegroup(
name = "enc_headers",
srcs = glob(["enc/*.h"]),
srcs = glob(["c/enc/*.h"]),
)
filegroup(
name = "enc_sources",
srcs = glob(["enc/*.c"]),
srcs = glob(["c/enc/*.c"]),
)
cc_library(
name = "brotli",
hdrs = [":public_headers"],
copts = STRICT_C_OPTIONS,
includes = ["include"],
includes = ["c/include"],
)
cc_library(
@ -92,7 +92,7 @@ cc_library(
cc_binary(
name = "bro",
srcs = ["tools/bro.c"],
srcs = ["c/tools/bro.c"],
copts = STRICT_C_OPTIONS,
linkstatic = 1,
deps = [

View File

@ -73,7 +73,7 @@ function(hex_to_dec HEXADECIMAL DECIMAL)
endfunction(hex_to_dec)
# Version information
file(STRINGS "common/version.h" _brotli_version_line REGEX "^#define BROTLI_VERSION (0x[0-9a-fA-F]+)$")
file(STRINGS "c/common/version.h" _brotli_version_line REGEX "^#define BROTLI_VERSION (0x[0-9a-fA-F]+)$")
string(REGEX REPLACE "^#define BROTLI_VERSION 0x([0-9a-fA-F]+)$" "\\1" _brotli_version_hex "${_brotli_version_line}")
hex_to_dec("${_brotli_version_hex}" _brotli_version)
math(EXPR BROTLI_VERSION_MAJOR "${_brotli_version} >> 24")
@ -112,7 +112,7 @@ if(NOT LOG2_RES)
endif()
unset(LOG2_RES)
set(BROTLI_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(BROTLI_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/c/include")
set(BROTLI_LIBRARIES_CORE brotlienc brotlidec brotlicommon)
set(BROTLI_LIBRARIES ${BROTLI_LIBRARIES_CORE} ${LIBM_LIBRARY})
mark_as_advanced(BROTLI_INCLUDE_DIRS BROTLI_LIBRARIES)
@ -126,30 +126,30 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
endif()
add_library(brotlicommon
common/dictionary.c)
c/common/dictionary.c)
add_library(brotlidec
dec/bit_reader.c
dec/decode.c
dec/huffman.c
dec/state.c)
c/dec/bit_reader.c
c/dec/decode.c
c/dec/huffman.c
c/dec/state.c)
add_library(brotlienc
enc/backward_references.c
enc/backward_references_hq.c
enc/bit_cost.c
enc/block_splitter.c
enc/brotli_bit_stream.c
enc/cluster.c
enc/compress_fragment.c
enc/compress_fragment_two_pass.c
enc/dictionary_hash.c
enc/encode.c
enc/entropy_encode.c
enc/histogram.c
enc/literal_cost.c
enc/memory.c
enc/metablock.c
enc/static_dict.c
enc/utf8_util.c)
c/enc/backward_references.c
c/enc/backward_references_hq.c
c/enc/bit_cost.c
c/enc/block_splitter.c
c/enc/brotli_bit_stream.c
c/enc/cluster.c
c/enc/compress_fragment.c
c/enc/compress_fragment_two_pass.c
c/enc/dictionary_hash.c
c/enc/encode.c
c/enc/entropy_encode.c
c/enc/histogram.c
c/enc/literal_cost.c
c/enc/memory.c
c/enc/metablock.c
c/enc/static_dict.c
c/enc/utf8_util.c)
# Older CMake versions does not understand INCLUDE_DIRECTORIES property.
include_directories(${BROTLI_INCLUDE_DIRS})
@ -182,7 +182,7 @@ if(BROTLI_PARENT_DIRECTORY)
endif()
# Build the bro executable
add_executable(bro tools/bro.c)
add_executable(bro c/tools/bro.c)
target_link_libraries(bro ${BROTLI_LIBRARIES})
# Installation
@ -229,9 +229,9 @@ if(NOT BROTLI_DISABLE_TESTS)
tests/testdata/asyoulik.txt
tests/testdata/lcet10.txt
tests/testdata/plrabn12.txt
enc/encode.c
common/dictionary.h
dec/decode.c)
c/enc/encode.c
c/common/dictionary.h
c/dec/decode.c)
foreach(INPUT ${ROUNDTRIP_INPUTS})
get_filename_component(OUTPUT_NAME "${INPUT}" NAME)

View File

@ -1,11 +1,11 @@
include CONTRIBUTING.md
include common/*.c
include common/*.h
include dec/*.c
include dec/*.h
include enc/*.c
include enc/*.h
include include/brotli/*.h
include c/common/*.c
include c/common/*.h
include c/dec/*.c
include c/dec/*.h
include c/enc/*.c
include c/enc/*.h
include c/include/brotli/*.h
include LICENSE
include MANIFEST.in
include python/bro.py
@ -13,4 +13,4 @@ include python/brotlimodule.cc
include python/README.md
include README.md
include setup.py
include tools/bro.c
include c/tools/bro.c

View File

@ -1,14 +1,14 @@
OS := $(shell uname)
LIBSOURCES = $(wildcard common/*.c) $(wildcard dec/*.c) $(wildcard enc/*.c)
SOURCES = $(LIBSOURCES) tools/bro.c
LIBSOURCES = $(wildcard c/common/*.c) $(wildcard c/dec/*.c) $(wildcard c/enc/*.c)
SOURCES = $(LIBSOURCES) c/tools/bro.c
BINDIR = bin
OBJDIR = $(BINDIR)/obj
LIBOBJECTS = $(addprefix $(OBJDIR)/, $(LIBSOURCES:.c=.o))
OBJECTS = $(addprefix $(OBJDIR)/, $(SOURCES:.c=.o))
LIB_A = libbrotli.a
EXECUTABLE = bro
DIRS = $(OBJDIR)/common $(OBJDIR)/dec $(OBJDIR)/enc \
$(OBJDIR)/tools $(BINDIR)/tmp
DIRS = $(OBJDIR)/c/common $(OBJDIR)/c/dec $(OBJDIR)/c/enc \
$(OBJDIR)/c/tools $(BINDIR)/tmp
CFLAGS += -O2
ifeq ($(os), Darwin)
CPPFLAGS += -DOS_MACOSX
@ -38,5 +38,5 @@ clean:
.SECONDEXPANSION:
$(OBJECTS): $$(patsubst %.o,%.c,$$(patsubst $$(OBJDIR)/%,%,$$@)) | $(DIRS)
$(CC) $(CFLAGS) $(CPPFLAGS) -Iinclude \
$(CC) $(CFLAGS) $(CPPFLAGS) -Ic/include \
-c $(patsubst %.o,%.c,$(patsubst $(OBJDIR)/%,%,$@)) -o $@

View File

@ -32,8 +32,8 @@ PREFIX=/usr/local
LIBDIR=
CMAKE_ARGS=
if [ -e "${TOP_SRCDIR}/.configure-custom.sh" ]; then
. "${TOP_SRCDIR}/.configure-custom.sh"
if [ -e "${TOP_SRCDIR}/scripts/.configure-custom.sh" ]; then
. "${TOP_SRCDIR}/scripts/.configure-custom.sh"
fi
quote() {

View File

@ -4,7 +4,7 @@ configurations { "Release", "Debug" }
targetdir "bin"
location "buildfiles"
flags "RelativeLinks"
includedirs { "include" }
includedirs { "c/include" }
filter "configurations:Release"
optimize "Speed"
@ -29,43 +29,43 @@ configuration { "macosx" }
project "brotlicommon"
kind "SharedLib"
language "C"
files { "common/**.h", "common/**.c" }
files { "c/common/**.h", "c/common/**.c" }
project "brotlicommon_static"
kind "StaticLib"
targetname "brotlicommon"
language "C"
files { "common/**.h", "common/**.c" }
files { "c/common/**.h", "c/common/**.c" }
project "brotlidec"
kind "SharedLib"
language "C"
files { "dec/**.h", "dec/**.c" }
files { "c/dec/**.h", "c/dec/**.c" }
links "brotlicommon"
project "brotlidec_static"
kind "StaticLib"
targetname "brotlidec"
language "C"
files { "dec/**.h", "dec/**.c" }
files { "c/dec/**.h", "c/dec/**.c" }
links "brotlicommon_static"
project "brotlienc"
kind "SharedLib"
language "C"
files { "enc/**.h", "enc/**.c" }
files { "c/enc/**.h", "c/enc/**.c" }
links "brotlicommon"
project "brotlienc_static"
kind "StaticLib"
targetname "brotlienc"
language "C"
files { "enc/**.h", "enc/**.c" }
files { "c/enc/**.h", "c/enc/**.c" }
links "brotlicommon_static"
project "bro"
kind "ConsoleApp"
language "C"
linkoptions "-static"
files { "tools/bro.c" }
files { "c/tools/bro.c" }
links { "brotlicommon_static", "brotlidec_static", "brotlienc_static" }

View File

@ -28,7 +28,7 @@ case "$1" in
case "${BUILD_SYSTEM}" in
"python")
source terryfy/travis_tools.sh
source scripts/terryfy/travis_tools.sh
get_python_environment $INSTALL_TYPE $PYTHON_VERSION venv
pip install --upgrade wheel
;;
@ -91,7 +91,7 @@ case "$1" in
case "${BUILD_SYSTEM}" in
"bazel")
export RELEASE_DATE=`date +%Y-%m-%d`
perl -p -i -e 's/\$\{([^}]+)\}/defined $ENV{$1} ? $ENV{$1} : $&/eg' .bintray.json
perl -p -i -e 's/\$\{([^}]+)\}/defined $ENV{$1} ? $ENV{$1} : $&/eg' scripts/.bintray.json
zip -j9 brotli.zip bazel-bin/libbrotli*.a bazel-bin/libbrotli*.so bazel-bin/bro
;;
esac

View File

@ -4,7 +4,7 @@ environment:
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
# /E:ON and /V:ON options are not enabled in the batch script intepreter
# See: http://stackoverflow.com/a/13751649/163740
WITH_COMPILER: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_compiler.cmd"
WITH_COMPILER: "cmd /E:ON /V:ON /C .\\scripts\\run_with_compiler.cmd"
matrix:
- BUILD_SYSTEM: CMake
@ -49,14 +49,11 @@ environment:
PYTHON_VERSION: "3.5.0"
PYTHON_ARCH: "64"
# init:
# - "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%"
install:
- ps: |
if ($env:BUILD_SYSTEM -eq "Python") {
# install Python and pip when not already installed
if (-not(Test-Path($env:PYTHON))) { & appveyor\install.ps1 }
if (-not(Test-Path($env:PYTHON))) { & scripts\install_py.ps1 }
# prepend newly installed Python to the PATH
$env:Path = $env:PYTHON + ';' + $env:PYTHON + '\\Scripts;' + $env:PATH

147
setup.py
View File

@ -22,7 +22,7 @@ CURR_DIR = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
def get_version():
""" Return BROTLI_VERSION string as defined in 'common/version.h' file. """
version_file_path = os.path.join(CURR_DIR, 'common', 'version.h')
version_file_path = os.path.join(CURR_DIR, 'c', 'common', 'version.h')
version = 0
with open(version_file_path, 'r') as f:
for line in f:
@ -164,82 +164,83 @@ EXT_MODULES = [
'_brotli',
sources=[
'python/_brotli.cc',
'common/dictionary.c',
'dec/bit_reader.c',
'dec/decode.c',
'dec/huffman.c',
'dec/state.c',
'enc/backward_references.c',
'enc/backward_references_hq.c',
'enc/bit_cost.c',
'enc/block_splitter.c',
'enc/brotli_bit_stream.c',
'enc/cluster.c',
'enc/compress_fragment.c',
'enc/compress_fragment_two_pass.c',
'enc/dictionary_hash.c',
'enc/encode.c',
'enc/entropy_encode.c',
'enc/histogram.c',
'enc/literal_cost.c',
'enc/memory.c',
'enc/metablock.c',
'enc/static_dict.c',
'enc/utf8_util.c',
'c/common/dictionary.c',
'c/dec/bit_reader.c',
'c/dec/decode.c',
'c/dec/huffman.c',
'c/dec/state.c',
'c/enc/backward_references.c',
'c/enc/backward_references_hq.c',
'c/enc/bit_cost.c',
'c/enc/block_splitter.c',
'c/enc/brotli_bit_stream.c',
'c/enc/cluster.c',
'c/enc/compress_fragment.c',
'c/enc/compress_fragment_two_pass.c',
'c/enc/dictionary_hash.c',
'c/enc/encode.c',
'c/enc/entropy_encode.c',
'c/enc/histogram.c',
'c/enc/literal_cost.c',
'c/enc/memory.c',
'c/enc/metablock.c',
'c/enc/static_dict.c',
'c/enc/utf8_util.c',
],
depends=[
'common/constants.h',
'common/dictionary.h',
'common/port.h',
'common/version.h',
'dec/bit_reader.h',
'dec/context.h',
'dec/huffman.h',
'dec/port.h',
'dec/prefix.h',
'dec/state.h',
'dec/streams.h',
'dec/transform.h',
'enc/backward_references.h',
'enc/backward_references_hq.h',
'enc/backward_references_inc.h',
'enc/bit_cost.h',
'enc/bit_cost_inc.h',
'enc/block_splitter.h',
'enc/block_splitter_inc.h',
'enc/brotli_bit_stream.h',
'enc/cluster.h',
'enc/cluster_inc.h',
'enc/command.h',
'enc/compress_fragment.h',
'enc/compress_fragment_two_pass.h'
'enc/context.h',
'enc/dictionary_hash.h',
'enc/entropy_encode.h',
'enc/entropy_encode_static.h',
'enc/fast_log.h',
'enc/find_match_length.h',
'enc/hash.h',
'enc/hash_to_binary_tree_inc.h',
'enc/hash_longest_match64_inc.h',
'enc/hash_longest_match_inc.h',
'enc/hash_longest_match_quickly_inc.h',
'enc/histogram.h',
'enc/histogram_inc.h',
'enc/literal_cost.h',
'enc/memory.h',
'enc/metablock.h',
'enc/metablock_inc.h',
'enc/port.h',
'enc/prefix.h',
'enc/ringbuffer.h',
'enc/static_dict.h',
'enc/static_dict_lut.h',
'enc/utf8_util.h',
'enc/write_bits.h',
'c/common/constants.h',
'c/common/dictionary.h',
'c/common/version.h',
'c/dec/bit_reader.h',
'c/dec/context.h',
'c/dec/huffman.h',
'c/dec/port.h',
'c/dec/prefix.h',
'c/dec/state.h',
'c/dec/transform.h',
'c/enc/backward_references.h',
'c/enc/backward_references_hq.h',
'c/enc/backward_references_inc.h',
'c/enc/bit_cost.h',
'c/enc/bit_cost_inc.h',
'c/enc/block_encoder_inc.h',
'c/enc/block_splitter.h',
'c/enc/block_splitter_inc.h',
'c/enc/brotli_bit_stream.h',
'c/enc/cluster.h',
'c/enc/cluster_inc.h',
'c/enc/command.h',
'c/enc/compress_fragment.h',
'c/enc/compress_fragment_two_pass.h'
'c/enc/context.h',
'c/enc/dictionary_hash.h',
'c/enc/entropy_encode.h',
'c/enc/entropy_encode_static.h',
'c/enc/fast_log.h',
'c/enc/find_match_length.h',
'c/enc/hash.h',
'c/enc/hash_forgetful_chain_inc.h',
'c/enc/hash_longest_match64_inc.h',
'c/enc/hash_longest_match_inc.h',
'c/enc/hash_longest_match_quickly_inc.h',
'c/enc/hash_to_binary_tree_inc.h',
'c/enc/histogram.h',
'c/enc/histogram_inc.h',
'c/enc/literal_cost.h',
'c/enc/memory.h',
'c/enc/metablock.h',
'c/enc/metablock_inc.h',
'c/enc/port.h',
'c/enc/prefix.h',
'c/enc/quality.h',
'c/enc/ringbuffer.h',
'c/enc/static_dict.h',
'c/enc/static_dict_lut.h',
'c/enc/utf8_util.h',
'c/enc/write_bits.h',
],
include_dirs=[
'include',
'c/include',
],
language='c++'),
]

View File

@ -13,5 +13,5 @@ deps :
clean :
rm -f testdata/*.{bro,unbro,uncompressed}
rm -f $(BROTLI)/{enc,dec,tools}/*.{un,}bro
$(MAKE) -C $(BROTLI)/tools clean
rm -f $(BROTLI)/c/{enc,dec,tools}/*.{un,}bro
$(MAKE) -C $(BROTLI)/c/tools clean

View File

@ -11,9 +11,9 @@ tests/testdata/alice29.txt
tests/testdata/asyoulik.txt
tests/testdata/lcet10.txt
tests/testdata/plrabn12.txt
enc/encode.c
common/dictionary.h
dec/decode.c
c/enc/encode.c
c/common/dictionary.h
c/dec/decode.c
$BRO
"""