1- # $NetBSD: Makefile,v 1.68 2025/06/07 15:58:49 taca Exp $
1+ # $NetBSD: Makefile,v 1.69 2025/06/16 09:21:45 jperkin Exp $
2+ #
3+ # This is super confusing, but the PEAR tarball does not include an installer,
4+ # it is only available in a different installer package which bundles the PEAR
5+ # tarball along with its dependencies. So our distfile is pearweb_phars, and
6+ # we override the version to whatever PEAR it bundles.
27#
38
4- DISTNAME = PEAR -1.10.16
5- PKGREVISION = 2
6- PKGNAME = ${PHP_PKG_PREFIX}-${DISTNAME:S/PEAR/ pear/}
9+ DISTNAME = pearweb_phars -1.10.24
10+ PKGREVISION = 3
11+ PKGNAME = ${PHP_PKG_PREFIX}-pear-1.10.16
712CATEGORIES = lang
813MASTER_SITES = http://download.pear.php.net/package/
914EXTRACT_SUFX = .tgz
@@ -14,11 +19,6 @@ COMMENT= PEAR Base System for PHP
1419LICENSE = 2-clause-bsd
1520
1621USE_LANGUAGES = # none
17- EXTRACT_ONLY= # none
18- USE_TOOLS+= bsdtar gzcat
19-
20- # go-pear.php fetch PEAR package information during install phase.
21- ALLOW_NETWORK_ACCESS = yes
2222
2323.include "../../lang/php/common.mk"
2424
@@ -28,61 +28,38 @@ PKG_SYSCONFVAR= php
2828CONF_FILES = ${PREFIX}/${PHP_EGDIR}/pear.conf \
2929 ${PKG_SYSCONFDIR}/pear.conf
3030
31- BUNDLE = ${WRKSRC}/install/go-pear-bundle
32-
33- # everything else that forms a part of the "base" PEAR install
34- #
35- PEAR_SRCS = ${DISTNAME}${EXTRACT_SUFX}
36- DISTFILES+ = ${PEAR_SRCS}
37- EXTRACT_ONLY+ = ${PEAR_SRCS}
38-
39- ARCHIVE_SRCS = Archive_Tar-1.5.0${EXTRACT_SUFX}
40- ARCHIVE_WRKSRC = ${WRKDIR}/${ARCHIVE_SRCS:S/${EXTRACT_SUFX}//}
41- DISTFILES+ = ${ARCHIVE_SRCS}
42- EXTRACT_ONLY+ = ${ARCHIVE_SRCS}
43-
44- CONSOLE_SRCS = Console_Getopt-1.4.3${EXTRACT_SUFX}
45- CONSOLE_WRKSRC = ${WRKDIR}/${CONSOLE_SRCS:S/${EXTRACT_SUFX}//}
46- DISTFILES+ = ${CONSOLE_SRCS}
47- EXTRACT_ONLY+ = ${CONSOLE_SRCS}
48-
49- STRUCTURES_SRCS = Structures_Graph-1.2.0${EXTRACT_SUFX}
50- DISTFILES+ = ${STRUCTURES_SRCS}
51-
52- XMLUTIL_SRCS = XML_Util-1.4.5${EXTRACT_SUFX}
53- DISTFILES+ = ${XMLUTIL_SRCS}
54-
55- #
56- # end of base components
57-
5831SUBST_CLASSES+ = config
5932SUBST_STAGE.config = pre-configure
60- SUBST_FILES.config = install/go-pear.php PEAR/Config .php
61- SUBST_VARS.config+ = PREFIX PHP_VER PHP_LIBDIR WRKSRC
33+ SUBST_FILES.config = src/ PEAR/Start .php
34+ SUBST_VARS.config+ = PHP_LIBDIR PKGMANDIR PREFIX WRKSRC
6235SUBST_MESSAGE.config = Fixing configuration files.
6336
6437PEAR_COMMANDS = pear peardev pecl
6538INSTALLATION_DIRS+ = ${PHP_EGDIR}
6639
67- pre-patch :
68- ${RM} ${WRKSRC} /INSTALL
69- ${MKDIR} ${WRKSRC} /install
70- ${MKDIR} ${BUNDLE}
71- ${CP} ${FILESDIR} /go-pear.php ${WRKSRC} /install
72- ${CP} ${WRKSRC} /PEAR.php ${BUNDLE}
40+ # TODO: This should probably be set in lang/php
41+ PHPBIN = ${PREFIX}/bin/php${PHP_VER}
42+
43+ # Unpack the .phar archive so that we can patch the source files.
44+ post-extract :
45+ cd ${WRKSRC} && ${PHPBIN} -d phar.readonly=0 -r \
46+ ' $$p = new Phar("go-pear.phar"); \
47+ $$ p-> extractTo(" src" ); '
48+ ${MV} ${WRKSRC} /go-pear.phar ${WRKSRC} /go-pear-orig.phar
7349
50+ # This does not actually build anything, just packs our patched source files
51+ # back to an updated .phar.
7452do-build :
75- .for f in ${DISTFILES}
76- ${GZCAT} ${DISTDIR}/${DIST_SUBDIR}/${f} > \
77- ${BUNDLE}/${f:S/${EXTRACT_SUFX}/.tar/}
78- .endfor
79- ${CP} ${ARCHIVE_WRKSRC}/Archive/Tar.php ${BUNDLE}
80- ${CP} ${CONSOLE_WRKSRC}/Console/Getopt.php ${BUNDLE}
81- cd ${WRKDIR} && bsdtar -u -f ${BUNDLE}/${DISTNAME}.tar \
82- ${DISTNAME}/PEAR/Config.php
53+ cd ${WRKSRC} && ${PHPBIN} -d phar.readonly=0 -r \
54+ ' $$p = new Phar("go-pear.phar", 0, "go-pear.phar"); \
55+ $$ p-> buildFromDirectory(dirname(__FILE__) . " /src" ); \
56+ $$ p-> setStub($$ p-> createDefaultStub(" index.php" )); '
57+
58+ INSTALL_ENV+ = PHP_PEAR_PHP_BIN=${PHPBIN}
8359
8460do-install :
85- ${SETENV} ${INSTALL_ENV} ${PREFIX} /bin/php${PHP_VER} ${WRKSRC} /install/go-pear.php local
61+ cd ${WRKSRC} && \
62+ ${PKGSRC_SETENV} ${INSTALL_ENV} ${PHPBIN} go-pear.phar
8663 ${INSTALL_DATA} ${WRKSRC} /pear.conf \
8764 ${DESTDIR}${PREFIX} /${PHP_EGDIR} /pear.conf
8865
0 commit comments