summaryrefslogtreecommitdiff
path: root/emulators/linuxppc_lib/Makefile
blob: 7f2cd053a8e2a7a6b7e6976e4edaa582974167ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# $NetBSD: Makefile,v 1.30 2009/03/22 04:53:38 manu Exp $

DISTNAME=		linuxppc_lib-2000.4.6
PKGREVISION=		1
CATEGORIES=		emulators
MASTER_SITES=		${MASTER_SITE_LOCAL}
RPMFILES=	glibc-2.1.3-15f.ppc.rpm glib-1.2.8-3.ppc.rpm \
		libjpeg-6b-13.ppc.rpm libpng-1.0.5-3.ppc.rpm \
		libstdc++-2.10.0-2n.ppc.rpm libtermcap-2.0.8-20.ppc.rpm \
		libtiff-3.5.5-2.ppc.rpm XFree86-libs-3.3.6-20b.ppc.rpm \
		zlib-1.1.3-6.ppc.rpm ldconfig-1.9.5-16.ppc.rpm \
		libjpeg6a-6a-5.ppc.rpm xpm-3.4k-1.ppc.rpm \
		ncurses-5.0-12.ppc.rpm readline-2.2.1-7a.ppc.rpm
DISTFILES+=	${RPMFILES}
DISTFILES+=	openmotif-2.1.30-3_MLI_jdk.tar.gz

MAINTAINER=		pkgsrc-users@NetBSD.org
COMMENT=		Libraries to run Linux binaries on NetBSD/powerpc (includes X11)

BUILD_DEPENDS+=		rpm2pkg>=1.2:../../pkgtools/rpm2pkg

CONFLICTS=		suse_base-[0-9]*

ONLY_FOR_PLATFORM=	NetBSD-1.5[U-Z]-powerpc NetBSD-1.5Z[A-Z]-powerpc \
			NetBSD-1.6*-powerpc NetBSD-[2-9]*-powerpc

WRKSRC=			${WRKDIR}/${DISTNAME}
CHECK_SHLIBS_SUPPORTED=	no
DIST_SUBDIR=		linuxppc_lib
PLIST_SRC=		${WRKDIR}/PLIST_DYNAMIC

USE_TOOLS+=		gtar

EMUL_LINUX=		emul/linux
LINUX_LDCONFIG=		${PREFIX}/${EMUL_LINUX}/sbin/ldconfig
RPM2PKG=		rpm2pkg
SORT=			sort
RPMARGS+=		-i usr/man -i usr/doc -i usr/info
.for TEMP in ${RPMFILES}
RPMARGS+=		${DISTDIR}/${DIST_SUBDIR}/${TEMP}
.endfor

do-extract:
	${MKDIR} ${WRKSRC}

do-build:	#do nothing

do-install:
	${RM} -f ${WRKDIR}/PLIST_DYNAMIC
	${INSTALL_DATA_DIR} ${PREFIX}/${EMUL_LINUX}
	${INSTALL_DATA_DIR} /${EMUL_LINUX}
	${RPM2PKG} -d ${PREFIX} -f ${WRKDIR}/PLIST_DYNAMIC -p emul/linux ${RPMARGS}

	# Fix Linux's ldd paths (ldd is a shell script on Linux)
	${SED} 's|^\(TEXTDOMAINDIR=\)\(/usr/share/locale\)|\1${PREFIX}/${EMUL_LINUX}\2|; \
		s|^\(RTLD=\)\(/lib/ld.so.1\)|\1${PREFIX}/${EMUL_LINUX}\2|' \
		${PREFIX}/${EMUL_LINUX}/usr/bin/ldd > \
		${PREFIX}/${EMUL_LINUX}/usr/bin/ldd.new
	${MV} ${PREFIX}/${EMUL_LINUX}/usr/bin/ldd.new \
	    ${PREFIX}/${EMUL_LINUX}/usr/bin/ldd
	${CHMOD} 755 ${PREFIX}/${EMUL_LINUX}/usr/bin/ldd

	# Unpack shared libraries for OpenMotif
	cd ${PREFIX}/${EMUL_LINUX}/usr/X11R6 ; ${GTAR} -x 'lib/*.so*' \
	    -zvf ${DISTDIR}/${DIST_SUBDIR}/openmotif-2.1.30-3_MLI_jdk.tar.gz | \
	    ${SED} -e "s|^|${EMUL_LINUX}/usr/X11R6/|" >> ${WRKDIR}/PLIST_DYNAMIC

	# Make the link /usr/pkg/emul/linux -> /emul/linux
	${TEST} -f /emul/linux/lib/ld.so.1 || ( ${RMDIR} /${EMUL_LINUX} && \
	    ${LN} -sf ${PREFIX}/${EMUL_LINUX} /${EMUL_LINUX} )

	# Create ld.so.conf and ld.so.cache. (uses Linux's ldconfig)
	${TOUCH} ${PREFIX}/${EMUL_LINUX}/etc/ld.so.cache~
	${CP} ${FILESDIR}/ld.so.conf ${PREFIX}/${EMUL_LINUX}/etc/ld.so.conf
	${LINUX_LDCONFIG} -r ${PREFIX}/${EMUL_LINUX} -v | \
		${SED} -n '/^\/.*:$$/h; /(changed)$$/{G; \
		s|[[:blank:]]\([^ ]\{1,\}\) =>.*\n/\(.*\):$$|${EMUL_LINUX}/\2/\1|p;}' \
		>> ${WRKDIR}/PLIST_DYNAMIC
	${ECHO} "${EMUL_LINUX}/etc/ld.so.conf" >> ${WRKDIR}/PLIST_DYNAMIC
	${SORT} -r ${WRKDIR}/PLIST_DYNAMIC > ${WRKDIR}/PLIST_DYNAMIC.sorted
	${MV} ${WRKDIR}/PLIST_DYNAMIC.sorted ${WRKDIR}/PLIST_DYNAMIC

.include "../../mk/bsd.pkg.mk"