add patching for rust flags #120

Merged
anonfunc merged 2 commits from RubenKelevra/ALHP.GO:feat/rust_flags into master 2022-06-15 11:38:15 +02:00

View File

@@ -731,6 +731,10 @@ func setupMakepkg(march string) error {
makepkgStr = strings.ReplaceAll(makepkgStr, "#MAKEFLAGS=\"-j2\"", "MAKEFLAGS=\"-j"+strconv.Itoa(conf.Build.Makej)+"\"")
makepkgStr = reMarch.ReplaceAllString(makepkgStr, "${1}"+march)
makepkgStr = strings.ReplaceAll(makepkgStr, "#PACKAGER=\"John Doe <john@doe.com>\"", "PACKAGER=\"ALHP "+march+" <alhp@harting.dev>\"")
// enable rust flags and patch them
makepkgStr = strings.ReplaceAll(makepkgStr, "#RUSTFLAGS=", "RUSTFLAGS=")
makepkgStr = strings.ReplaceAll(makepkgStr, "-C opt-level=2", "-C opt-level=3")
makepkgStr = strings.ReplaceAll(makepkgStr, "-C opt-level=3", "-C opt-level=3 -C target-cpu="+march+" -C lto=fat -C codegen-units=1 -C strip=symbols -C linker-plugin-lto")
RubenKelevra marked this conversation as resolved Outdated
Outdated
Review

-Z options are unstable rustc options that require the use of the nightly toolchain and given that -Ztune-cpu=generic isn't strictly required, I would recommand not using it or any other unstable options.

`-Z` options are unstable `rustc` options that require the use of the `nightly` toolchain and given that `-Ztune-cpu=generic` isn't strictly required, I would recommand not using it or any other unstable options.

Ah yeah, it's just a null flag in this instance anyway. I have removed it from my own configuration in the meantime. Will do the same here. Thanks for pointing this out!

Ah yeah, it's just a null flag in this instance anyway. I have removed it from my own configuration in the meantime. Will do the same here. Thanks for pointing this out!
// write makepkg
err = os.WriteFile(lMakepkg, []byte(makepkgStr), 0644)