Add "build" stage to many Go packages (#36795)
This commit is contained in:
parent
abb236e98a
commit
f82b4a68b8
@ -24,5 +24,14 @@ class Direnv(Package):
|
|||||||
depends_on("go@1.16:", type="build", when="@2.28:")
|
depends_on("go@1.16:", type="build", when="@2.28:")
|
||||||
depends_on("go", type="build")
|
depends_on("go", type="build")
|
||||||
|
|
||||||
|
phases = ["build", "install"]
|
||||||
|
|
||||||
|
def setup_build_environment(self, env):
|
||||||
|
# Point GOPATH at the top of the staging dir for the build step.
|
||||||
|
env.prepend_path("GOPATH", self.stage.path)
|
||||||
|
|
||||||
|
def build(self, spec, prefix):
|
||||||
|
make()
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
make("install", "PREFIX=%s" % prefix)
|
make("install", "PREFIX=%s" % prefix)
|
||||||
|
@ -30,6 +30,14 @@ class Gh(Package):
|
|||||||
|
|
||||||
depends_on("go@1.16:", type="build")
|
depends_on("go@1.16:", type="build")
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
phases = ["build", "install"]
|
||||||
|
|
||||||
|
def setup_build_environment(self, env):
|
||||||
|
# Point GOPATH at the top of the staging dir for the build step.
|
||||||
|
env.prepend_path("GOPATH", self.stage.path)
|
||||||
|
|
||||||
|
def build(self, spec, prefix):
|
||||||
make()
|
make()
|
||||||
|
|
||||||
|
def install(self, spec, prefix):
|
||||||
make("install", "prefix=" + prefix)
|
make("install", "prefix=" + prefix)
|
||||||
|
@ -22,6 +22,15 @@ class Glab(Package):
|
|||||||
|
|
||||||
depends_on("go@1.13:", type="build")
|
depends_on("go@1.13:", type="build")
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
phases = ["build", "install"]
|
||||||
|
|
||||||
|
def setup_build_environment(self, env):
|
||||||
|
# Point GOPATH at the top of the staging dir for the build step.
|
||||||
|
env.prepend_path("GOPATH", self.stage.path)
|
||||||
|
|
||||||
|
def build(self, spec, prefix):
|
||||||
make()
|
make()
|
||||||
make("install", "prefix=" + prefix)
|
|
||||||
|
def install(self, spec, prefix):
|
||||||
|
mkdirp(prefix.bin)
|
||||||
|
install("bin/glab", prefix.bin)
|
||||||
|
@ -51,6 +51,8 @@ class Hugo(Package):
|
|||||||
|
|
||||||
variant("extended", default=False, description="Enable extended features")
|
variant("extended", default=False, description="Enable extended features")
|
||||||
|
|
||||||
|
phases = ["build", "install"]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def determine_version(cls, exe):
|
def determine_version(cls, exe):
|
||||||
output = Executable(exe)("version", output=str, error=str)
|
output = Executable(exe)("version", output=str, error=str)
|
||||||
@ -58,13 +60,16 @@ def determine_version(cls, exe):
|
|||||||
return match.group(1) if match else None
|
return match.group(1) if match else None
|
||||||
|
|
||||||
def setup_build_environment(self, env):
|
def setup_build_environment(self, env):
|
||||||
|
# Point GOPATH at the top of the staging dir for the build step.
|
||||||
env.prepend_path("GOPATH", self.stage.path)
|
env.prepend_path("GOPATH", self.stage.path)
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def build(self, spec, prefix):
|
||||||
go_args = ["build"]
|
go_args = ["build"]
|
||||||
if self.spec.satisfies("+extended"):
|
if self.spec.satisfies("+extended"):
|
||||||
go_args.extend(["--tags", "extended"])
|
go_args.extend(["--tags", "extended"])
|
||||||
|
|
||||||
go(*go_args)
|
go(*go_args)
|
||||||
|
|
||||||
|
def install(self, spec, prefix):
|
||||||
mkdirp(prefix.bin)
|
mkdirp(prefix.bin)
|
||||||
install("hugo", prefix.bin)
|
install("hugo", prefix.bin)
|
||||||
|
@ -66,11 +66,15 @@ class Rclone(Package):
|
|||||||
|
|
||||||
depends_on("go@1.15:", type="build")
|
depends_on("go@1.15:", type="build")
|
||||||
|
|
||||||
|
phases = ["build", "install"]
|
||||||
|
|
||||||
def setup_build_environment(self, env):
|
def setup_build_environment(self, env):
|
||||||
# Point GOPATH at the top of the staging dir for the build step.
|
# Point GOPATH at the top of the staging dir for the build step.
|
||||||
env.prepend_path("GOPATH", self.stage.path)
|
env.prepend_path("GOPATH", self.stage.path)
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def build(self, spec, prefix):
|
||||||
go("build")
|
go("build")
|
||||||
|
|
||||||
|
def install(self, spec, prefix):
|
||||||
mkdirp(prefix.bin)
|
mkdirp(prefix.bin)
|
||||||
install("rclone", prefix.bin)
|
install("rclone", prefix.bin)
|
||||||
|
@ -23,11 +23,15 @@ class Restic(Package):
|
|||||||
depends_on("go@1.15:", type="build", when="@0.14.0:")
|
depends_on("go@1.15:", type="build", when="@0.14.0:")
|
||||||
depends_on("go", type="build")
|
depends_on("go", type="build")
|
||||||
|
|
||||||
|
phases = ["build", "install"]
|
||||||
|
|
||||||
def setup_build_environment(self, env):
|
def setup_build_environment(self, env):
|
||||||
# Point GOPATH at the top of the staging dir for the build step.
|
# Point GOPATH at the top of the staging dir for the build step.
|
||||||
env.prepend_path("GOPATH", self.stage.path)
|
env.prepend_path("GOPATH", self.stage.path)
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def build(self, spec, prefix):
|
||||||
go("run", "build.go")
|
go("run", "build.go")
|
||||||
|
|
||||||
|
def install(self, spec, prefix):
|
||||||
mkdirp(prefix.bin)
|
mkdirp(prefix.bin)
|
||||||
install("restic", prefix.bin)
|
install("restic", prefix.bin)
|
||||||
|
Loading…
Reference in New Issue
Block a user