ports/90031: Add bsd.linux-rpm.mk; fix INSTALLS_SHLIB for Linux ports

Jean-Yves Lefort jylefort at FreeBSD.org
Tue Dec 6 15:10:04 UTC 2005


>Number:         90031
>Category:       ports
>Synopsis:       Add bsd.linux-rpm.mk; fix INSTALLS_SHLIB for Linux ports
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 06 15:10:02 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Jean-Yves Lefort
>Release:        FreeBSD 6.0-RELEASE i386
>Organization:
>Environment:
System: FreeBSD jsite.lefort.net 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Tue Nov 8 17:13:42 CET 2005 jylefort at jsite.lefort.net:/usr/obj/usr/src/sys/JSITE i386
>Description:
Discussed with Alexander Leidinger on emulation@ and ports at .
>How-To-Repeat:
>Fix:
--- bsd.linux-rpm.mk.orig	Tue Dec  6 15:52:41 2005
+++ bsd.linux-rpm.mk	Tue Dec  6 15:59:15 2005
@@ -0,0 +1,90 @@
+#-*- mode: Makefile; tab-width: 4; -*-
+# ex:ts=4
+#
+# $FreeBSD$
+#
+
+.if !defined(_POSTMKINCLUDED) && !defined(Linux_RPM_Pre_Include)
+
+Linux_RPM_Include_MAINTAINER=	jylefort at FreeBSD.org
+Linux_RPM_Pre_Include=			bsd.linux-rpm.mk
+
+RPM2CPIO?=			${LOCALBASE}/bin/rpm2cpio
+
+EXTRACT_SUFX?=		.${LINUX_RPM_ARCH}.rpm
+
+USE_LINUX?=			yes
+USE_LINUX_PREFIX=	yes
+
+NO_WRKSUBDIR=		yes
+NO_BUILD=			yes
+
+.  if ${ARCH} == "amd64"
+LINUX_RPM_ARCH?=	i386	# the linuxulator does not yet support amd64 code
+.  elif ${ARCH} == "powerpc"
+LINUX_RPM_ARCH?=	ppc
+.  else
+LINUX_RPM_ARCH?=	${ARCH}
+.  endif
+
+.endif
+
+.if defined(_POSTMKINCLUDED) && !defined(Linux_RPM_Post_Include)
+
+Linux_RPM_Post_Include=	bsd.linux-rpm.mk
+
+MASTER_SITES?=			${MASTER_SITE_FEDORA_LINUX}
+MASTER_SITE_SUBDIR?=	3/${LINUX_RPM_ARCH}/os/Fedora/RPMS/
+PKGNAMEPREFIX?=			linux-
+
+EXTRACT_DEPENDS+=		${RPM2CPIO}:${PORTSDIR}/archivers/rpm
+
+EXTRACT_CMD?=			${RPM2CPIO}
+EXTRACT_BEFORE_ARGS?=
+EXTRACT_AFTER_ARGS?=	| ${CPIO} -id --quiet
+
+MD5_FILE?=				${MASTERDIR}/distinfo.${LINUX_RPM_ARCH}
+
+.  if defined(AUTOMATIC_PLIST)
+
+.    if ${USE_LINUX} == "8" || ${USE_LINUX:L} == "yes"
+_LINUX_BASE_SUFFIX=		8
+.    elif ${USE_LINUX} == "debian"
+_LINUX_BASE_SUFFIX=		debian
+.    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\", \"8\" and \"debian\""
+.    endif
+
+PLIST?=					${WRKDIR}/.PLIST.linux-rpm
+
+pre-install: linux-rpm-generate-plist
+
+linux-rpm-generate-plist:
+	@cd ${WRKSRC} && \
+	${FIND} * ! -type d | ${SORT} > ${PLIST} && \
+	${FIND} * -type d | ${SORT} | ${SED} -e 's|^|@dirrm |' > ${PLIST}.dirs
+	@${GREP} '^@dirrm ' ${PORTSDIR}/emulators/linux_base-${_LINUX_BASE_SUFFIX}/pkg-plist | ${SORT} > ${PLIST}.shared-dirs
+	@${COMM} -1 -3 ${PLIST}.shared-dirs ${PLIST}.dirs | ${SORT} -r >> ${PLIST}
+
+.  endif
+
+.  if !target(do-install)
+do-install:
+	cd ${WRKSRC} && ${FIND} * -type d -exec ${MKDIR} "${PREFIX}/{}" \;
+	cd ${WRKSRC} && ${FIND} * ! -type d | ${CPIO} -pm -R root:wheel ${PREFIX}
+.  endif
+
+.  if !target(new-plist)
+new-plist:
+	@${RM} -rf ${WRKDIR}/.new-plist
+	@${MKDIR} ${WRKDIR}/.new-plist
+	@cd ${WRKDIR}/.new-plist && \
+	for f in ${DISTFILES}; do \
+		${RPM2CPIO} ${_DISTDIR}/$$f | ${CPIO} -id --quiet; \
+		${FIND} * ! type d | ${SORT} > ${PLIST}.new; \
+		${FIND} -d * -type d | ${SED} -e 's|^|@dirrm |' >> ${PLIST}.new; \
+	done
+.  endif
+
+.endif
--- bsd.port.mk.orig	Tue Dec  6 15:52:22 2005
+++ bsd.port.mk	Tue Dec  6 15:52:28 2005
@@ -422,7 +422,16 @@
 #				  or a sound server which supports the FreeBSD native one),
 #				  use the default or the X11 prefix if it's a leaf port
 #				  (e.g. a game or program).
