forked from ALHP/ALHP.GO
changed LTO logic to match per-default enabled LTO in upstream Archlinux
This commit is contained in:
4
main.go
4
main.go
@@ -120,10 +120,10 @@ func (b *BuildManager) buildWorker(id int, march string) {
|
|||||||
pkg.PkgFiles = []string{}
|
pkg.PkgFiles = []string{}
|
||||||
|
|
||||||
// default to LTO
|
// default to LTO
|
||||||
makepkgFile := "makepkg-%s-lto.conf"
|
makepkgFile := makepkg
|
||||||
if pkg.DbPackage.Lto == dbpackage.LtoDisabled || pkg.DbPackage.Lto == dbpackage.LtoAutoDisabled {
|
if pkg.DbPackage.Lto == dbpackage.LtoDisabled || pkg.DbPackage.Lto == dbpackage.LtoAutoDisabled {
|
||||||
// use non-lto makepkg.conf if LTO is blacklisted for this package
|
// use non-lto makepkg.conf if LTO is blacklisted for this package
|
||||||
makepkgFile = "makepkg-%s.conf"
|
makepkgFile = makepkgLTO
|
||||||
}
|
}
|
||||||
cmd := exec.Command("sh", "-c",
|
cmd := exec.Command("sh", "-c",
|
||||||
"cd "+filepath.Dir(pkg.Pkgbuild)+"&&makechrootpkg -c -D "+filepath.Join(conf.Basedir.Work, makepkgDir)+" -l worker-"+march+"-"+strconv.Itoa(id)+" -r "+filepath.Join(conf.Basedir.Work, chrootDir)+" -- "+
|
"cd "+filepath.Dir(pkg.Pkgbuild)+"&&makechrootpkg -c -D "+filepath.Join(conf.Basedir.Work, makepkgDir)+" -l worker-"+march+"-"+strconv.Itoa(id)+" -r "+filepath.Join(conf.Basedir.Work, chrootDir)+" -- "+
|
||||||
|
22
utils.go
22
utils.go
@@ -38,6 +38,8 @@ const (
|
|||||||
chrootDir = "chroot"
|
chrootDir = "chroot"
|
||||||
makepkgDir = "makepkg"
|
makepkgDir = "makepkg"
|
||||||
waitingDir = "to_be_moved"
|
waitingDir = "to_be_moved"
|
||||||
|
makepkgLTO = "makepkg-%s-non-lto.conf"
|
||||||
|
makepkg = "makepkg-%s.conf"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -947,8 +949,8 @@ func syncMarchs() {
|
|||||||
|
|
||||||
//goland:noinspection SpellCheckingInspection
|
//goland:noinspection SpellCheckingInspection
|
||||||
func setupMakepkg(march string) error {
|
func setupMakepkg(march string) error {
|
||||||
lMakepkg := filepath.Join(conf.Basedir.Work, makepkgDir, fmt.Sprintf("makepkg-%s.conf", march))
|
lMakepkg := filepath.Join(conf.Basedir.Work, makepkgDir, fmt.Sprintf(makepkg, march))
|
||||||
lMakepkgLTO := filepath.Join(conf.Basedir.Work, makepkgDir, fmt.Sprintf("makepkg-%s-lto.conf", march))
|
lMakepkgLTO := filepath.Join(conf.Basedir.Work, makepkgDir, fmt.Sprintf(makepkgLTO, march))
|
||||||
|
|
||||||
err := os.MkdirAll(filepath.Join(conf.Basedir.Work, makepkgDir), 0755)
|
err := os.MkdirAll(filepath.Join(conf.Basedir.Work, makepkgDir), 0755)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -965,25 +967,25 @@ func setupMakepkg(march string) error {
|
|||||||
makepkgStr = strings.ReplaceAll(makepkgStr, " check ", " !check ")
|
makepkgStr = strings.ReplaceAll(makepkgStr, " check ", " !check ")
|
||||||
}
|
}
|
||||||
makepkgStr = strings.ReplaceAll(makepkgStr, " color ", " !color ")
|
makepkgStr = strings.ReplaceAll(makepkgStr, " color ", " !color ")
|
||||||
makepkgStr = strings.ReplaceAll(makepkgStr, "-O2", "-O3")
|
// Add align-functions=32, see https://github.com/InBetweenNames/gentooLTO/issues/164 for more
|
||||||
|
makepkgStr = strings.ReplaceAll(makepkgStr, "-O2", "-O3 -falign-functions=32")
|
||||||
makepkgStr = strings.ReplaceAll(makepkgStr, "#MAKEFLAGS=\"-j2\"", "MAKEFLAGS=\"-j"+strconv.Itoa(conf.Build.Makej)+"\"")
|
makepkgStr = strings.ReplaceAll(makepkgStr, "#MAKEFLAGS=\"-j2\"", "MAKEFLAGS=\"-j"+strconv.Itoa(conf.Build.Makej)+"\"")
|
||||||
makepkgStr = reMarch.ReplaceAllString(makepkgStr, "${1}"+march)
|
makepkgStr = reMarch.ReplaceAllString(makepkgStr, "${1}"+march)
|
||||||
makepkgStr = strings.ReplaceAll(makepkgStr, "#PACKAGER=\"John Doe <john@doe.com>\"", "PACKAGER=\"ALHP "+march+" <alhp@harting.dev>\"")
|
makepkgStr = strings.ReplaceAll(makepkgStr, "#PACKAGER=\"John Doe <john@doe.com>\"", "PACKAGER=\"ALHP "+march+" <alhp@harting.dev>\"")
|
||||||
|
|
||||||
// write non-lto makepkg
|
// write makepkg
|
||||||
err = os.WriteFile(lMakepkg, []byte(makepkgStr), 0644)
|
err = os.WriteFile(lMakepkg, []byte(makepkgStr), 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add LTO. Since (lto) not in devtools yet, add it instead.
|
// Remove LTO. Since lto is enabled pre default in devtools since 20211129-1, remove it.
|
||||||
// See https://git.harting.dev/anonfunc/ALHP.GO/issues/52 for more
|
// See https://git.harting.dev/anonfunc/ALHP.GO/issues/52 for more
|
||||||
makepkgStr = strings.ReplaceAll(makepkgStr, "!lto", "")
|
makepkgStr = strings.ReplaceAll(makepkgStr, "lto", "!lto")
|
||||||
makepkgStr = strings.ReplaceAll(makepkgStr, "!debug", "!debug lto")
|
// Remove align-functions=32, which is enabled because of LTO and not needed without
|
||||||
// Add align-functions=32, see https://github.com/InBetweenNames/gentooLTO/issues/164 for more
|
makepkgStr = strings.ReplaceAll(makepkgStr, "-falign-functions=32", "")
|
||||||
makepkgStr = strings.ReplaceAll(makepkgStr, "-O3", "-O3 -falign-functions=32")
|
|
||||||
|
|
||||||
// write lto makepkg
|
// write non-lto makepkg
|
||||||
err = os.WriteFile(lMakepkgLTO, []byte(makepkgStr), 0644)
|
err = os.WriteFile(lMakepkgLTO, []byte(makepkgStr), 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Reference in New Issue
Block a user