Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9efb8c77 authored by Roland Levillain's avatar Roland Levillain
Browse files

Have `symlink_preferred_arch: true` honor the `stem` property.

If a module defines a `stem` property, use it to name the symlink
created for `symlink_preferred_arch: true` (instead of the module's
name).

Also always require suffixes when using `symlink_preferred_arch: true`.

Test: m
Change-Id: Ia8a56f94d21599194797ef8b259f5f03e08cb16a
parent 50e91c1a
Loading
Loading
Loading
Loading
+9 −5
Original line number Original line Diff line number Diff line
@@ -106,13 +106,17 @@ func (binary *binaryDecorator) linkerProps() []interface{} {


}
}


func (binary *binaryDecorator) getStem(ctx BaseModuleContext) string {
func (binary *binaryDecorator) getStemWithoutSuffix(ctx BaseModuleContext) string {
	stem := ctx.baseModuleName()
	stem := ctx.baseModuleName()
	if String(binary.Properties.Stem) != "" {
	if String(binary.Properties.Stem) != "" {
		stem = String(binary.Properties.Stem)
		stem = String(binary.Properties.Stem)
	}
	}


	return stem + String(binary.Properties.Suffix)
	return stem
}

func (binary *binaryDecorator) getStem(ctx BaseModuleContext) string {
	return binary.getStemWithoutSuffix(ctx) + String(binary.Properties.Suffix)
}
}


func (binary *binaryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
func (binary *binaryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
@@ -398,11 +402,11 @@ func (binary *binaryDecorator) link(ctx ModuleContext,
	}
	}


	if Bool(binary.Properties.Symlink_preferred_arch) {
	if Bool(binary.Properties.Symlink_preferred_arch) {
		if String(binary.Properties.Stem) == "" && String(binary.Properties.Suffix) == "" {
		if String(binary.Properties.Suffix) == "" {
			ctx.PropertyErrorf("symlink_preferred_arch", "must also specify stem or suffix")
			ctx.PropertyErrorf("symlink_preferred_arch", "must also specify suffix")
		}
		}
		if ctx.TargetPrimary() {
		if ctx.TargetPrimary() {
			binary.symlinks = append(binary.symlinks, ctx.baseModuleName())
			binary.symlinks = append(binary.symlinks, binary.getStemWithoutSuffix(ctx))
		}
		}
	}
	}