mirror of
https://github.com/QuasarApp/pe-parse.git
synced 2025-04-26 12:24:32 +00:00
Dockerfile, cmake: Simplify build (#111)
* Dockerfile, cmake: Simplify build Always use clang in the Dockerfile, and don't overspecify the build type. Additionally, drop -Weverything when building in Debug mode -- it has competing flags internally and isn't intended for actual builds. * Dockerfile: Set CC and CXX Ensures that we build with clang(++). * python/setup: Blacken
This commit is contained in:
parent
4b2aa738cb
commit
c5e9a09087
@ -7,15 +7,16 @@ LABEL creator "Trail of Bits"
|
|||||||
LABEL dockerfile_maintenance "William Woodruff <william@trailofbits>"
|
LABEL dockerfile_maintenance "William Woodruff <william@trailofbits>"
|
||||||
LABEL desc "Principled, lightweight C/C++ PE parser"
|
LABEL desc "Principled, lightweight C/C++ PE parser"
|
||||||
|
|
||||||
RUN apk add --no-cache cmake icu-dev build-base
|
RUN apk add --no-cache cmake icu-dev clang build-base
|
||||||
|
|
||||||
COPY . /app/pe-parse
|
COPY . /app/pe-parse
|
||||||
WORKDIR /app/pe-parse
|
WORKDIR /app/pe-parse
|
||||||
|
ENV CC=clang CXX=clang++
|
||||||
RUN mkdir build && \
|
RUN mkdir build && \
|
||||||
cd build && \
|
cd build && \
|
||||||
cmake -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" .. && \
|
cmake -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" .. && \
|
||||||
cmake --build . --config "${BUILD_TYPE}" && \
|
cmake --build . && \
|
||||||
cmake --build . --config "${BUILD_TYPE}" --target install
|
cmake --build . --target install
|
||||||
|
|
||||||
ENTRYPOINT [ "/usr/bin/dump-pe" ]
|
ENTRYPOINT [ "/usr/bin/dump-pe" ]
|
||||||
CMD ["--help"]
|
CMD ["--help"]
|
||||||
|
@ -32,10 +32,8 @@ else ()
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
message(STATUS "This is a debug build; enabling -Weverything...")
|
|
||||||
|
|
||||||
list(APPEND DEFAULT_CXX_FLAGS
|
list(APPEND DEFAULT_CXX_FLAGS
|
||||||
-Weverything -Wno-c++98-compat -Wno-missing-prototypes
|
-Wno-c++98-compat -Wno-missing-prototypes
|
||||||
-Wno-missing-variable-declarations -Wno-global-constructors
|
-Wno-missing-variable-declarations -Wno-global-constructors
|
||||||
-Wno-exit-time-destructors -Wno-padded -Wno-error
|
-Wno-exit-time-destructors -Wno-padded -Wno-error
|
||||||
)
|
)
|
||||||
|
@ -30,40 +30,53 @@ import platform
|
|||||||
|
|
||||||
here = os.path.abspath(os.path.dirname(__file__))
|
here = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
SOURCE_FILES = [os.path.join(here, 'pepy.cpp'),
|
SOURCE_FILES = [
|
||||||
os.path.abspath(os.path.join(here, '..', 'pe-parser-library', 'src', 'parse.cpp')),
|
os.path.join(here, "pepy.cpp"),
|
||||||
os.path.abspath(os.path.join(here, '..', 'pe-parser-library', 'src', 'buffer.cpp')),
|
os.path.abspath(os.path.join(here, "..", "pe-parser-library", "src", "parse.cpp")),
|
||||||
os.path.abspath(os.path.join(here, '..', 'pe-parser-library', 'src', 'unicode_codecvt.cpp'))]
|
os.path.abspath(os.path.join(here, "..", "pe-parser-library", "src", "buffer.cpp")),
|
||||||
|
os.path.abspath(
|
||||||
|
os.path.join(here, "..", "pe-parser-library", "src", "unicode_codecvt.cpp")
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
if platform.system() == 'Windows':
|
if platform.system() == "Windows":
|
||||||
INCLUDE_DIRS = [os.path.abspath(os.path.join(os.path.dirname(sys.executable), 'include')),
|
INCLUDE_DIRS = [
|
||||||
os.path.abspath(os.path.join(here, '..', 'pe-parser-library', 'include')),
|
os.path.abspath(os.path.join(os.path.dirname(sys.executable), "include")),
|
||||||
'C:\\usr\\include']
|
os.path.abspath(os.path.join(here, "..", "pe-parser-library", "include")),
|
||||||
LIBRARY_DIRS = [os.path.abspath(os.path.join(os.path.dirname(sys.executable), 'libs')),
|
"C:\\usr\\include",
|
||||||
'C:\\usr\\lib']
|
]
|
||||||
COMPILE_ARGS = ["/EHsc"]
|
LIBRARY_DIRS = [
|
||||||
|
os.path.abspath(os.path.join(os.path.dirname(sys.executable), "libs")),
|
||||||
|
"C:\\usr\\lib",
|
||||||
|
]
|
||||||
|
COMPILE_ARGS = ["/EHsc"]
|
||||||
else:
|
else:
|
||||||
INCLUDE_DIRS = ['/usr/local/include',
|
INCLUDE_DIRS = [
|
||||||
'/opt/local/include',
|
"/usr/local/include",
|
||||||
'/usr/include',
|
"/opt/local/include",
|
||||||
os.path.abspath(os.path.join(here, '..', 'pe-parser-library', 'include'))]
|
"/usr/include",
|
||||||
LIBRARY_DIRS = ['/usr/lib',
|
os.path.abspath(os.path.join(here, "..", "pe-parser-library", "include")),
|
||||||
'/usr/local/lib']
|
]
|
||||||
COMPILE_ARGS = ["-std=c++11", "-g", "-O0"] # Debug only
|
LIBRARY_DIRS = ["/usr/lib", "/usr/local/lib"]
|
||||||
|
COMPILE_ARGS = ["-std=c++11", "-g", "-O0"] # Debug only
|
||||||
|
|
||||||
extension_mod = Extension('pepy',
|
extension_mod = Extension(
|
||||||
sources = SOURCE_FILES,
|
"pepy",
|
||||||
extra_compile_args = COMPILE_ARGS,
|
sources=SOURCE_FILES,
|
||||||
language='c++',
|
extra_compile_args=COMPILE_ARGS,
|
||||||
include_dirs = INCLUDE_DIRS,
|
language="c++",
|
||||||
library_dirs = LIBRARY_DIRS)
|
include_dirs=INCLUDE_DIRS,
|
||||||
|
library_dirs=LIBRARY_DIRS,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
setup (name = 'pepy',
|
setup(
|
||||||
version = '0.1',
|
name="pepy",
|
||||||
description = 'python bindings for pe-parse',
|
version="0.1",
|
||||||
author = 'Wesley Shields',
|
description="python bindings for pe-parse",
|
||||||
author_email = 'wxs@atarininja.org',
|
author="Wesley Shields",
|
||||||
license = 'BSD',
|
author_email="wxs@atarininja.org",
|
||||||
long_description = 'Python bindings for pe-parse',
|
license="BSD",
|
||||||
ext_modules = [extension_mod])
|
long_description="Python bindings for pe-parse",
|
||||||
|
ext_modules=[extension_mod],
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user