pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/www/gitea



Module Name:    pkgsrc
Committed By:   jperkin
Date:           Thu May 21 13:35:12 UTC 2020

Modified Files:
        pkgsrc/www/gitea: Makefile

Log Message:
gitea: Various fixes.

Add a target to generate the frontend artefacts that are required at
runtime, but do not build them by default as they require nodejs/npm which
will download node modules during the build.  Instead use a pre-built copy
stored in LOCAL_PORTS.  The web interface should now look correct.

Use the supplied Makefile to simplify some of the targets.

Remove unnecessary MAKE_DIRS (shadows an OWN_DIRS_PERMS), and fix
permissions on some of the installed files.

Based on joyent/pkgsrc#263 from GitHub user teutat3s.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 pkgsrc/www/gitea/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/www/gitea/Makefile
diff -u pkgsrc/www/gitea/Makefile:1.33 pkgsrc/www/gitea/Makefile:1.34
--- pkgsrc/www/gitea/Makefile:1.33      Sun May 17 14:50:40 2020
+++ pkgsrc/www/gitea/Makefile   Thu May 21 13:35:12 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.33 2020/05/17 14:50:40 nia Exp $
+# $NetBSD: Makefile,v 1.34 2020/05/21 13:35:12 jperkin Exp $
 
 DISTNAME=      gitea-1.11.5
 MASTER_SITES=  ${MASTER_SITE_GITHUB:=go-gitea/}
@@ -13,19 +13,30 @@ LICENSE=    mit
 GO_DIST_BASE=          ${DISTNAME}
 GO_SRCPATH=            code.gitea.io/gitea
 
+FRONTEND=              ${DISTNAME}-frontend.tar.gz
+SITES.${FRONTEND}=     ${MASTER_SITE_LOCAL}
+DISTFILES:=            ${DEFAULT_DISTFILES} ${FRONTEND}
+
+BUILD_TARGET=  backend
+
+#
+# When updating this package it is necessary to build the front-end artefacts
+# and upload them to LOCAL_PORTS.  Doing this at build time is untenable as npm
+# will download a significant number of modules.
+#
+# Install nodejs>=10 and npm, uncomment the additional BUILD_TARGET, run the
+# generate-artefacts target, then upload the distfile to LOCAL_PORTS.
+#
+#BUILD_TARGET+=        frontend
+#
+
 .include "../../lang/go/go-vars.mk"
 .include "options.mk"
 
-.if !empty(GO_TAGS)
-GO_BUILD_PATTERN+=     -tags "${GO_TAGS}"
-.endif
-
-GO_BUILD_PATTERN+=     ${GO_SRCPATH}
-
 BUILD_DEFS+=   VARBASE GITEA_USER GITEA_GROUP
 
 EXTRACT_USING= bsdtar
-USE_TOOLS+=    pax
+USE_TOOLS+=    ggrep gmake pax tar
 DEPENDS+=      git-base-[0-9]*:../../devel/git-base
 
 EGDIR=         ${PREFIX}/share/examples/gitea
@@ -50,21 +61,12 @@ PKG_USERS=  ${GITEA_USER}:${GITEA_GROUP}
 PKG_SHELL.${GITEA_USER}=       ${SH}
 PKG_HOME.${GITEA_USER}=                ${VARBASE}/db/gitea
 
-SUBST_CLASSES+=                        fix-version
-SUBST_STAGE.fix-version=       pre-configure
-SUBST_MESSAGE.fix-version=     Fix the outdated version number.
-SUBST_FILES.fix-version=       main.go
-SUBST_SED.fix-version=         -e 's,^\(       Version = \)"1\.9\.0-dev",\1"${PKGVERSION}",'
-SUBST_NOOP_OK.fix-version=     no
-
 SUBST_CLASSES+=                fix-var
 SUBST_STAGE.fix-var=   pre-configure
 SUBST_MESSAGE.fix-var= Replace some vars
 SUBST_FILES.fix-var=   ${WRKDIR}/app.ini.sample
 SUBST_VARS.fix-var=    VARBASE GITEA_USER
 
-MAKE_DIRS+=    ${PKG_SYSCONFDIR}/conf
-
 CONF_FILES_PERMS+=     ${EGDIR}/app.ini.sample ${PKG_SYSCONFDIR}/conf/app.ini \
                        ${GITEA_USER} ${GITEA_GROUP} 0600
 
@@ -75,17 +77,34 @@ FILES_SUBST+=       GITEA_SHARE_DIR=${PREFIX}/
 
 RCD_SCRIPTS+=  gitea
 
+MAKE_ENV+=     TAGS="${GO_TAGS}"
+
 pre-patch:
        ${CP} ${FILESDIR}/app.ini.sample ${WRKDIR}/
+       ${CP} ${WRKDIR}/${DISTNAME}/.eslint* ${WRKSRC}/
+       ${CP} ${WRKDIR}/${DISTNAME}/.stylelintrc ${WRKSRC}/
+       ${ECHO} ${PKGVERSION_NOREV} > ${WRKSRC}/VERSION
+
+do-build:
+       cd ${WRKSRC} && ${BUILD_MAKE_CMD} ${BUILD_TARGET}
 
 do-install:
-       ${INSTALL_PROGRAM} ${WRKDIR}/bin/gitea ${DESTDIR}${PREFIX}/sbin
+       ${INSTALL_PROGRAM} ${WRKSRC}/gitea ${DESTDIR}${PREFIX}/sbin
        cd ${WRKSRC}/options && ${PAX} -rw -pp . ${DESTDIR}${PREFIX}/share/gitea/options/
        cd ${WRKSRC}/templates && ${PAX} -rw -pp . ${DESTDIR}${PREFIX}/share/gitea/templates/
        cd ${WRKSRC}/public && ${PAX} -rw -pp . ${DESTDIR}${PREFIX}/share/gitea/public/
+       cd ${WRKDIR}/public && ${PAX} -rw -pp . ${DESTDIR}${PREFIX}/share/gitea/public/
+       ${CHMOD} -R g-w ${DESTDIR}${PREFIX}/share/gitea
+       ${CHMOD} -x ${DESTDIR}${PREFIX}/share/gitea/public/vendor/plugins/tribute/tribute.css
+       ${CHMOD} -x ${DESTDIR}${PREFIX}/share/gitea/public/vendor/plugins/tribute/tribute.min.js
 
 post-install:
        ${INSTALL_DATA} ${WRKDIR}/app.ini.sample ${DESTDIR}${EGDIR}
 
+.PHONY: generate-frontend
+generate-frontend: build
+       cd ${WRKSRC} && ${TAR} -zcf ${WRKDIR}/${PKGNAME_NOREV}-frontend.tar.gz public/css public/js
+       @${ECHO} "Now upload ${WRKDIR}/${PKGNAME_NOREV}-frontend.tar.gz to LOCAL_PORTS"
+
 .include "../../lang/go/go-package.mk"
 .include "../../mk/bsd.pkg.mk"



Home | Main Index | Thread Index | Old Index