1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-18 03:46:03 +00:00
freebsd-ports/Mk/bsd.linux-rpm.mk
Johannes Jost Meixner 05317facbe Update CentOS base to 6.5, add userland ports
The Fedora 10 infrastructure ports have been in use since June 2009 and, while
having served a great deed, have become unsupported upstream and hence affected
by unfixed security vulnerabilities. In addition to that, many recent Linux
binaries need newer libc / stdlibc++ versions.

This commit adds the linux-c6- userland as drop-in replacement for the -f10
infrastructure, as well as upgrading the linux_base-c6 port to CentOS 6.5.

If you want to switch to linux-c6 ports, please define at /etc/make.conf:

    OVERRIDE_LINUX_BASE_PORT=c6
    OVERRIDE_LINUX_NONBASE_PORTS=c6

Additionally, please add the following line to /etc/sysctl.conf:

    compat.linux.osrelease=2.6.18

Upgrading procedures are shown in /usr/ports/UPDATING.

This work has been inspired by Artyom Mirgorodskiy's post to emulation@ in
November 2013, using and extending mav@'s work. It has been tested extensively
and most reported issues were already fixed. Please report any additional bug
or "features" to the emulation mailing list.

Many thanks to: mav@, rene@, allanjude@, netchild@, antoine@, everyone who's
filed Issues and Pull requests on GitHub,

PR:		186820
Differential Revision:	https://reviews.freebsd.org/D793
Reviewed by:	allanjude, antoine, bapt, rene
Approved by:	portmgr (antoine, bapt)
Approved by:	koobs (mentor)
Sponsored by:	Perceivon Hosting Inc.
2014-09-22 10:40:00 +00:00

223 lines
7.2 KiB
Makefile

