Skip to content

Commit 49c7878

Browse files
authored
Name the softfp world so makepkg can build in it (#184)
makepkg turns CARCH into shell variable names -- depends_$CARCH, provides_$CARCH and five more -- so a world name with a hyphen in it is not a name makepkg can use. With CARCH=vita-softfp, bash reads ${provides_vita-softfp[@]} as ${provides_vita-...}: the variable provides_vita with the default value 'softfp[@]'. It appends that literal string to all seven arrays, and then the matching unset fails because the identifier is invalid and makepkg aborts. The abort is what saved us. Without it every softfp package would have shipped with a fabricated depends=softfp[@]. pacman assumes architectures are identifiers -- x86_64, aarch64, armv7h -- and never says so, because nobody had used a hyphen. So the world is vita_softfp now, and Profiles.cmake refuses any name that would break the same way.
1 parent e873ab7 commit 49c7878

5 files changed

Lines changed: 17 additions & 7 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ if(NOT VITASDK_FLOAT_ABI STREQUAL "hard" AND NOT VITASDK_FLOAT_ABI STREQUAL "sof
127127
message(FATAL_ERROR "VITASDK_FLOAT_ABI must be 'hard' or 'softfp', got '${VITASDK_FLOAT_ABI}'")
128128
endif()
129129
if(VITASDK_FLOAT_ABI STREQUAL "softfp")
130-
set(world_arch "vita-softfp")
130+
set(world_arch "vita_softfp")
131131
else()
132132
set(world_arch "vita")
133133
endif()

cmake/Profiles.cmake

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
include_guard(GLOBAL)
22

33
# Published profile (world) names; describe rejects anything else.
4-
set(VITASDK_PROFILES vita vita-softfp)
4+
set(VITASDK_PROFILES vita vita_softfp)
55

66
# The float ABI each profile bakes into the toolchain. A profile is a world and
77
# a world is named by the architecture its packages carry, so the name is the
88
# same on both sides of the build.
99
set(VITASDK_PROFILE_FLOAT_ABI_vita hard)
10-
set(VITASDK_PROFILE_FLOAT_ABI_vita-softfp softfp)
10+
set(VITASDK_PROFILE_FLOAT_ABI_vita_softfp softfp)
11+
12+
# makepkg builds shell variable names from CARCH (depends_$CARCH), so a world
13+
# whose name is not an identifier corrupts them and then aborts the build.
14+
foreach(profile IN LISTS VITASDK_PROFILES)
15+
if(NOT profile MATCHES "^[A-Za-z_][A-Za-z0-9_]*$")
16+
message(FATAL_ERROR
17+
"profile '${profile}' is not a valid shell identifier; makepkg "
18+
"expands depends_${profile} and friends")
19+
endif()
20+
endforeach()

scripts/validate-core-package.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ if [[ $pkgname == vitasdk-core ]]; then
6161
exit 1
6262
}
6363

64-
# The world (vita, vita-softfp, ...) is stamped in two independent places;
64+
# The world (vita, vita_softfp, ...) is stamped in two independent places;
6565
# a mismatch means the build tagged the release for one world while
6666
# actually configuring the toolchain, or makepkg, for another.
6767
world_from_version=$(bsdtar -xOf "$package" version_info.txt |

tests/ci/test-build-host-args.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ run_build_host \
140140
--host x86_64-linux-gnu --stage 1 \
141141
--artifacts-dir "$temporary_directory/artifacts-6" --out-dir "$temporary_directory/out-6" \
142142
--build-id sha256:test --version 0.1.1 --revision "$revision" \
143-
--profile vita-softfp --packaged false >/dev/null 2>&1 || true
143+
--profile vita_softfp --packaged false >/dev/null 2>&1 || true
144144

145-
grep -qx -- '-DVITASDK_PROFILE=vita-softfp' "$recorded" || {
145+
grep -qx -- '-DVITASDK_PROFILE=vita_softfp' "$recorded" || {
146146
printf 'stage 1 did not pass the profile to cmake:\n%s\n' "$(cat "$recorded")" >&2
147147
exit 1
148148
}

tests/protocol/test-describe-lock.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ second_run=$(describe --profile vita --revision "$base_rev")
3333
base_build_id=$(field build_id <<< "$first_run")
3434

3535
# Changing the profile changes build_id, same revision.
36-
softfp_build_id=$(describe --profile vita-softfp --revision "$base_rev" | field build_id)
36+
softfp_build_id=$(describe --profile vita_softfp --revision "$base_rev" | field build_id)
3737
[[ $base_build_id != "$softfp_build_id" ]] || {
3838
printf 'build_id did not change when the profile changed\n' >&2
3939
exit 1

0 commit comments

Comments
 (0)