You are not logged in.

#1 2009-10-02 15:21:32

huntxu
Member
Registered: 2008-12-07
Posts: 12

two patches for makepkg

1. let makepkg work with icc
this patch is inspired by the gentoo wiki page http://en.gentoo-wiki.com/wiki/ICC

A patch making makepkg work with icc by huntxu (mhuntxu[AT]gmail[dot]com)
--- makepkg.orig    2009-10-02 22:40:42.711085370 +0800
+++ makepkg    2009-10-02 22:41:29.349081726 +0800
@@ -703,8 +703,37 @@
         MAKEFLAGS=""
     fi
 
+    # I don't think ccache can be used with icc
+    local useicc=0
+    if [ "$(check_buildenv icc)" = "y" -a "$(check_option icc)" != "n" ]; then
+      if [ -r /etc/package.icc ]; then
+            while read -a target; do
+                if [ "${target}" = "${pkgname}" ]; then
+                    useicc=1
+                    CC="icc"
+                    CXX="icpc"
+                    AR="xiar"
+                    LD="xild"
+                    CFLAGS=${ICCCFLAGS}
+                    CXXFLAGS=${ICCCXXFLAGS}
+                    export CC CXX AR LD
+                    if [ -r /etc/package.icc-cflags ]; then
+                        while read target flags; do
+                            if [ "${target}" = "${pkgname}" ]; then
+                                CFLAGS="$CFLAGS $flags"
+                                CXXFLAGS="$CXXFLAGS $flags"
+                                break;
+                            fi
+                        done < /etc/package.icc-cflags
+                    fi
+                    break
+                fi
+            done < /etc/package.icc
+        fi
+    fi
+
     # use ccache if it is requested (check buildenv and PKGBUILD opts)
-    if [ "$(check_buildenv ccache)" = "y" -a "$(check_option ccache)" != "n" ]; then
+    if [ "${useicc}" = "0" -a "$(check_buildenv ccache)" = "y" -a "$(check_option ccache)" != "n" ]; then
         [ -d /usr/lib/ccache/bin ] && export PATH="/usr/lib/ccache/bin:$PATH"
     fi

First of all, you should install icc of course, see http://aur.archlinux.org/packages.php?ID=2252
Add your icc CFLAGS/CXXFLAGS($ICCCFLAGS & $ICCCXXFLAGS) to /etc/makepkg.conf.
Add "icc" to the BUILDENV array in /etc/makepkg.conf
Add packages' names (one per line) you want to compiled with icc to /etc/package.icc, if a package is not listed in this file, it will be compiled with gcc.
Add per-package CFLAGS for packages(package's name followed by CFLAGS per line) you want to compiled with icc to /etc/package.icc-cflags. A few packages benefit greatly from the -O3 flag like python and sqlite according to the gentoo wiki.

2. let makepkg install custom license automatically
When making packages whose licenses are "custom", we use PKGBUILD to install the license file manually. Since it is a common step for those packages, why not let makepkg do that automatically?

A patch making makepkg install custom license automatically by huntxu (mhuntxu[AT]gmail[dot]com)
--- makepkg.orig    2009-10-02 22:40:42.711085370 +0800
+++ makepkg    2009-10-02 22:43:47.333083311 +0800
@@ -984,6 +984,12 @@
 
     write_pkginfo $nameofpkg
 
+    # check for a custom license
+    if [ ! -z $licensefile ]; then
+        msg2 "Installing custom license..."
+        install -Dm644 ${startdir}/${licensefile} ${pkgdir}/usr/share/licenses/$pkgname/${licensefile}
+    fi
+
     local comp_files=".PKGINFO"
 
     # check for an install script
@@ -1180,6 +1186,11 @@
         return 1
     fi
 
+    if [ "$licensefile" -a ! -f "$licensefile" ]; then
+        error "$(gettext "Custom License (%s) does not exist.")" "$licensefile"
+        return 1
+    fi
+
     local valid_options=1
     local opt known kopt
     for opt in ${options[@]}; do

Just specify $licensefile in your PKGBUILD(like $licensefile=LICENSE) and ensure the license file is in $startdir, it then will be automatically install to $pkgdir/usr/share/licenses/$pkgname/$licensefile when packaging.

Last edited by huntxu (2009-10-02 15:27:29)

Offline

#2 2009-10-02 15:26:09

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,672
Website

Re: two patches for makepkg

All development for pacman/makepkg happens on the pacman-dev mailing list (http://mailman.archlinux.org/mailman/li … pacman-dev)

Offline

#3 2009-10-03 04:01:37

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,362

Re: two patches for makepkg

Out of curiosity, does this result in any increased performance?


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

Board footer

Powered by FluxBB