<commit_before>.include <bsd.own.mk>

LIB=		pkg
INCS=		pkg.h
WARNS=		6
PREFIX?=	/usr/local
LIBDIR=		${PREFIX}/lib
INCLUDEDIR=	${PREFIX}/include
SHLIB_MAJOR=	0

#gr_utils.c has to be deleted as soon as it goes in base
SRCS=		backup.c \
		dns_utils.c \
		elfhints.c \
		fetch.c \
		packing.c \
		pkg.c \
		pkg_add.c \
		pkg_attributes.c \
		pkg_config.c \
		pkg_create.c \
		pkg_delete.c \
		pkg_elf.c \
		pkg_event.c \
		pkg_jobs.c \
		pkg_manifest.c \
		pkg_ports.c \
		pkg_repo.c \
		pkg_version.c \
		pkgdb.c \
		rcscripts.c \
		rsa.c \
		scripts.c \
		update.c \
		usergroup.c \
		utils.c \
		plugins.c

PC=	pkg.pc
CLEANFILES=	${PC}

all: ${PC}

realinstall: ${PC}
	${INSTALL} -m 644 ${PC} ${PREFIX}/libdata/pkgconfig

HAVE_GRUTILS!=	grep -q gr_copy /usr/include/libutil.h && echo yes || echo no
VERSION!=	awk '$$2 == "PKGVERSION" { print $$3 }' pkg.h

.if ${HAVE_GRUTILS} != yes
SRCS+=	gr_util.c
.else
CFLAGS+=	-DHAVE_GRUTILS
.endif

CFLAGS+=	-std=c99
CFLAGS+=	-I${.CURDIR} \
		-I${.CURDIR}/../external/sqlite \
		-I${.CURDIR}/../external/libyaml/include \
		-I${.CURDIR}/../external/uthash
LDADD+=		-L${.OBJDIR}/../external/sqlite \
		-L${.OBJDIR}/../external/libyaml \
		-lsqlite3 \
		-lyaml \
		-larchive \
		-lsbuf \
		-lfetch \
		-lelf \
		-lutil \
		-lpthread

.if exists(/usr/include/edit/readline/readline.h)
LDADD+=		-ledit
.endif

CFLAGS+=	-DPREFIX=\"${PREFIX}\"

DEBUG_FLAGS+=  -g -O0
STRIP=
.if defined(PROFILE_BUILD)
DEBUG_FLAGS+=	-pg
.endif<commit_msg>libpkg needs to link against the libelf version in external in case of build WITH_BUNDLE_LIBELF<commit_after>.include <bsd.own.mk>

LIB=		pkg
INCS=		pkg.h
WARNS=		6
PREFIX?=	/usr/local
LIBDIR=		${PREFIX}/lib
INCLUDEDIR=	${PREFIX}/include
SHLIB_MAJOR=	0

#gr_utils.c has to be deleted as soon as it goes in base
SRCS=		backup.c \
		dns_utils.c \
		elfhints.c \
		fetch.c \
		packing.c \
		pkg.c \
		pkg_add.c \
		pkg_attributes.c \
		pkg_config.c \
		pkg_create.c \
		pkg_delete.c \
		pkg_elf.c \
		pkg_event.c \
		pkg_jobs.c \
		pkg_manifest.c \
		pkg_ports.c \
		pkg_repo.c \
		pkg_version.c \
		pkgdb.c \
		rcscripts.c \
		rsa.c \
		scripts.c \
		update.c \
		usergroup.c \
		utils.c \
		plugins.c

PC=	pkg.pc
CLEANFILES=	${PC}

all: ${PC}

realinstall: ${PC}
	${INSTALL} -m 644 ${PC} ${PREFIX}/libdata/pkgconfig

HAVE_GRUTILS!=	grep -q gr_copy /usr/include/libutil.h && echo yes || echo no
VERSION!=	awk '$$2 == "PKGVERSION" { print $$3 }' pkg.h

.if ${HAVE_GRUTILS} != yes
SRCS+=	gr_util.c
.else
CFLAGS+=	-DHAVE_GRUTILS
.endif

CFLAGS+=	-std=c99
CFLAGS+=	-I${.CURDIR} \
		-I${.CURDIR}/../external/sqlite \
		-I${.CURDIR}/../external/libyaml/include \
		-I${.CURDIR}/../external/uthash

.if defined(WITH_BUNDLED_LIBELF)
CFLAGS+=	-I${.CURDIR}/../external/libelf
.endif

LDADD+=		-L${.OBJDIR}/../external/sqlite \
		-L${.OBJDIR}/../external/libyaml

.if defined(WITH_BUNDLED_LIBELF)
LDADD+=		-L${.OBJDIR}/../external/libelf
.endif

LDADD+=		-lsqlite3 \
		-lyaml \
		-larchive \
		-lsbuf \
		-lfetch \
		-lelf \
		-lutil \
		-lpthread

.if exists(/usr/include/edit/readline/readline.h)
LDADD+=		-ledit
.endif

CFLAGS+=	-DPREFIX=\"${PREFIX}\"

DEBUG_FLAGS+=  -g -O0
STRIP=
.if defined(PROFILE_BUILD)
DEBUG_FLAGS+=	-pg
.endif
{'fraction_non_alphanumeric': 0.17757594738490448, 'fraction_numerical': 0.006890072032571249, 'mean_word_length': 2.654462242562929, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4462841', 'n_tokens_mistral': 1561, 'n_tokens_neox': 1463, 'n_words': 278}