-#				  Implies NO_MTREE=yes.
+#				  Implies NO_MTREE=yes, and, if INSTALLS_SHLIB is defined:
+#				    - USE_LINUX=yes
+#				    - appropriate invocation of the Linux ldconfig
+# USE_LINUX_RPM	- Set to yes to pull in variables and targets useful to Linux
+#				  RPM ports.
+#				  Implies inclusion of bsd.linux-rpm.mk.
+# AUTOMATIC_PLIST
+#				- Set to yes to enable automatic packing list generation.
+#				  Currently has no effect unless USE_LINUX_RPM is set.
+#
 # OVERRIDE_LINUX_BASE_PORT	- This specifies the default linux base to use, for valid values
 #				  have a look at the description of USE_LINUX. This is an user-only
 #				  variable. Don't use it in any port, it's meant to be used in
@@ -813,6 +822,9 @@
 #				- If set, bsd.port.mk will automatically run ldconfig commands
 #				  from post-install and also add appropriate @exec/@unexec
 #				  directives to directories listed in LDCONFIG_DIRS.
+#				  If USE_LINUX_PREFIX is defined, the Linux version of ldconfig
+#				  will be used instead of the native FreeBSD version (in such
+#				  case, LDCONFIG_DIRS is ignored).
 # LDCONFIG_DIRS	- List of directories to run ldconfig if INSTALLS_SHLIB is set.
 #				  Note that this is passed through sed just like the
 #				  rest of PLIST, so ${PLIST_SUB} substitutions also
@@ -1209,6 +1221,11 @@
 .else
 INDEXFILE?=		INDEX
 .endif
+
+.if defined(USE_LINUX_RPM)
+.include "${PORTSDIR}/Mk/bsd.linux-rpm.mk"
+.endif
+
 .if defined(USE_BZIP2)
 EXTRACT_SUFX?=			.tar.bz2
 .elif defined(USE_ZIP)
@@ -1248,6 +1265,16 @@
 PREFIX?=		${LOCALBASE}
 .endif
 
+.if defined(USE_LINUX_PREFIX)
+LDCONFIG_CMD?=				${LINUXBASE}/sbin/ldconfig
+LDCONFIG_PLIST_EXEC_CMD?=	${LDCONFIG_CMD}
+LDCONFIG_PLIST_UNEXEC_CMD?=	${LDCONFIG_CMD}
+.else
+LDCONFIG_CMD?=				${LDCONFIG} -m ${LDCONFIG_RUNLIST}
+LDCONFIG_PLIST_EXEC_CMD?=	${LDCONFIG} -m ${LDCONFIG_PLIST}
+LDCONFIG_PLIST_UNEXEC_CMD?=	${LDCONFIG} -R
+.endif
+
 PKGCOMPATDIR?=		${LOCALBASE}/lib/compat/pkg
 
 .if ${OSVERSION} >= 500036
@@ -1541,6 +1568,11 @@
 .	endif
 .endif
 
+.if defined(USE_LINUX_PREFIX) && defined(INSTALLS_SHLIB)
+# we need ${LINUXBASE}/sbin/ldconfig
+USE_LINUX?=	yes
+.endif
+
 .if defined(USE_LINUX)
 
 # install(1) also does a brandelf on strip, so don't strip with FreeBSD tools.
@@ -1763,6 +1795,10 @@
 .include "${PORTSDIR}/Mk/bsd.apache.mk"
 .endif
 
+.if defined(USE_LINUX_RPM)
+.include "${PORTSDIR}/Mk/bsd.linux-rpm.mk"
+.endif
+
 .if exists(${PORTSDIR}/../Makefile.inc)
 .include "${PORTSDIR}/../Makefile.inc"
 USE_SUBMAKE=	yes
@@ -3519,10 +3555,10 @@
 .if defined(INSTALLS_SHLIB)
 .if !defined(INSTALL_AS_USER)
 	@${ECHO_MSG} "===>   Running ldconfig"
-	${LDCONFIG} -m ${LDCONFIG_RUNLIST}
+	${LDCONFIG_CMD}
 .else
 	@${ECHO_MSG} "===>   Running ldconfig (errors are ignored)"
-	-${LDCONFIG} -m ${LDCONFIG_RUNLIST}
+	-${LDCONFIG_CMD}
 .endif
 .else
 	@${DO_NADA}
@@ -4862,11 +4898,11 @@
 	@${ECHO_CMD} ${dir} | ${SED} ${PLIST_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} | ${SED} -e 's,^, at dirrm ,' >> ${TMPPLIST}
 .endfor
 .if defined(INSTALLS_SHLIB) && !defined(INSTALL_AS_USER)
-	@${ECHO_CMD} "@exec ${LDCONFIG} -m ${LDCONFIG_PLIST}" >> ${TMPPLIST}
-	@${ECHO_CMD} "@unexec ${LDCONFIG} -R" >> ${TMPPLIST}
+	@${ECHO_CMD} "@exec ${LDCONFIG_PLIST_EXEC_CMD}" >> ${TMPPLIST}
+	@${ECHO_CMD} "@unexec ${LDCONFIG_PLIST_UNEXEC_CMD}" >> ${TMPPLIST}
 .elif defined(INSTALLS_SHLIB)
-	@${ECHO_CMD} "@exec ${LDCONFIG} -m ${LDCONFIG_PLIST} || ${TRUE}" >> ${TMPPLIST}
-	@${ECHO_CMD} "@unexec ${LDCONFIG} -R || ${TRUE}" >> ${TMPPLIST}
+	@${ECHO_CMD} "@exec ${LDCONFIG_PLIST_EXEC_CMD} || ${TRUE}" >> ${TMPPLIST}
+	@${ECHO_CMD} "@unexec ${LDCONFIG_PLIST_UNEXEC_CMD} || ${TRUE}" >> ${TMPPLIST}
 .endif
 .if !defined(NO_FILTER_SHLIBS)
 .if (${PORTOBJFORMAT} == "aout")
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list