Skip to content

Commit

Permalink
Mingen build fixes.
Browse files Browse the repository at this point in the history
This change contains fixes found while getting Santa to compile the
toolchain natively on Minoca. Most of it has to do with passing literal
dollar signs through to the final build command. Also set default CPFLAGS
so that binplaced executables remain executable.
  • Loading branch information
evangreen committed Sep 19, 2017
1 parent d805457 commit 4e02633
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 11 deletions.
9 changes: 7 additions & 2 deletions apps/ck/app/build.ck
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,13 @@ function build() {
"apps/ck/modules/bundle:build_bundle"
];

//
// The final RPATH should be $ORIGIN/../lib, with a literal dollar sign
// being passed to the linker.
//

config = {
"LDFLAGS": ["-Wl,-rpath=\\$ORIGIN/../lib"]
"LDFLAGS": ["-Wl,-rpath='$$ORIGIN/../lib'"]
};

app = {
Expand All @@ -80,7 +85,7 @@ function build() {

entries = application(app);
if ((mconfig.build_os != "Windows") && (mconfig.build_os != "Darwin")) {
buildConfig["LDFLAGS"] = ["-Wl,-rpath=\\$ORIGIN/../lib"];
buildConfig["LDFLAGS"] = ["-Wl,-rpath='$$ORIGIN/../lib'"];
}

if (mconfig.build_os == "Darwin") {
Expand Down
4 changes: 3 additions & 1 deletion apps/debug/client/build.ck
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ function build() {
buildGuiConfig["LDFLAGS"] = ["-mwindows"];

} else if (buildOs == "Minoca") {
buildSources = commonSources + minocaSources + targetLibs;
buildSources = commonSources + buildArchSources + minocaSources +
targetLibs;

buildConfig["DYNLIBS"] = ["-lminocaos"];

} else {
Expand Down
6 changes: 6 additions & 0 deletions apps/mingen/make.ck
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,12 @@ Return Value:
var result;

try {

//
// Pre-escape all literal dollar signs.
//

value = value.replace("$$", "$$$$", -1);
result = value.template(MakeVariableTransformer(), false);

} except ValueError {
Expand Down
6 changes: 6 additions & 0 deletions apps/mingen/ninja.ck
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,12 @@ Return Value:
var result;

try {

//
// Pre-escape all literal dollar signs.
//

value = value.replace("$$", "$$$$", -1);
result = value.template(NinjaVariableTransformer(), false);

} except ValueError {
Expand Down
4 changes: 2 additions & 2 deletions images/build.ck
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ function build() {

installFlags = commonImageFlags + [
"-linstall-" + arch,
"-i$" + mconfig.outroot,
"-i" + mconfig.outroot,
imageSize,
];

commonImageFlags += [
"-i$" + mconfig.binroot + "/install.img"
"-i" + mconfig.binroot + "/install.img"
];

entries = buildImage("install.img", installFlags);
Expand Down
3 changes: 2 additions & 1 deletion menv.ck
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,8 @@ Return Value:
"BUILD_BASE_LDFLAGS": mconfig.build_ldflags,
"BUILD_BASE_ASFLAGS": mconfig.build_asflags,
"STRIP_FLAGS": mconfig.stripflags,
"IASL_FLAGS": ["-we"]
"IASL_FLAGS": ["-we"],
"CPFLAGS": "-p",
};

if (config.verbose) {
Expand Down
12 changes: 7 additions & 5 deletions tasks/build/print_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ if [ -z "$serial" ]; then
##

os_init_rev=1598fc5f1734f7d7ee01e014ee64e131601b78a7
serial=`git rev-list --count HEAD`
if [ x`git rev-list --max-parents=0 HEAD` = x$os_init_rev ]; then
serial=`git rev-list --count HEAD 2>/dev/null`
if [ x`git rev-list --max-parents=0 HEAD 2>/dev/null` = \
x$os_init_rev ]; then

serial=$(($serial + 1000))
else
serial=$(($serial + 1))
Expand All @@ -85,13 +87,13 @@ if [ -z "$build_string" ]; then
branch=`cat $SRCROOT/os/branch`

else
branch=`git rev-parse --abbrev-ref HEAD`
branch=`git rev-parse --abbrev-ref HEAD 2>/dev/null`
fi

if [ -r "$SRCROOT/os/commit" ]; then
commit=`cat $SRCROOT/os/commit`
else
commit=`git rev-parse HEAD`
commit=`git rev-parse HEAD 2>/dev/null`
fi

commit_abbrev=`echo $commit | cut -c1-7`
Expand All @@ -102,7 +104,7 @@ if [ -z "$build_string" ]; then
[ "$user" = root ] && user=
[ $VARIANT ] && build_string="${VARIANT}-"
[ $user ] && build_string="${build_string}${user}-"
[ $branch != "master" ] && build_string="${build_string}${branch}-"
[ "$branch" != "master" ] && build_string="${build_string}${branch}-"
build_string="${build_string}${commit_abbrev}"
build_string="$build_string $build_time_string"
fi
Expand Down

0 comments on commit 4e02633

Please sign in to comment.