You are not logged in.

#1 2011-03-09 09:20:05

icarus-c
Member
Registered: 2009-11-12
Posts: 17

Script to let makepkg build package in RAM storage

Compiling in ramdisk should boost performance, reducing compile time.
copy this script, save it to (e.g.) /usr/local/bin/makepkg-mem
from now on you just need to run  makepkg-mem instead of makepkg
makepkg-mem simply prepare the build environment on ramdisk and then call makepkg to do the job

Note: /dev/shm should be mounted on tmpfs
if you use zram (compressed ramdisk) you may change DIR=/dev/shm  to your zram storage as i find it a better option.

Issue:  Some packages may fail to build, you have to fallback to plain makepkg instead. It is known mesa would fail with makepkg-mem

-----------------------------------------------------------------------------
#!/bin/bash
#
# A wrapper script for makepkg to put $srcdir on ramdisk
# I call this script "makepkg-mem"
# Author: icarus-c

DIR=/dev/shm/makepkg
if  [ ! -d $DIR ]; then
        echo "#$DIR doesnt exist, make it.."
        mkdir $DIR
        chmod 1777 $DIR
fi

echo "#source PKGBUILD"
source $PWD/PKGBUILD || exit

echo "#mkdir $DIR/$pkgname/src"
mkdir -p $DIR/$pkgname/src || exit

echo "#ln -s $DIR/$pkgname/src $PWD/src"
ln -sf $DIR/$pkgname/src $PWD/src || exit

echo "#makepkg $@ now"
makepkg $@

echo "#cleaning up"
rm -rf $DIR/$pkgname $PWD/src $PWD/pkg

-------------------------------------------------------------------------------

Last edited by icarus-c (2011-03-09 09:21:46)

Offline

Board footer

Powered by FluxBB