You are not logged in.

#1 2008-03-30 15:45:01

wizzard
Member
From: PA, US
Registered: 2006-10-17
Posts: 33

Building Arch packages from source

On Wednesday, I decided to order myself a new laptop (HORRAY!). Unfortunately, UPS won't be delivering it until Monday sad Seeing as how I am the most impatient person ever, I need to keep myself busy until it arrives. And since gcc 4.3.0 added a -march=core2, I decided that I would recompile all the packages that I am currently using on my old computer using this. I adapted a script I found on the form to build the packages with makepkg and store all of the .pkg.tar.gz files in a directory for easy installation when my laptop comes in. I thought I would share this with you guys and see what you think.

Here are some of the responses I will get and my answers
POST1 - Why don't you just use gentoo
RESPONSE - gentoo is a mess; they are like 2 weeks past the date for their next release and haven't given any status update. Also, packages like gnome stay in unstable for like 5 months.

POST2 - You will only benefit like 1% in speed
RESPONSE - Even if I get a 1% speed increase, that is a 1% speed increase for free. Also, its not entirely about -march=core2, its also about rebuilding everything with gcc 4.3

Anyway, here's the script. I ran it overnight and it built 3/4 of the packages on my system before I ran out of hard drive room tongue thats why I added the rm -rf src

#!/bin/bash

# Make some directories
homedir=/home/rhollencamp/rebuild
mkdir -p $homedir
mkdir -p $homedir/binary
mkdir -p $homedir/packages

# Decide what we need to build
while [ $# -gt 0 ]
do
  case $1
  in
    # specify a list of packages to make
    -s)
      pkglist=`cat "$2"`
      shift 2
    ;;

    -p)
      pkglist=`pacman -Q | cut -d' ' -f1 | paste -s`
      shift 1
    ;;

    *)
      echo "The arguments to use are"
      echo "-s filename : build the packages listed in filename"
      echo "-p          : build all packages installed on system"
      echo "-a          : build all packages that get updated when abs is ran - will require you to input root password - TODO"
      shift 1
    ;;
  esac
done

echo "Locating selected packages in ABS trees"
# Locate each package in abs tree
for pkg in $pkglist; do 
    search=`find /var/abs/ -type d -name $pkg`
    # If we found a PKGBUILD, add it to the list to be build
    pkgbuild="$search/PKGBUILD"
    if [ -f "$pkgbuild" ] ; then
      makelist="$makelist $pkg"
    # Otherwise add it to the list that won't be rebuild
    else
      norebuildlist="$norebuildlist $pkg"
    fi
done
# Write list of packages not found in ABS tree
echo "$norebuildlist" > $homedir/notbuildinglist
# Write list of packages that were found and will be built
echo "$makelist" > $homedir/buildinglist

echo "Building packages"
# Build all of the packages
for pkg in $makelist; do 
    echo "Making: $pkg"
    
    # make a directory to build things in; you can't build right in the abs tree
    mkdir -p $homedir/packages/$pkg
    cp `find /var/abs/ -type d -name $pkg`/* $homedir/packages/$pkg
    cd $homedir/packages/$pkg
    # make the package, ignoring ARCH field because a lot of packages are missing it
    makepkg -A > /dev/null 2> /dev/null
    # delete the src directory to save space
    rm -rf src
    # put the package name in the results file
    echo "$pkg" >> $homedir/results
    # now copy the .pkg.tar.gz to the binary folder; if the file doesn't exist (was unable to build)
    # then put the error in the results file so you know what packages didn't build
    cp *.pkg.tar.gz $homedir/binary/ 2>> $homedir/results
done

Offline

#2 2008-03-30 16:02:56

ph0tios
Member
Registered: 2008-02-23
Posts: 126

Re: Building Arch packages from source

I'm pretty new to CFLAGS...what exactly is core2 for...all duo core processors, or specific ones?

Last edited by ph0tios (2008-03-30 16:03:33)

Offline

#3 2008-03-30 16:06:51

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,167
Website

Re: Building Arch packages from source

Have you had a look at makeworld --help ?
Makeworld seems to be a very similar script that you may be interested in.

Offline

#4 2008-03-30 18:03:13

wizzard
Member
From: PA, US
Registered: 2006-10-17
Posts: 33

Re: Building Arch packages from source

I found this wiki article http://wiki.archlinux.org/index.php/Install_Arch_i586 which seems to be exactly what I'm doing. What exactly is the purpose of the variable CARCH? can I make a CARCH="core2" and then the packages come out foo-bar-1-1.0-core2.pkg.tar.gz?

Offline

#5 2008-03-30 19:44:19

neotuli
Lazy Developer
From: San Francisco, CA
Registered: 2004-07-06
Posts: 1,201
Website

Re: Building Arch packages from source

kumico wrote:

grr
CARCH enables specific optimizations for your processor architecure (core2, athlon64, ...)
no it wouldn't work like that
core2 is a part of i686 or x_86_64

CARCH does no such thing. It simply sets the architecture to whatever arbitrary name you choose, as wizzard noted. To enable specific optimizations and such you need to modify CFLAGS and CXXFLAGS.
For more details, check out man makepkg.conf .


The suggestion box only accepts patches.

Offline

#6 2008-03-30 19:56:01

kumico
Member
Registered: 2007-09-28
Posts: 224
Website

Re: Building Arch packages from source

oops, sorry my bad i was thinking of -march

Offline

#7 2008-03-31 00:54:00

wizzard
Member
From: PA, US
Registered: 2006-10-17
Posts: 33

Re: Building Arch packages from source

the majority of packages are definitely not ready for gcc 4.3 tongue more than 1/4 of the packages failed to build with compile errors, so I'll just save it for the future when the packages get updated

Offline

Board footer

Powered by FluxBB