Skip to content

Commit

Permalink
Add lief, Library to Instrument Executable Formats.
Browse files Browse the repository at this point in the history
It built (at least on macOS) with all the vendored libraries, but we
generally want to link with pkgsrc-installed libraries when possible.
Seems like that's going to take more work.

Motivation: https://github.com/fzakaria/sqlelf needs the Python bindings
from this library.
  • Loading branch information
schmonz committed Mar 19, 2024
1 parent 2a8fde1 commit 33939dc
Show file tree
Hide file tree
Showing 4 changed files with 443 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lief/DESCR
@@ -0,0 +1,11 @@
The purpose of this project is to provide a cross platform library which
can parse, modify and abstract ELF, PE and MachO formats.

Main features:

- Parsing: LIEF can parse ELF, PE, MachO, OAT, DEX, VDEX, ART and
provides an user-friendly API to access to format internals.
- Modify: LIEF enables to modify some parts of these formats
- Abstract: Three formats have common features like sections, symbols,
entry point... LIEF factors them. API: LIEF can be used in C, C++
and Python
49 changes: 49 additions & 0 deletions lief/Makefile
@@ -0,0 +1,49 @@
# $NetBSD$

DISTNAME= LIEF-0.14.1
PKGNAME= ${DISTNAME:tl}
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_GITHUB:=lief-project/}
GITHUB_TAG= ${PKGVERSION_NOREV}

MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= https://lief-project.github.io/
COMMENT= Library to Instrument Executable Formats
LICENSE= apache-2.0

USE_TOOLS+= pkg-config
USE_LANGUAGES= c c++
USE_CXX_FEATURES= c++17
FORCE_CXX_STD= c++17

CMAKE_CONFIGURE_ARGS+= -DLIEF_OPT_MBEDTLS_EXTERNAL=1
CMAKE_CONFIGURE_ARGS+= -DLIEF_ENABLE_JSON=1 \
-DLIEF_OPT_NLOHMANN_JSON_EXTERNAL=1
CMAKE_CONFIGURE_ARGS+= -DLIEF_FROZEN_ENABLED=1 \
-DLIEF_OPT_FROZEN_EXTERNAL=1
CMAKE_CONFIGURE_ARGS+= -DLIEF_EXTERNAL_EXPECTED=1
CMAKE_CONFIGURE_ARGS+= -DLIEF_OPT_UTFCPP_EXTERNAL=1

PKGCONFIG_OVERRIDE+= cmake/LIEF.pc.in

# make sure the vendored versions don't get found
post-extract:
rm ${WRKSRC}/third-party/mbedtls*.zip
rm ${WRKSRC}/third-party/json*.zip
rm ${WRKSRC}/third-party/expected*.zip
rm ${WRKSRC}/third-party/frozen*.zip
rm ${WRKSRC}/third-party/utfcpp*.zip
rm ${WRKSRC}/third-party/spdlog*.zip

# needs Git at build time???
# "tcb-span"? LIEF_EXTERNAL_SPAN, LIEF_EXTERNAL_SPAN_DIR
# py-sqlelf will want the python bindings installed (BUILD_DIRS+=api/python)

.include "../../devel/cmake/build.mk"
.include "../../devel/frozen/buildlink3.mk"
.include "../../devel/spdlog/buildlink3.mk"
.include "../../devel/tl-expected/buildlink3.mk"
.include "../../security/mbedtls3/buildlink3.mk"
.include "../../textproc/nlohmann-json/buildlink3.mk"
.include "../../textproc/utf8-cpp/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

0 comments on commit 33939dc

Please sign in to comment.