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

Commit 1aa45b08 authored by Colin Cross's avatar Colin Cross
Browse files

Add musl_<arch> and glibc_<arch> properties

Add musl_<arch> and glibc_<arch> properties similar to bionic_<arch>.

Bug: 215802826
Test: m checkbuild
Change-Id: Icfc42ad7b54ee1052f84a46b7c0acffb0a27b236
parent 9b698b68
Loading
Loading
Loading
Loading
+30 −3
Original line number Diff line number Diff line
@@ -917,7 +917,8 @@ func createArchPropTypeDesc(props reflect.Type) []archPropTypeDesc {
			for _, archType := range osArchTypeMap[os] {
				targets = append(targets, GetCompoundTargetField(os, archType))

				// Also add the special "linux_<arch>" and "bionic_<arch>" property structs.
				// Also add the special "linux_<arch>", "bionic_<arch>" , "glibc_<arch>", and
				// "musl_<arch>" property structs.
				if os.Linux() {
					target := "Linux_" + archType.Name
					if !InList(target, targets) {
@@ -930,6 +931,18 @@ func createArchPropTypeDesc(props reflect.Type) []archPropTypeDesc {
						targets = append(targets, target)
					}
				}
				if os == Linux {
					target := "Glibc_" + archType.Name
					if !InList(target, targets) {
						targets = append(targets, target)
					}
				}
				if os == LinuxMusl {
					target := "Musl_" + archType.Name
					if !InList(target, targets) {
						targets = append(targets, target)
					}
				}
			}
		}

@@ -1379,11 +1392,25 @@ func getArchProperties(ctx BaseMutatorContext, archProperties interface{}, arch
			result = append(result, osArchProperties)
		}

		if os == Linux {
			field := "Glibc_" + archType.Name
			userFriendlyField := "target.glibc_" + "_" + archType.Name
			if osArchProperties, ok := getChildPropertyStruct(ctx, targetProp, field, userFriendlyField); ok {
				result = append(result, osArchProperties)
			}
		}

		if os == LinuxMusl {
			field := "Musl_" + archType.Name
			userFriendlyField := "target.musl_" + "_" + archType.Name
			if osArchProperties, ok := getChildPropertyStruct(ctx, targetProp, field, userFriendlyField); ok {
				result = append(result, osArchProperties)
			}

			// Special case:  to ease the transition from glibc to musl, apply linux_glibc
			// properties (which has historically mean host linux) to musl variants.
			field := "Linux_glibc_" + archType.Name
			userFriendlyField := "target.linux_glibc_" + archType.Name
			field = "Linux_glibc_" + archType.Name
			userFriendlyField = "target.linux_glibc_" + archType.Name
			if osArchProperties, ok := getChildPropertyStruct(ctx, targetProp, field, userFriendlyField); ok {
				result = append(result, osArchProperties)
			}