forked from ALHP/ALHP.GO
added LTO blacklist
This commit is contained in:
@@ -23,7 +23,6 @@ march:
|
||||
|
||||
blacklist:
|
||||
packages:
|
||||
- pacman
|
||||
- tensorflow
|
||||
- tensorflow-cuda
|
||||
- gcc
|
||||
@@ -32,6 +31,9 @@ blacklist:
|
||||
- i686
|
||||
- staging
|
||||
- unstable
|
||||
lto:
|
||||
- llvm
|
||||
- rust
|
||||
|
||||
build:
|
||||
worker: 4
|
||||
|
8
main.go
8
main.go
@@ -77,9 +77,15 @@ func (b *BuildManager) buildWorker(id int) {
|
||||
}
|
||||
pkg.PkgFiles = []string{}
|
||||
|
||||
// default to LTO
|
||||
makepkgFile := "makepkg-%s-lto.conf"
|
||||
if contains(conf.Blacklist.LTO, pkg.Pkgbase) {
|
||||
// use non-lto makepkg.conf if LTO is blacklisted for this package
|
||||
makepkgFile = "makepkg-%s.conf"
|
||||
}
|
||||
cmd := exec.Command("sh", "-c",
|
||||
"cd "+filepath.Dir(pkg.Pkgbuild)+"&&makechrootpkg -c -D "+conf.Basedir.Makepkg+" -l worker-"+strconv.Itoa(id)+" -r "+conf.Basedir.Chroot+" -- "+
|
||||
"--config "+filepath.Join(conf.Basedir.Makepkg, fmt.Sprintf("makepkg-%s.conf", pkg.March)))
|
||||
"--config "+filepath.Join(conf.Basedir.Makepkg, fmt.Sprintf(makepkgFile, pkg.March)))
|
||||
var out bytes.Buffer
|
||||
cmd.Stdout = &out
|
||||
cmd.Stderr = &out
|
||||
|
47
utils.go
47
utils.go
@@ -83,6 +83,7 @@ type Conf struct {
|
||||
Blacklist struct {
|
||||
Packages []string
|
||||
Repo []string
|
||||
LTO []string `yaml:"lto"`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -584,7 +585,10 @@ func syncMarchs() {
|
||||
}
|
||||
|
||||
for _, march := range conf.March {
|
||||
setupMakepkg(march)
|
||||
err := setupMakepkg(march)
|
||||
if err != nil {
|
||||
log.Errorf("Can't generate makepkg for %s: %v", march, err)
|
||||
}
|
||||
for _, repo := range conf.Repos {
|
||||
fRepo := fmt.Sprintf("%s-%s", repo, march)
|
||||
repos = append(repos, fRepo)
|
||||
@@ -612,28 +616,47 @@ func syncMarchs() {
|
||||
}
|
||||
|
||||
//goland:noinspection SpellCheckingInspection
|
||||
func setupMakepkg(march string) {
|
||||
func setupMakepkg(march string) error {
|
||||
lMakepkg := filepath.Join(conf.Basedir.Makepkg, fmt.Sprintf("makepkg-%s.conf", march))
|
||||
lMakepkgLTO := filepath.Join(conf.Basedir.Makepkg, fmt.Sprintf("makepkg-%s-lto.conf", march))
|
||||
|
||||
check(os.MkdirAll(conf.Basedir.Makepkg, 0755))
|
||||
err := os.MkdirAll(conf.Basedir.Makepkg, 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t, err := os.ReadFile(makepkgConf)
|
||||
check(err)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
makepkgStr := string(t)
|
||||
|
||||
makepkgStr = strings.ReplaceAll(makepkgStr, "-mtune=generic", "")
|
||||
makepkgStr = strings.ReplaceAll(makepkgStr, "!lto", "")
|
||||
// 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, " check ", " !check ")
|
||||
makepkgStr = strings.ReplaceAll(makepkgStr, " color ", " !color ")
|
||||
// Add LTO. Since it's (!lto) not in devtools yet, add it instead.
|
||||
// See https://git.harting.dev/anonfunc/ALHP.GO/issues/52 for more
|
||||
makepkgStr = strings.ReplaceAll(makepkgStr, "!debug", "!debug lto")
|
||||
|
||||
makepkgStr = strings.ReplaceAll(makepkgStr, "-O2", "-O3")
|
||||
makepkgStr = strings.ReplaceAll(makepkgStr, "#MAKEFLAGS=\"-j2\"", "MAKEFLAGS=\"-j"+strconv.Itoa(conf.Build.Makej)+"\"")
|
||||
makepkgStr = reMarch.ReplaceAllString(makepkgStr, "${1}"+march)
|
||||
|
||||
check(os.WriteFile(lMakepkg, []byte(makepkgStr), 0644))
|
||||
// write non-lto makepkg
|
||||
err = os.WriteFile(lMakepkg, []byte(makepkgStr), 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Add LTO. Since (lto) not in devtools yet, add it instead.
|
||||
// See https://git.harting.dev/anonfunc/ALHP.GO/issues/52 for more
|
||||
makepkgStr = strings.ReplaceAll(makepkgStr, "!lto", "")
|
||||
makepkgStr = strings.ReplaceAll(makepkgStr, "!debug", "!debug lto")
|
||||
// Add align-functions=32, see https://github.com/InBetweenNames/gentooLTO/issues/164 for more
|
||||
makepkgStr = strings.ReplaceAll(makepkgStr, "-O3", "-O3 -falign-functions=32")
|
||||
|
||||
// write lto makepkg
|
||||
err = os.WriteFile(lMakepkgLTO, []byte(makepkgStr), 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func isMirrorLatest(h *alpm.Handle, buildPkg *BuildPackage) (bool, alpm.IPackage, string, error) {
|
||||
|
Reference in New Issue
Block a user