1PORTNAME=	c7
2PORTVERSION=	${LINUX_DIST_VER}
3PORTREVISION=	4
4CATEGORIES=	emulators linux
5PKGNAMEPREFIX=	linux_base-
6EXTRACT_ONLY=	${DISTFILES:N*${SRC_SUFX}*:Nfilesystem-*:C/:[^:]+$//}
7
8MAINTAINER=	ports@MidnightBSD.org
9COMMENT=	Base set of packages needed in Linux mode (Linux CentOS ${LINUX_DIST_VER})
10
11LICENSE=	agg
12
13CONFLICTS=	linux_base-rl9-*
14
15SKIP_FAKE_ALL=	yes
16
17USES=		linux:c7
18USE_LINUX=	# empty
19USE_LINUX_RPM=	yes
20PLIST=                 ${PKGDIR}/pkg-plist.${ARCH}
21
22# lib64/gconv/ stuff that is loaded dynamically and has rpath
23NO_SHLIB_REQUIRES_GLOB=	libCNS.so* libGB.so* libISOIR165.so* \
24			libJIS.so* libJISX0213.so* libKSC.so*
25
26BIN_DISTNAMES=	bash-4.2.46-35.el7_9 \
27		bzip2-1.0.6-13.el7 \
28		centos-release-7-9.2009.2.el7.centos \
29		coreutils-8.22-24.el7_9.2 \
30		diffutils-3.3-6.el7_9 \
31		e2fsprogs-1.42.9-19.el7 \
32		filesystem-3.2-25.el7 \
33		findutils-4.5.11-6.el7 \
34		gawk-4.0.2-4.el7_3.1 \
35		glibc-common-${GLIBC_VER} \
36		grep-2.20-3.el7 \
37		info-5.1-5.el7 \
38		keyutils-1.5.8-3.el7 \
39		less-458-10.el7_9 \
40		ncurses-5.9-14.20130511.el7_4 \
41		sed-4.2.2-7.el7 \
42		setserial-2.17-33.el7 \
43		which-2.20-7.el7
44LIB_DISTNAMES=	audit-libs-2.8.5-4.el7 \
45		bzip2-libs-1.0.6-13.el7 \
46		compat-db47-4.7.25-28.el7 \
47		e2fsprogs-libs-1.42.9-19.el7 \
48		gamin-0.1.10-16.el7 \
49		gdbm-1.10-8.el7 \
50		glib2-2.56.1-9.el7_9 \
51		glibc-${GLIBC_VER} \
52		gmp-6.0.0-15.el7 \
53		keyutils-libs-1.5.8-3.el7 \
54		krb5-libs-1.15.1-55.el7_9 \
55		libacl-2.2.51-15.el7 \
56		libattr-2.4.46-13.el7 \
57		libblkid-2.23.2-65.el7_9.1 \
58		libcap-2.22-11.el7 \
59		libcap-ng-0.7.5-4.el7 \
60		libcom_err-1.42.9-19.el7 \
61		libdb-5.3.21-25.el7 \
62		libffi-3.0.13-19.el7 \
63		libgcc-4.8.5-44.el7 \
64		libidn-1.28-4.el7 \
65		libmount-2.23.2-65.el7_9.1 \
66		libselinux-2.5-15.el7 \
67		libsepol-2.5-10.el7 \
68		libstdc++-4.8.5-44.el7 \
69		libuuid-2.23.2-65.el7_9.1 \
70		libverto-0.2.5-4.el7 \
71		mpfr-3.1.1-4.el7 \
72		ncurses-libs-5.9-14.20130511.el7_4 \
73		nss-softokn-freebl-3.90.0-6.el7_9 \
74		openssl-libs-1.0.2k-26.el7_9 \
75		pcre-8.32-17.el7 \
76		popt-1.13-16.el7 \
77		readline-6.2-11.el7 \
78		slang-2.2.4-11.el7 \
79		util-linux-2.23.2-65.el7_9.1 \
80		xz-libs-5.2.2-2.el7_9 \
81		zlib-1.2.7-21.el7_9
82
83LIB_DISTNAMES_aarch64=	redhat-lsb-core-4.1-27.el7.1
84
85LIB_DISTNAMES_amd64=	compat-libstdc++-33-3.2.3-72.el7 \
86		redhat-lsb-core-4.1-27.el7.centos.1
87
88LIB_DISTNAMES_i386=	compat-libstdc++-33-3.2.3-72.el7 \
89		redhat-lsb-core-4.1-27.el7.centos.1
90
91SHARE_DISTNAMES=basesystem-10.0-7.el7.centos \
92		ncurses-base-5.9-14.20130511.el7_4 \
93		setup-2.8.71-11.el7
94SRC_DISTFILES=	acl-2.2.51-15.el7${SRC_SUFX}:SOURCE \
95		attr-2.4.46-13.el7${SRC_SUFX}:SOURCE \
96		audit-2.8.5-4.el7${SRC_SUFX}:SOURCE \
97		basesystem-10.0-7.el7.centos${SRC_SUFX}:SOURCE \
98		bash-4.2.46-35.el7_9${SRC_SUFX}:SOURCE \
99		bzip2-1.0.6-13.el7${SRC_SUFX}:SOURCE \
100		centos-release-7-9.2009.2.el7.centos${SRC_SUFX}:SOURCE \
101		compat-db-4.7.25-28.el7${SRC_SUFX}:SOURCE \
102		compat-gcc-32-3.2.3-72.el7${SRC_SUFX}:SOURCE \
103		coreutils-8.22-24.el7_9.2${SRC_SUFX}:SOURCE \
104		diffutils-3.3-6.el7_9${SRC_SUFX}:SOURCE \
105		e2fsprogs-1.42.9-19.el7${SRC_SUFX}:SOURCE \
106		filesystem-3.2-25.el7${SRC_SUFX}:SOURCE \
107		findutils-4.5.11-6.el7${SRC_SUFX}:SOURCE \
108		gamin-0.1.10-16.el7${SRC_SUFX}:SOURCE \
109		gawk-4.0.2-4.el7_3.1${SRC_SUFX}:SOURCE \
110		gcc-4.8.5-44.el7${SRC_SUFX}:SOURCE \
111		gdbm-1.10-8.el7${SRC_SUFX}:SOURCE \
112		glib2-2.56.1-9.el7_9${SRC_SUFX}:SOURCE \
113		glibc-${GLIBC_VER}${SRC_SUFX}:amd64 \
114		gmp-6.0.0-15.el7${SRC_SUFX}:SOURCE \
115		grep-2.20-3.el7${SRC_SUFX}:SOURCE \
116		keyutils-1.5.8-3.el7${SRC_SUFX}:SOURCE \
117		krb5-1.15.1-55.el7_9${SRC_SUFX}:SOURCE \
118		less-458-10.el7_9${SRC_SUFX}:SOURCE \
119		libcap-2.22-11.el7${SRC_SUFX}:SOURCE \
120		libcap-ng-0.7.5-4.el7${SRC_SUFX}:SOURCE \
121		libdb-5.3.21-25.el7${SRC_SUFX}:SOURCE \
122		libffi-3.0.13-19.el7${SRC_SUFX}:SOURCE \
123		libidn-1.28-4.el7${SRC_SUFX}:SOURCE \
124		libselinux-2.5-15.el7${SRC_SUFX}:SOURCE \
125		libsepol-2.5-10.el7${SRC_SUFX}:SOURCE \
126		mpfr-3.1.1-4.el7${SRC_SUFX}:SOURCE \
127		ncurses-5.9-14.20130511.el7_4${SRC_SUFX}:SOURCE \
128		nss-softokn-3.90.0-6.el7_9${SRC_SUFX}:SOURCE \
129		openssl-1.0.2k-26.el7_9${SRC_SUFX}:SOURCE \
130		pcre-8.32-17.el7${SRC_SUFX}:SOURCE \
131		popt-1.13-16.el7${SRC_SUFX}:SOURCE \
132		readline-6.2-11.el7${SRC_SUFX}:SOURCE \
133		redhat-lsb-4.1-27.el7.centos.1${SRC_SUFX}:SOURCE \
134		sed-4.2.2-7.el7${SRC_SUFX}:SOURCE \
135		setserial-2.17-33.el7${SRC_SUFX}:SOURCE \
136		setup-2.8.71-11.el7${SRC_SUFX}:SOURCE \
137		slang-2.2.4-11.el7${SRC_SUFX}:SOURCE \
138		texinfo-5.1-5.el7${SRC_SUFX}:SOURCE \
139		util-linux-2.23.2-65.el7_9.1${SRC_SUFX}:SOURCE \
140		which-2.20-7.el7${SRC_SUFX}:SOURCE \
141		xz-5.2.2-2.el7_9${SRC_SUFX}:SOURCE \
142		zlib-1.2.7-21.el7_9${SRC_SUFX}:SOURCE
143
144PLIST_SUB=	LINUXBASE=${LINUXBASE} SYSCTLMIB=${SYSCTLMIB}
145
146OPTIONS_DEFINE=	DOCS NLS
147OPTIONS_SUB=	yes
148
149REMOVE_DIRS=	boot etc/pam.d home media mnt proc root run sys tmp var/log \
150		var/tmp
151REMOVE_FILES=	bin/chfn bin/chsh bin/findmnt bin/login bin/lsblk bin/lscpu \
152		bin/lsipc bin/lslogins bin/lsmem bin/lsns bin/script \
153		bin/setpriv bin/su \
154		etc/exports etc/group etc/gshadow etc/motd \
155		etc/passwd etc/printcap etc/protocols etc/services etc/shadow \
156		sbin/clock sbin/debugfs sbin/hwclock sbin/runuser sbin/zramctl
157
158.include <bsd.mport.options.mk>
159
160GLIBC_VER=	2.17-326.el7_9.3
161PLIST_SUB+=	NEWGLIBC=""
162
163.if ${ARCH} == aarch64 || ${ARCH} == amd64
164SYSCTLMIB=	kern.features.linux64
165.else
166SYSCTLMIB=	compat.linux.osrelease
167.endif
168
169post-extract:
170# These directories become symbolic links when the filesystem distfile is
171# extracted.  Other distfiles cannot be extracted when these are links so the
172# filesystem distfile must be extracted last.
173.for d in bin lib lib64 sbin
174	@(cd ${WRKSRC} && if [ -e ${d} -a ! -L ${d} ]; then \
175		${FIND} ${d} | ${CPIO} -dumpl --quiet usr && ${RM} -r ${d}; fi)
176.endfor
177	@(cd ${WRKSRC} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} \
178		${DISTDIR}/${DIST_SUBDIR}/filesystem-3.2-25.el7${EXTRACT_SUFX_${ARCH}} \
179		${EXTRACT_AFTER_ARGS})
180.if ${ARCH} == i386
181	@${CHMOD} u+w ${WRKSRC}/usr/lib/pm-utils
182.elif ${ARCH} == aarch64 || ${ARCH} == amd64
183	@${CHMOD} u+w ${WRKSRC}/usr/lib64/pm-utils
184.endif
185
186post-patch:
187	@${RM} -r ${REMOVE_DIRS:S|^|${WRKSRC}/|}
188	@${RM} ${REMOVE_FILES:S|^|${WRKSRC}/|}
189	@${FIND} ${WRKSRC}/usr -type d -empty -not -path '*/lib*/gio/*' -delete
190.if ${ARCH} == amd64  ||  ${ARCH} == i386
191	@${BRANDELF} -t Linux ${WRKSRC}/usr/lib/ld-2.17.so
192.endif
193.if ${ARCH} == aarch64 || ${ARCH} == amd64
194	@${BRANDELF} -t Linux ${WRKSRC}/usr/lib64/ld-2.17.so
195.endif
196
197post-install:
198	${MV} ${PREFIX}/etc/krb5.conf \
199		${PREFIX}/etc/krb5.conf.sample
200	${MV} ${PREFIX}/etc/nsswitch.conf \
201		${PREFIX}/etc/nsswitch.conf.sample
202	${MV} ${PREFIX}/usr/lib/locale/locale-archive.tmpl \
203		${PREFIX}/usr/lib/locale/locale-archive
204	${LN} -sf "../proc/self/mounts" ${PREFIX}/etc/mtab
205	${LN} -sf ${LOCALBASE}/share/icons ${PREFIX}/usr/share/icons
206	${LN} -sf /var/run ${PREFIX}/run
207	${LN} -sf /var/tmp ${PREFIX}/usr/tmp
208
209.include <bsd.port.mk>
210