pkg: variable links at build time

Has been on the wishlist almost since we have started
using Python 3 and needed our own python3 link to the
currently used version.
This commit is contained in:
Franco Fichtner 2020-04-13 22:15:41 +02:00
parent 40ed63239d
commit 094bbd66c1
5 changed files with 23 additions and 11 deletions

View File

@ -50,6 +50,8 @@ CORE_SYSLOGD?= # empty
CORE_SYSLOGNG?= 3.25
CORE_UPDATE?= # empty
CORE_PYTHON_DOT= ${CORE_PYTHON:C/./&./1}
.if "${CORE_FLAVOUR}" == OpenSSL
CORE_REPOSITORY?= ${CORE_ABI}/latest
.elif "${CORE_FLAVOUR}" == LibreSSL
@ -351,7 +353,7 @@ sweep:
STYLEDIRS?= src/etc/inc src/opnsense
style-python: want-py${CORE_PYTHON}-pycodestyle
@pycodestyle-${CORE_PYTHON:C/./&./1} --ignore=E501 ${.CURDIR}/src || true
@pycodestyle-${CORE_PYTHON_DOT} --ignore=E501 ${.CURDIR}/src || true
style-php: want-php${CORE_PHP}-pear-PHP_CodeSniffer
@: > ${WRKDIR}/style.out

View File

@ -1,4 +1,4 @@
# Copyright (c) 2015-2018 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2015-2020 Franco Fichtner <franco@opnsense.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@ -60,8 +60,8 @@ install-${TARGET}:
"${DESTDIR}${ROOT_${TARGET}}$${REALTARGET}/$${FILE}"; \
mv "${DESTDIR}${ROOT_${TARGET}}$${REALTARGET}/$${FILE}" \
"${DESTDIR}${ROOT_${TARGET}}$${REALTARGET}/$${FILE%%.in}"; \
fi; \
FILE="$${FILE%%.in}"; \
fi; \
if [ -n "${NO_SAMPLE}" -a "$${FILE%%.sample}" != "$${FILE}" ]; then \
mv "${DESTDIR}${ROOT_${TARGET}}$${REALTARGET}/$${FILE}" \
"${DESTDIR}${ROOT_${TARGET}}$${REALTARGET}/$${FILE%%.sample}"; \
@ -75,6 +75,12 @@ install-${TARGET}:
"${DESTDIR}${ROOT_${TARGET}}$${REALTARGET}/$${FILE%%.shadow}.sample"; \
fi; \
fi; \
if [ "$${FILE%%.link}" != "$${FILE}" ]; then \
(cd "$$(dirname "${DESTDIR}${ROOT_${TARGET}}$${REALTARGET}/$${FILE}")"; \
ln -sfn "$$(cat ${DESTDIR}${ROOT_${TARGET}}$${REALTARGET}/$${FILE})" \
"$$(basename "${DESTDIR}${ROOT_${TARGET}}$${REALTARGET}/$${FILE%%.link}")"); \
rm "${DESTDIR}${ROOT_${TARGET}}$${REALTARGET}/$${FILE}"; \
fi; \
if [ "${TREE}" = "man" ]; then \
gzip -cn "${DESTDIR}${ROOT_${TARGET}}$${REALTARGET}/$${FILE}" > \
"${DESTDIR}${ROOT_${TARGET}}$${REALTARGET}/$${FILE}.gz"; \
@ -88,16 +94,19 @@ plist-${TARGET}:
@(cd ${TREE}; find * -type f ${_IGNORES} -o -type l) | while read FILE; do \
if [ -f "${TREE}/$${FILE}.in" ]; then continue; fi; \
FILE="$${FILE%%.in}"; PREFIX=""; \
if [ -z "${NO_SAMPLE}" -a "$${FILE%%.sample}" != "$${FILE}" ]; then \
if [ -n "${NO_SAMPLE}" ]; then \
FILE="$${FILE%%.link}"; \
FILE="$${FILE%%.sample}"; \
FILE="$${FILE%%.shadow}"; \
else \
if [ "$${FILE%%.link}" != "$${FILE}" ]; then \
FILE="$${FILE%%.link}"; \
elif [ "$${FILE%%.sample}" != "$${FILE}" ]; then \
PREFIX="@sample "; \
fi; \
if [ -z "${NO_SAMPLE}" -a "$${FILE%%.shadow}" != "$${FILE}" ]; then \
elif [ "$${FILE%%.shadow}" != "$${FILE}" ]; then \
FILE="$${FILE%%.shadow}.sample"; \
PREFIX="@shadow "; \
fi; \
if [ -n "${NO_SAMPLE}" ]; then \
FILE="$${FILE%%.sample}"; \
FILE="$${FILE%%.shadow}"; \
fi; \
if [ "${TREE}" == "man" ]; then \
FILE="$${FILE}.gz"; \

View File

@ -89,6 +89,7 @@ REPLACEMENTS= CORE_ABI \
CORE_PACKAGESITE \
CORE_PKGVERSION \
CORE_PRODUCT \
CORE_PYTHON_DOT \
CORE_REPOSITORY \
CORE_SYSLOGNG \
CORE_VERSION \

View File

@ -1 +0,0 @@
python3.7

1
src/bin/python3.link.in Normal file
View File

@ -0,0 +1 @@
python%%CORE_PYTHON_DOT%%