-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "--comment" support to tools/bro.cc. Add build script to build to…
…ols/bro.cc
- Loading branch information
1 parent
a933e15
commit 1a16703
Showing
4 changed files
with
79 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
*.o | ||
*.pyc | ||
*.txt.uncompressed | ||
*.bro | ||
*.unbro | ||
tools/bro | ||
build/ | ||
dist/ | ||
*.o | ||
*.pyc | ||
*.txt.uncompressed | ||
*.bro | ||
*.unbro | ||
tools/bro | ||
build/ | ||
dist/ | ||
cmake/ | ||
commits.txt |
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,10 @@ | ||
cmake_minimum_required(VERSION 2.8.6) | ||
project(brotli) | ||
|
||
set(CMAKE_BUILD_TYPE Release) | ||
|
||
FILE(GLOB_RECURSE enc enc/*.cc) | ||
FILE(GLOB_RECURSE dec dec/*.c) | ||
list(FILTER dec EXCLUDE REGEX ".*dec[/]dictionary[.]c$") # this is a duplicate of definitions in enc | ||
|
||
add_executable(brotli ${enc} ${dec} tools/bro.cc) |
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,45 @@ | ||
# Controls running cmake, building, and copying files to the dist folder for the various | ||
# platforms. | ||
import os | ||
import shutil | ||
import sys | ||
import subprocess | ||
|
||
# build the brotli exe using cmake | ||
if not os.path.exists('cmake'): | ||
os.mkdir('cmake') | ||
|
||
os.chdir('cmake') | ||
|
||
if sys.platform == 'win32': | ||
os.system('cmake -G "NMake Makefiles" ..') | ||
os.system('nmake') | ||
else: | ||
os.system('cmake -G "Unix Makefiles" ..') | ||
os.system('make') | ||
|
||
os.chdir('..') | ||
|
||
# Copy the build to the dist folder | ||
if not os.path.exists('dist'): | ||
os.mkdir('dist') | ||
|
||
if sys.platform == 'win32': | ||
if not os.path.exists('dist/win_x86_64'): | ||
os.mkdir('dist/win_x86_64') | ||
shutil.copy2('cmake/brotli.exe', 'dist/win_x86_64/brotli.exe') | ||
elif sys.platform == 'darwin': | ||
if not os.path.exists('dist/macos_x86_64'): | ||
os.mkdir('dist/macos_x86_64') | ||
shutil.copy2('cmake/brotli', 'dist/macos_x86_64/brotli') | ||
else: | ||
if not os.path.exists('dist/linux_x86_64'): | ||
os.mkdir('dist/linux_x86_64') | ||
shutil.copy2('cmake/brotli', 'dist/linux_x86_64/brotli') | ||
|
||
|
||
# Create the commits.txt file | ||
commits = open('dist/commits.txt', 'w') | ||
subprocess.run('git config --get remote.origin.url', shell=True, stdout=commits) | ||
subprocess.run('git rev-parse HEAD', shell=True, stdout=commits) | ||
commits.close() |
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