Add new port: devel/mage

Mage is a make/rake-like build tool using Go. You write plain-old go functions,
and Mage automatically uses them as Makefile-like runnable targets.
Makefiles are hard to read and hard to write. Mostly because makefiles are
essentially fancy bash scripts with significant white space and additional
make-related syntax.

Approved by:	swills (mentor)
Differential Revision:	https://reviews.freebsd.org/D15159
This commit is contained in:
Sean Chittenden 2018-04-23 00:22:17 +00:00
parent a060608f58
commit 9a13869ded
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=468067
5 changed files with 76 additions and 0 deletions

View file

@ -1699,6 +1699,7 @@
SUBDIR += m17n-docs
SUBDIR += m17n-lib
SUBDIR += m4
SUBDIR += mage
SUBDIR += magit
SUBDIR += magit-popup
SUBDIR += make++

38
devel/mage/Makefile Normal file
View file

@ -0,0 +1,38 @@
# $FreeBSD$
PORTNAME= mage
DISTVERSIONPREFIX= v
DISTVERSION= 2.1.0
CATEGORIES= devel
MAINTAINER= seanc@FreeBSD.org
COMMENT= Command-line make-like build tool using Go as input files
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/LICENSE
BUILD_DEPENDS= go:lang/go
USE_GITHUB= yes
GH_ACCOUNT= magefile
GH_SUBDIR= src/github.com/${GH_ACCOUNT}/${PORTNAME}
GH_TAGNAME= 2.1
GH_TAG_COMMIT= 771ebed
PLIST_FILES= bin/mage
pre-patch:
@${SED} -e "s|%%GH_TAGNAME%%|${GH_TAGNAME}|g; s|%%GH_TAG_COMMIT%%|${GH_TAG_COMMIT}|g" \
${FILESDIR}/patch-magefile.go > ${WRKSRC}/magefile.go.patch
do-patch:
@cd ${WRKSRC} && ${PATCH} --forward --quiet -p2 < magefile.go.patch
do-build:
@cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} CGO_ENABLED=0 GOPATH=${WRKSRC} \
${LOCALBASE}/bin/go run bootstrap.go
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/bin/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
.include <bsd.port.mk>

3
devel/mage/distinfo Normal file
View file

@ -0,0 +1,3 @@
TIMESTAMP = 1524434645
SHA256 (magefile-mage-v2.1.0-2.1_GH0.tar.gz) = ac4ad1cfaf0a4ee67b1cbb0ea52792c5bc2ce240ee763fdc8d537bb14b40011a
SIZE (magefile-mage-v2.1.0-2.1_GH0.tar.gz) = 8777256

View file

@ -0,0 +1,17 @@
--- magefile.go.orig 2018-04-11 17:03:07 UTC
+++ magefile.go
@@ -83,12 +83,14 @@ func flags() (string, error) {
// tag returns the git tag for the current branch or "" if none.
func tag() string {
+ return "%%GH_TAGNAME%%"
s, _ := sh.Output("git", "describe", "--tags")
return s
}
// hash returns the git hash for the current repo or "" if none.
func hash() string {
+ return "%%GH_TAG_COMMIT%%"
hash, _ := sh.Output("git", "rev-parse", "--short", "HEAD")
return hash
}

17
devel/mage/pkg-descr Normal file
View file

@ -0,0 +1,17 @@
Mage is a make/rake-like build tool using Go. You write plain-old go functions,
and Mage automatically uses them as Makefile-like runnable targets.
Makefiles are hard to read and hard to write. Mostly because makefiles are
essentially fancy bash scripts with significant white space and additional
make-related syntax.
Mage lets you have multiple magefiles, name your magefiles whatever you want,
and they're easy to customize for multiple operating systems. Mage has no
dependencies (aside from go) and runs just fine on all major operating systems,
whereas make generally uses bash which is not well supported on Windows. Go is
superior to bash for any non-trivial task involving branching, looping, anything
that's not just straight line execution of commands. And if your project is
written in Go, why introduce another language as idiosyncratic as bash? Why not
use the language your contributors are already comfortable with?
WWW: https://magefile.org/