forked from security/hakurei
internal/rosa/make: alternative configure script
This enables using the configure helper with non-autotools configure scripts. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -53,6 +53,8 @@ type MakeAttr struct {
|
|||||||
|
|
||||||
// Whether to skip running the configure script.
|
// Whether to skip running the configure script.
|
||||||
SkipConfigure bool
|
SkipConfigure bool
|
||||||
|
// Alternative name for the configure script.
|
||||||
|
ConfigureName string
|
||||||
// Flags passed to the configure script.
|
// Flags passed to the configure script.
|
||||||
Configure [][2]string
|
Configure [][2]string
|
||||||
// Extra make targets.
|
// Extra make targets.
|
||||||
@@ -102,9 +104,12 @@ func (t Toolchain) NewViaMake(
|
|||||||
|
|
||||||
var configure string
|
var configure string
|
||||||
if !attr.SkipConfigure {
|
if !attr.SkipConfigure {
|
||||||
|
configure = attr.ConfigureName
|
||||||
|
if configure == "" {
|
||||||
configure += `
|
configure += `
|
||||||
/usr/src/` + name + `/configure \
|
/usr/src/` + name + `/configure \
|
||||||
--prefix=/system`
|
--prefix=/system`
|
||||||
|
}
|
||||||
|
|
||||||
if attr.Host != `""` {
|
if attr.Host != `""` {
|
||||||
configure += ` \
|
configure += ` \
|
||||||
@@ -121,10 +126,15 @@ func (t Toolchain) NewViaMake(
|
|||||||
slices.Collect(func(yield func(string) bool) {
|
slices.Collect(func(yield func(string) bool) {
|
||||||
for _, v := range attr.Configure {
|
for _, v := range attr.Configure {
|
||||||
s := v[0]
|
s := v[0]
|
||||||
if v[1] == "" || (v[0] != "" &&
|
if v[0] != "" &&
|
||||||
v[0][0] >= 'a' &&
|
v[0][0] >= 'a' &&
|
||||||
v[0][0] <= 'z') {
|
v[0][0] <= 'z' {
|
||||||
s = "--" + s
|
s = "--" + s
|
||||||
|
} else if len(v[0]) > 1 &&
|
||||||
|
v[0][0] == 'D' &&
|
||||||
|
v[0][1] >= 'a' &&
|
||||||
|
v[0][1] <= 'z' {
|
||||||
|
s = "-" + s
|
||||||
}
|
}
|
||||||
if v[1] != "" {
|
if v[1] != "" {
|
||||||
s += "=" + v[1]
|
s += "=" + v[1]
|
||||||
@@ -152,10 +162,11 @@ func (t Toolchain) NewViaMake(
|
|||||||
makeTargets = nil
|
makeTargets = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
finalExtra := []pkg.Artifact{
|
var finalExtra []pkg.Artifact
|
||||||
t.Load(Make),
|
if !t.isStage0() {
|
||||||
|
finalExtra = append(finalExtra, t.Load(Make))
|
||||||
}
|
}
|
||||||
if attr.OmitDefaults || attr.Flag&TEarly == 0 {
|
if !attr.OmitDefaults && attr.Flag&TEarly == 0 {
|
||||||
finalExtra = append(finalExtra,
|
finalExtra = append(finalExtra,
|
||||||
t.Load(Gawk),
|
t.Load(Gawk),
|
||||||
t.Load(Coreutils),
|
t.Load(Coreutils),
|
||||||
|
|||||||
Reference in New Issue
Block a user