Arch Build System

Arch Build System (ABS) is Arch’s way of streamlining your workflow when you need to build a custom open source package.  It is well-documented on Arch Wiki here –

Here’s a tl;dr example-oriented summary to help new Arch Users get right down to it.  This example demonstrates how to build your vim editor with python-support enabled.

# Install and run abs (sync)
sudo pacman -S abs
sudo abs
# Prepare a build area
mkdir ~/abs
cd ~/abs
# Make a local copy
cp -r /var/abs/extra/vim .
cd vim
# Change the "--disable-python" options to "--enable-python"
# Build the package
# Wait for a while
# Install your new vim and runtime (these are created via the makepkg command above)
sudo pacman -U vim-runtime-7.4.335-4-x86_64.pkg.tar.xz
sudo pacman -U vim-7.4.335-4-x86_64.pkg.tar.xz
# Check it for "+python"
vim --version

Finally, if we are going to make sure that future updates to the vim package with pacman does not override our custom vim.  To do so, simply declare

# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
IgnorePkg   = vim
#IgnoreGroup =

And that’s pretty much it.

The important thing to remember is that your custom build depends on the PKGBUILD file.  The `abs` command rsyncs the PKBUILD file from arch repositories to your server whenever you need an updated PKGBUILD and this default PKGBUILD can then be copied over to your build directory and modified so you can decide which features you want to include in your customized package.

There are many community contributed custom packages in AUR ( or on so we can use those too, if a PKGBUILD that enables python support is already maintained by another contributor.

Bottomline?  Everything that controls how a package is built is declared in PKGBUILD so getting familiar with PKGBUILD will let you manage any custom package build you want.

matplotlib dependencies; debian

Attempting to install matplotlib on a debian instance via `pip install matplotlib` gave me this error:-

numpy/__multiarray_api.h:1532: warning: ‘int _import_array()’ defined but not used

Apparently, it requires `libfreetype6-dev` and `libpng-dev` installed at distro-level so that it can generate free type and png images when plotting charts and diagrams.


sudo aptitude install libfreetype6-dev libpng-dev

solves our problem.

Moving on.

pfind, pgrep and pkill on Mac OSX

Having taken these commands for granted on stock linux, it’s always a little waste-of-time to be listing out processes bound to specific ports that I want to kill; and then killing that process by its PID.

For instance,

calvin$ lsof -i -P | grep -i "listen"
VLCStream 309 calvin 6u IPv4 0xffffff80127fc4e0 0t0 TCP *:54340 (LISTEN)
VLCStream 309 calvin 9u IPv6 0xffffff80127f9700 0t0 TCP *:54340 (LISTEN)
Dropbox 310 calvin 19u IPv4 0xffffff8016c31880 0t0 TCP *:17500 (LISTEN)
Dropbox 310 calvin 25u IPv4 0xffffff8016e23c20 0t0 TCP localhost:26164 (LISTEN)
iTunes 2447 calvin 27u IPv4 0xffffff8026554c20 0t0 TCP *:3689 (LISTEN)
iTunes 2447 calvin 28u IPv6 0xffffff80127f9ac0 0t0 TCP *:3689 (LISTEN)
GoogleTal 5650 calvin 25u IPv4 0xffffff801724d500 0t0 TCP localhost:63495 (LISTEN)
GoogleTal 5650 calvin 29u IPv4 0xffffff8020123de0 0t0 TCP localhost:63496 (LISTEN)
Skype 6659 calvin 49u IPv4 0xffffff80182744e0 0t0 TCP *:29945 (LISTEN)
python 6841 calvin 5u IPv4 0xffffff801724b160 0t0 TCP localhost:8000 (LISTEN)
python 6843 calvin 5u IPv4 0xffffff801724b160 0t0 TCP localhost:8000 (LISTEN)

tells me that I have these processes listening to specific ports as above.

Killing specific processes that I want gone will then be `kill -9 6841 6843` for example.

Mac OSX does not come with pfind, pgrep and pkill by default.  To add in these programs that we take for granted on stock linux, we install

calvin$ sudo port -v install proctools

x ./opt/local/bin/pfind
x ./opt/local/bin/pgrep
x ./opt/local/bin/pkill
---> Cleaning proctools
---> Removing work directory for proctools
---> Updating database of binaries: 100.0%
---> Scanning binaries for linking errors: 100.0%
---> No broken files found.

and we will now have all our time-saving commands pfind, pgrep and pkill; and this

calvin$ pkill -9 python

will now kill off my python processes by name, particularly when I am working on my python projects and I need to terminate the process and I accidentally hit Ctrl+Z instead of Ctrl+C.

Ctrl+Z does not actually terminate my running python development server as that is “undo”.  Ctrl+C is the keyboard shortcut that terminates the python process properly and frees up the port.