#-*- tab-width: 4; -*-
# ex:ts=4
#
# $FreeBSD$
#
# Variables:
# LINUX_DIST - Will be used to set some dist-specific presets.
# Valid values: fedora
# LINUX_DIST_VER - Use depends upon the dist-specific presets.
# Valid values for "fedora": all version numbers
# e.g. 10 for fedora 10
# This is used to set MASTER_SITE_{,SRC_}SUBDIR
# if it isn't already set.
# MASTER_SITE_SRC_SUBDIR
# - The subdir for the src RPM's.
# DISTFILES - For simple cases this will be set automatically
# based upon the DISTNAME.
# SRC_DISTFILES - Variable which contains the corresponding src RPM's.
# If there's no corresponding src RPM, it has to be
# set to the empty value (SRC_DISTFILES= "").
# AUTOMATIC_PLIST - Generate a dynamic plist (please have a look at the
# porters handbook section which talks about plists.
# This feature is reserved for rare cases).
# BRANDELF_DIRS - A list of directories with executables to brand
# as a linux executable. The directories has to not
# contain libraries.
# BRANDELF_FILES - A list of files to brand as a linux executable in
# case BRANDELF_DIRS can't be used.
.if !defined(_POSTMKINCLUDED) && !defined(Linux_RPM_Pre_Include)
Linux_RPM_Include_MAINTAINER= emulation@FreeBSD.org
Linux_RPM_Pre_Include= bsd.linux-rpm.mk
EXTRACT_SUFX?= .${LINUX_RPM_ARCH}.rpm
SRC_SUFX?= .src.rpm
USE_LINUX?= yes
USE_LINUX_PREFIX= yes
NO_WRKSUBDIR= yes
NO_BUILD= yes
. if ${ARCH} == "amd64" || ${ARCH} == "i386"
. if ${USE_LINUX} == "c6"
# Do not build CentOS 6.5 ports if overridden by f10
. if defined(OVERRIDE_LINUX_BASE_PORT) && ${OVERRIDE_LINUX_NONBASE_PORTS} == "f10"
IGNORE= This port requires CentOS 6.5. Please remove OVERRIDE_LINUX_NONBASE_PORTS=f10 in /etc/make.conf.
. endif
LINUX_RPM_ARCH?= i686 # ?= because of nasty c5 qt ports
. elif ${USE_LINUX} == "f10" || ${USE_LINUX} == "yes" # temporary default, move or clause to line 46
# Do not build Fedora 10 ports unless specifically overridden.
#. if ! defined(OVERRIDE_LINUX_NONBASE_PORTS) || ${OVERRIDE_LINUX_NONBASE_PORTS} != "f10"
#IGNORE= This port requires Fedora 10, yet Fedora 10 is heavily outdated and contains many vulnerable ports. If you really need it, add OVERRIDE_LINUX_NONBASE_PORTS=f10 in /etc/make.conf.
#. endif
LINUX_RPM_ARCH?= i386 # the linuxulator does not yet support amd64 code
. else
LINUX_RPM_ARCH?= ${ARCH}
. endif
. elif ${ARCH} == "powerpc"
LINUX_RPM_ARCH?= ppc
. endif
.endif
.if defined(_POSTMKINCLUDED) && !defined(Linux_RPM_Post_Include)
Linux_RPM_Post_Include= bsd.linux-rpm.mk
.if ${USE_LINUX} == "f10" || ${USE_LINUX} == "yes" # temporary default, remove or clause soon
USE_LINUX?= "f10"
LINUX_DIST= fedora
LINUX_DIST_VER= 10
.else
LINUX_DIST= centos
LINUX_DIST_VER= 6.5
.endif
. if defined(LINUX_DIST)
DIST_SUBDIR?= rpm/${LINUX_RPM_ARCH}/${LINUX_DIST}/${LINUX_DIST_VER}
. if ${LINUX_DIST} == "fedora"
# we do not want to define MASTER_SITES and MASTER_SITE_* if they are already defined
# ex.: MASTER_SITES=file:///...
. ifndef MASTER_SITES
MASTER_SITES= ${MASTER_SITE_FEDORA_LINUX}
. if ${LINUX_DIST_VER} == 10
MASTER_SITE_SUBDIR?= ../releases/${LINUX_DIST_VER}/Everything/${LINUX_RPM_ARCH}/os/Packages \
../updates/${LINUX_DIST_VER}/${LINUX_RPM_ARCH}
MASTER_SITE_SRC_SUBDIR?= ../releases/${LINUX_DIST_VER}/Everything/source/SRPMS \
../updates/${LINUX_DIST_VER}/SRPMS
. else
MASTER_SITE_SUBDIR?= ${LINUX_DIST_VER}/${LINUX_RPM_ARCH}/os/Fedora/RPMS \
updates/${LINUX_DIST_VER}/${LINUX_RPM_ARCH}
MASTER_SITE_SRC_SUBDIR?= ${LINUX_DIST_VER}/SRPMS \
updates/${LINUX_DIST_VER}/SRPMS
. endif
. endif
. elif ${LINUX_DIST} == "centos"
MASTER_SITES_SUBDIR= /centos/6/os/i386/Packages/
. if ${LINUX_DIST_VER} == "5" #needed for Qt...
LINUX_RPM_ARCH= i386
MASTER_SITES_SUBDIR= /centos/5/os/i386/Packages/
. endif
. ifndef MASTER_SITES
MASTER_SITES= ${MASTER_SITE_CENTOS_LINUX}
. if ${LINUX_DIST_VER} == "6.5"
. if ! defined(PACKAGE_BUILDING)
MASTER_SITES= http://mirror.centos.org/centos/6/os/i386/Packages/
MASTER_SITES_SUBDIR= /centos/6/os/i386/Packages/
. else
MASTER_SITES?= http://vault.centos.org/%SUBDIR%/
MASTER_SITES_SUBDIR= /6.5/os/Source/SPackages/
. endif
. else
MASTER_SITES= http://vault.centos.org/${LINUX_DIST_VER}/os/i386/Packages/
. endif
. endif
. endif
. endif
#.if ${USE_LINUX:L} == "yes" #redundant with bsd.port.mk fu
#USE_LINUX= c6
#.endif
PKGNAMEPREFIX?= linux-${USE_LINUX}-
# DISTFILES and SRC_DISTFILES assume that there is only one bindist
# and one src file.
# Please, define them in the Makefile of the port in case this assumption
# is not true.
DISTVERSION= ${PORTVERSION}-${RPMVERSION}
DISTNAME?= ${PORTNAME}-${DISTVERSION}
DISTFILES?= ${DISTNAME}${EXTRACT_SUFX}
BIN_DISTFILES:= ${DISTFILES}
SRC_DISTFILES?= ${DISTNAME}${SRC_SUFX}
EXTRACT_ONLY?= ${BIN_DISTFILES:C/:[^:]+$//}
. if defined(PACKAGE_BUILDING)
DISTFILES+= ${SRC_DISTFILES}
MASTER_SITE_SUBDIR+= ${MASTER_SITE_SRC_SUBDIR}
ALWAYS_KEEP_DISTFILES= yes
. endif
EXTRACT_CMD?= ${TAR}
EXTRACT_BEFORE_ARGS?= -xf
EXTRACT_AFTER_ARGS?=
DISTINFO_FILE?= ${MASTERDIR}/distinfo.${LINUX_RPM_ARCH}
BRANDELF_DIRS?=
BRANDELF_FILES?=
# For ports that define PORTDOCS, be sure not to install
# documentation if NOPORTDOCS is defined
. if defined(PORTDOCS) && defined(NOPORTDOCS)
pre-patch: linux-rpm-clean-portdocs
. if !target(linux-rpm-clean-portdocs)
linux-rpm-clean-portdocs:
. for x in ${PORTDOCS}
@${RM} -f ${WRKDIR}/${DOCSDIR_REL}/${x}
. endfor
@${RMDIR} ${WRKDIR}/${DOCSDIR_REL}
. endif
. endif
. if defined(AUTOMATIC_PLIST)
. if ${USE_LINUX} == "f10" || ${USE_LINUX} == "yes"
_LINUX_BASE_SUFFIX= f10
. elif ${USE_LINUX} == "c6"
USE_LINUX= c6
_LINUX_BASE_SUFFIX= c6
. else
# other linux_base ports do not provide a pkg-plist file
IGNORE= uses AUTOMATIC_PLIST with an unsupported USE_LINUX, \"${USE_LINUX}\". Supported values are \"yes\", \"f10\" and \"c6\"
. endif
PLIST?= ${WRKDIR}/.PLIST.linux-rpm
pre-install: linux-rpm-generate-plist
. if !target(linux-rpm-generate-plist)
linux-rpm-generate-plist:
cd ${WRKSRC} && \
${FIND} * ! -path "stage/*" ! -type d | ${SORT} > ${PLIST} && \
${FIND} * ! -path "stage*" -type d | ${SORT} | ${SED} -e 's|^|@dirrm |' > ${PLIST}.dirs
@${GREP} '^@dirrm' ${PORTSDIR}/emulators/linux_base-${_LINUX_BASE_SUFFIX}/pkg-plist | ${SED} 's:^@dirrmtry:@dirrm:g' | ${SORT} > ${PLIST}.shared-dirs
@${COMM} -1 -3 ${PLIST}.shared-dirs ${PLIST}.dirs | ${SORT} -r >> ${PLIST}
. endif
. endif
. if !target(do-install)
do-install:
. if ${BRANDELF_DIRS}
@cd ${WRKSRC} && ${FIND} ${BRANDELF_DIRS} -type f -print0 \
| ${XARGS} -0 ${FILE} | ${GREP} ELF | ${CUT} -d : -f 1 \
| ${XARGS} ${BRANDELF} -t Linux
. endif
. if ${BRANDELF_FILES}
@cd ${WRKSRC} && ${BRANDELF} -t Linux ${BRANDELF_FILES}
. endif
cd ${WRKSRC} && ${FIND} * ! -path "stage*" -type d -exec ${MKDIR} "${STAGEDIR}${PREFIX}/{}" \;
cd ${WRKSRC} && ${FIND} * ! -path "stage/*" ! -type d | ${CPIO} -pm -R root:wheel ${STAGEDIR}${PREFIX}
. endif
. if !target(new-plist)
new-plist: build
@${RM} -f ${PLIST}.new
@cd ${WRKSRC} && \
${FIND} * ! -path "stage/*" ! -type d | ${SORT} > ${PLIST}.new; \
${FIND} -d * ! -path "stage*" -type d | ${SED} -e 's|^|@dirrm |' >> ${PLIST}.new; \
done
. endif
.endif