Category Archives: Crux ports

A Crux port (and patch) for Charm

For about six months now I’ve been using Charm almost exclusively to write and maintain this blog, and most of that time in Crux. I never put together a proper Crux port for it, though. Part of the reason was that version 1.9.1 required a quick patching to work properly with WordPress; I generally just hand-edited it and installed it manually.

But I might as well dive in and do it correctly. So here is a patch for Charm that basically mimics the suggestions made by reacocard almost seven months ago, about shifting the modules slightly to avoid the errors that appear when using this with WordPress.com.

--- ljcharm.py	2009-01-12 06:21:15.000000000 +0900
+++ ljcharm.py.edit	2009-08-14 20:38:48.000000000 +0900
@@ -41,13 +41,12 @@
 import md5
 import urllib
 import calendar
-
+import httplib
+import base64
+import datetime
+import sha
 try:
     import feedparser
-    import httplib
-    import base64
-    import datetime
-    import sha
     atom_ok = 1
 except:
     atom_ok = 0

I don’t patch things very often, so if I’m doing it wrong, please don’t laugh. Points on protocol or suggestions on how to do things properly are, of course, welcomed. I usually save that as charm-1.9.1.ljcharm.py.diff, not having any more experience than to follow some random naming conventions I found somewhere on ibiblio.org. After that I just plop it in /usr/ports/local/charm/.

And here’s the Crux port, in case you are among the minority who use it, and among the even slimmer minority who want to install Charm. :mrgreen:

# Description:	Charm is a full-featured, cross-platfom blogging client for LiveJournal, Atom (Movable Type, Blogger), and MetaWeb (WordPress).
# URL:		http://ljcharm.sourceforge.net/
# Maintainer:	K.Mandla, k dot mandla at gmail dot com
# Depends on:	python

name=charm
version=1.9.1
release=1
source=(http://downloads.sourceforge.net/project/ljcharm/$name/$name-$version/$name-$version.tar.gz

http://omploader.org/vMjVrMQ/charm-1.9.1.ljcharm.py.diff)

build() {
	cd $name-$version
	patch ljcharm.py < ../charm-1.9.1.ljcharm.py.diff
	python setup.py install --home=$PKG/usr

}

Ordinarily I would just swipe the corresponding PKGBUILD for Charm out of AUR and use Colin Zheng‘s converter to make a Pkgfile, but this time I had the patch to contend with anyway. So this is original work, in a strange sense. ;)

P.S.: I submitted the patch, but it’s a little embarrassing. :|

Crux ports for terminal games

I have been a little preoccupied with real-life commitments over the past few days, but I managed to whip up four or five Pkgfiles for the games I mentioned in the last post. The beauty of these ports is that they’re paper-thin — they rely on almost nothing, and take almost no time to install.

With the exception of Bastet, of course. Since it relies on boost, there’s the possibility that you’ll be compiling for hours, with a 20-second burst at the end, when the actual game compiles. Don’t say I didn’t warn you. :roll:

All of these, with the exception of Moon-Buggy, were converted from Arch PKGBUILDs. Use at your own risk, of course. ;)

MyMan.

# Description: A Pacman clone with an ncurses and a 'graphic' interface
# URL: http://myman.sourceforge.net/
# Maintainer: 
# Depends on: ncurses gcc sed make coreutils

name=myman
version=0.7.0
release=1
source=(http://xent.com/~bsittler/$name-$version.tar.gz)
build () 
{ 
    cd $SRC/$name-$version
    ./configure prefix=${PKG}/usr
    make 
    make install 
    mkdir -p $PKG/usr/share/licenses/$name 
    cp ./LICENSE $PKG/usr/share/licenses/$name/COPYING
    rm $PKG/usr/bin/$name-$version
}

Bastet.

# Description: Bastet a simple ncurses-based Tetris(R) clone for Linux.
# URL: http://fph.altervista.org/prog/bastet.html
# Maintainer: 
# Depends on: boost ncurses 

name=bastet
version=0.43
release=1
source=(http://fph.altervista.org/prog/files/$name-$version.tgz)
build () 
{ 
    cd $name-$version
    make 
    install -D bastet $PKG/usr/bin/bastet
    install -D -m 644 bastet.6 $PKG/usr/share/man/man6/bastet.6
}

Greed.

# Description: The strategy game of Greed.
# URL: http://www.catb.org/~esr/greed/
# Maintainer: 
# Depends on: ncurses 

name=greed
version=3.4
release=3
source=(http://www.catb.org/~esr/$name/$name-$version.tar.gz)
build () 
{ 
    cd $name-$version
    make 
    touch greed.hs
    install -m755 -D greed $PKG/usr/bin/greed
    install -m766 -D greed.hs $PKG/usr/games/lib/greed.hs
}

nInvaders.

# Description: Ncurses based space invaders clone
# URL: http://ninvaders.sourceforge.net/
# Maintainer: your name <email>
# Depends on: ncurses 

name=ninvaders
version=0.1.1
release=2
source=(http://downloads.sourceforge.net/sourceforge/$name/$name-$version.tar.gz)
build () 
{ 
    cd $name-$version
    make 
    install -m755 -D nInvaders $PKG/usr/bin/$name
}

Moon-Buggy.

# Description: Moon-buggy is a game where you drive across the moon's surface. 
# URL: http://seehuhn.de/pages/moon-buggy
# Maintainer:
# Packager:
# Depends on: ncurses

name=moon-buggy
version=1.0.51
release=1
source=(http://seehuhn.de/media/programs/$name-$version.tar.gz)

build() {
	cd $name-$version
	./configure --prefix=/usr
	make
	install -D moon-buggy $PKG/usr/bin/moon-buggy
	install -D -m644 moon-buggy.6 $PKG/usr/share/man/man6/moon-buggy.6
}

And a bonus: viTetris, because it was mentioned.

# Description: vitetris is a terminal-based Tetris clone by Victor Nilsson.
# URL: http://victornils.net/tetris/
# Maintainer:
# Packager:
# Depends on: ncurses

name=vitetris
version=0.55
release=1
source=(http://victornils.net/tetris/$name-$version.tar.gz)

build() {
	cd $name-$version
	./configure --prefix=/usr
	make
	install -oroot -groot -d $PKG/usr/bin $PKG/usr/share/doc/vitetris
	install -oroot -groot -m755 tetris $PKG/usr/bin
	install -oroot -groot -m644 README licence.txt $PKG/usr/share/doc/vitetris
}

Don’t forget, since this seems to be heavy on the Tetris clones, that there’s a port for Netris in opt. Enjoy.

rtorrent, libtorrent and gcc 4.3.2

I ran into a small glitch last night while trying to compile rtorrent 0.8.2 and libtorrent 0.12.2 with gcc 4.3.2. Both halted in compiling, with errors like “‘abs’ is not a member of ‘std’” and “‘gmtime’ is not a member of ‘std’”.

I found a page that shows how to circumvent similar errors in Ubuntu, and the patches it linked work for Crux too. Here’s the page, here’s the rtorrent patch and here’s the libtorrent patch. Click the download link at the bottom of both of those patch reports to download the text files.

Adding a patch line to the ports worked fine both times.

# Description: Very efficient C++ torrent library
# URL:         http://libtorrent.rakshasa.no/
# Maintainer:  
# Packager:    
# Depends on:  libsigc++

name=libtorrent
version=0.12.2
release=1
source=("http://libtorrent.rakshasa.no/downloads/libtorrent-$version.tar.gz" \
"libtorrent-gcc43-v2.patch")

build()
{
   cd $name-$version
   patch -p1 -i $SRC/libtorrent-gcc43-v2.patch
   ./configure \
   --prefix=/usr \
   --disable-nls \
   --disable-debug
   make
   make install DESTDIR=$PKG
}
# Description: curses frontend for libtorrent
# URL:         http://libtorrent.rakshasa.no/
# Maintainer:  
# Packager:    
# Depends on:  libtorrent curl

name=rtorrent
version=0.8.2
release=1
source=("http://libtorrent.rakshasa.no/downloads/rtorrent-$version.tar.gz" \
"rtorrent-gcc43.patch")

build()
{
	cd $name-$version
	patch -p1 -i $SRC/rtorrent-gcc43.patch
	./configure \
	--prefix=/usr \
	--disable-nls \
	--disable-debug
	make
	make install DESTDIR=$PKG
	install -d $PKG/usr/share/$name/
	install doc/rtorrent.rc $PKG/usr/share/$name/
}

It looks like this time Ubuntu saves Crux. ;)

A Crux port for Zim

I use Zim a lot, as you might have noticed in my screenshots. It’s great for everything, and I strongly recommend it if you have any kind of hierarchical documentation that changes regularly or needs to be kept up to date. I use it to keep notes as I tinker with things; I can add and adjust pages to remind myself of commands I used or steps I took when I tried something.

I’ve been reluctant to put together a Crux port for Zim because there were a few dependencies that trickled down into Perl land, and all I know about Perl is how to spell it. Beyond that, I’m completely lost.

So in short: Fear of messing something up kept me from doing this before now. But I breathed deeply, put on the first season of Kung Fu, stuffed up my courage and waded into the mess. And I think this time I’ve got a winner.

Zim needs librsvg, which you can get out of the Xfce repos without drawing any other packages. It also needs shared-mime-info, which is in opt and may already be installed on your system. After that you need Perl’s File-BaseDir, File-DesktopEntry and File-MimeInfo.

# Description: Use the Freedesktop.org base directory specification
# URL: http://search.cpan.org/dist/File-BaseDir/
# Maintainer: 
# Depends on: perl

name=p5-file-basedir
_realname=File-BaseDir
version=0.03
release=1
source=(http://search.cpan.org/CPAN/authors/id/P/PA/PARDUS/$_realname-$version.tar.gz)
build () 
{ 
    cd ${_realname}-${version};
    perl Makefile.PL 
    make OPTIMIZE="$CFLAGS"
    make install DESTDIR=$PKG
	# Remove perlcrap
	find $PKG \
		\( -name '.packlist' -or \
		-name '*.bs' -or \
		-name 'autosplit.ix' -or \
		-name 'perllocal.pod' \) -delete

	# Remove empty directories
	find $PKG -depth -empty -exec rm -rf {} \;
}
# Description: Object to handle .desktop files
# URL: http://search.cpan.org/dist/File-DesktopEntry/
# Maintainer: 
# Depends on: perl

name=p5-file-desktopentry
_realname=File-DesktopEntry
version=0.04
release=1
source=(http://search.cpan.org/CPAN/authors/id/P/PA/PARDUS/File-DesktopEntry/$_realname-$version.tar.gz)
build () 
{ 
    cd ${_realname}-$version;
    PERL_MM_USE_DEFAULT=1 perl Makefile.PL 
    make OPTIMIZE="$CFLAGS"
    make DESTDIR=$PKG install
	# Remove perlcrap
	find $PKG \
		\( -name '.packlist' -or \
		-name '*.bs' -or \
		-name 'autosplit.ix' -or \
		-name 'perllocal.pod' \) -delete

	# Remove empty directories
	find $PKG -depth -empty -exec rm -rf {} \;
}
# Description: Perl/CPAN File::MimeInfo module - Determine file type
# URL: http://search.cpan.org/dist/File-MimeInfo/
# Maintainer: 
# Depends on: p5-file-basedir p5-file-desktopentry shared-mime-info perl

name=p5-file-mimeinfo
_realname=File-MimeInfo
version=0.14
release=1
source=(http://search.cpan.org/CPAN/authors/id/P/PA/PARDUS/File-MimeInfo/File-MimeInfo-$version.tar.gz)
build () 
{ 
    cd ${_realname}-${version};
    perl Makefile.PL 
    make OPTIMIZE="$CFLAGS"
    make DESTDIR=$PKG install

	# Remove perlcrap
	find $PKG \
		\( -name '.packlist' -or \
		-name '*.bs' -or \
		-name 'autosplit.ix' -or \
		-name 'perllocal.pod' \) -delete

	# Remove empty directories
	find $PKG -depth -empty -exec rm -rf {} \;
}

If those all look remarkably alike, that’s because I followed the example of a Perl port that was in contrib. It seemed like the best idea.

Now Zim proper.

# Description: A WYSIWYG text editor that aims at bringing the concept of a wiki to the desktop
# URL: http://zim-wiki.org/
# Maintainer: 
# Depends on: p5-gtk2 librsvg p5-file-mimeinfo 

name=zim
_realname=Zim
version=0.27
release=1
source=(http://www.zim-wiki.org/downloads/$_realname-$version.tar.gz)
build () 
{ 
    cd ${_realname}-${version};
    perl Build.PL destdir=$PKG
    perl Build
    perl Build install
}

That should do it. I know Zim is a bit esoteric, and installing a package in Crux takes a bit of work and time, so you might want to try it in another distro before going through all that. For me, it’s well worth it.

The irony of this is, I had been keeping Arch on one machine almost exclusively because I use Zim on that, and it was just easier to install it in Arch than it was to build all the interlacing ports. And it turns out it wasn’t that bad after all.

“Because a man can see, he does not look.”

P.S.: Thanks again, Colin.

A Crux port for Dwarf Fortress

Silly me, I waxed poetic about Dwarf Fortress the other day, but never posted the Crux port I used to install it on my system.

Be aware that this doesn’t mention the dependency on GL libraries — libgl in the original Arch PKGBUILD — that you should add depending on your hardware. I use the proprietary hardware driver from Nvidia, which is why this doesn’t include it.

# Description: Dwarf Fortress is a single-player fantasy game.  You can control a dwarven outpost or an adventurer in a randomly generated, persistent world.
# URL: http://www.bay12games.com/dwarves/
# Maintainer:  
# Depends on: gtk libsdl sdl_image 

name=dwarffortress
version=v0.28.181.40d5
release=3
source=(http://www.bay12games.com/dwarves/df_28_181_40d5_linux.tar.bz2)
build () 
{ 
    cd df_linux;
    install -d $PKG/usr/bin/;
    cp -r $SRC/df_linux/ $PKG/usr/bin/;
    echo "#!/bin/sh" > $PKG/usr/bin/dwarffortress.sh;
    echo "cd /usr/bin/df_linux" >> $PKG/usr/bin/dwarffortress.sh;
    echo "./df" >> $PKG/usr/bin/dwarffortress.sh;
    chmod -R 777 $PKG/usr/bin/df_linux;
    chmod 777 $PKG/usr/bin/dwarffortress.sh;
    install -D $SRC/df_linux/readme.txt $PKG/usr/share/licenses/dwarffortress/readme.txt
}

Thanks once again to the Arch community for putting together a working PKGBUILD, and to Colin Zheng, for making the transition between Arch-ese and Crux-ese much, much easier.

Fonts as sharp as razors: Crux ports for -LCD patches

Edit: Unfortunately, the images originally included in this post are gone, because of hosting problems in late 2009. My apologies.

One of the things I always find amazing when I install Arch Linux is the patches for cairo, fontconfig and libxft that are specific to LCDs. Install those packages on a laptop, adjust the X settings to your hardware and it’s like you installed a new screen. Simply beautiful stuff.

Looking to mimic the same razor-sharp edges on my Crux system, I came up with three ports and hijacked two others, all of which I’ll duplicate here, just for future reference. I don’t maintain a Crux repository, so if you’re interested, you’ll have to copy-and-paste, manually update and then compile. But you might end up doing that anyway, so it probably won’t bother you.

Another over-exuberant thank-you to Colin Zheng, whose PKGBUILD2Pkgfile script was, once again, simply invaluable in this process. Two seconds and a brief edit, and these Pkgfiles were done.

Cairo-LCD.

# Description: Cairo vector graphics library (with custom LCD filter).
# URL: http://cairographics.org/
# Maintainer: 
# Depends on: libpng xorg-libxrender fontconfig xorg-libpixman xorg-libxcb pkg-config

name=cairo-lcd
version=1.8.0
release=1
source=(http://cairographics.org/releases/cairo-$version.tar.gz lcd-filter.patch)
build () 
{ 
    cd cairo-$version;
    patch -p1 < ../lcd-filter.patch || return 1;
    ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-xcb --disable-static || return 1;
    make || return 1;
    make DESTDIR=$PKG install || return 1
}

LibXft-LCD. I have my CHOST variable set to i686-pc-gnu-linux or whatever, but I don’t think it’s truly necessary for this. Let me know if I’m wrong and I’ll trim those parts out.

# Description: FreeType-based font drawing library for X (with custom LCD filter)
# URL: http://xorg.freedesktop.org/
# Maintainer: 
# Depends on: fontconfig xorg-libxrender pkg-config

name=libxft-lcd
version=2.1.11
release=1
source=(http://xorg.freedesktop.org//releases/individual/lib/libXft-$version.tar.bz2 libxft_export.diff xorg-lib-libXft-lcd-filter.patch)
build () 
{ 
    cd libXft-${version};
    patch -Np0 -i ../libxft_export.diff || return 1;
    patch -Np1 -i ../xorg-lib-libXft-lcd-filter.patch || return 1;
    ./configure --prefix=/usr --sysconfdir=/etc --build=${CHOST} --host=${CHOST};
    make || return 1;
    make DESTDIR=$PKG install || return 1
}

FontConfig-LCD.

# Description: A library for configuring and customizing font access (custom LCD filter).
# URL: http://www.fontconfig.org/release/
# Maintainer: 
# Depends on: fontconfig

name=fontconfig-lcd
version=2.6.0
release=1
source=(10-lcd-filter.conf)
build () 
{ 
    install -D -m644 10-lcd-filter.conf $PKG/etc/fonts/conf.avail/10-lcd-filter.conf || return 1
}

Note that Cairo-LCD depends on xcb-util, which in turn is dependent on gperf. Both of those I found in the mxq repository, and I’ll copy here, just in case that’s not available.

xcb-util.

# Description: number of libraries which sit on top of libxcb
# URL: http://xcb.freedesktop.org/
# Maintainer: Bartlomiej Palmowski, maks1k at wp dot pl
# Depends on: xorg-libxcb gperf

name=xcb-util
version=0.3.0
release=1
source=(http://${name/-util}.freedesktop.org/dist/$name-$version.tar.bz2)

build() {
    cd $name-$version
    ./configure --prefix=/usr --disable-static
    make
    make DESTDIR=$PKG install
}

gperf.

# Description: perfect hash function generator
# URL: http://www.gnu.org/software/gperf/
# Packager: Mattias Hedenskog <mattias@hedenskog.se>
# Maintainer: Bartlomiej Palmowski, maks1k at wp dot pl

name=gperf
version=3.0.3
release=1
source=(ftp://mirrors.kernel.org/gnu/$name/$name-$version.tar.gz)

build() {
    cd $name-$version
    ./configure --prefix=/usr \
        --mandir=/usr/man



    make
    make DESTDIR=$PKG install
    rm -rf $PKG/usr/share
}

Thanks to the real maintainer for those.

Oh, and how do they look, you ask?

That’s probably not a very good example. And the JPG conversion loses some quality. But it should give you an idea.

P.S.: Don’t forget to download the actual patches, probably from the Arch repositories, and include them in the port directory. Otherwise, these just plain won’t work. :mrgreen:

Edit: Here’s the LM Roman 10 at 10-point in Leafpad. The image doesn’t really look as good as what’s on my screen, and I seem to have the best luck with 9-point fonts, but this isn’t bad for a 96dpi 1600×1200 screen. In my own humble opinion, of course. ;)

A Crux port for axel

As mentioned previously, I assembled a Crux port for axel today.

# Description: axel is a command-line download accelerator.
# URL: http://axel.alioth.debian.org/
# Maintainer: 
# Depends on: glibc 

name=axel
version=1.1
release=1
source=(http://alioth.debian.org/frs/download.php/2287/$name-$version.tar.gz)

build () 
{ 
    cd $name-$version;
    ./configure --prefix=/usr --etcdir=/etc/axel;
    make || return 1;
    make DESTDIR=$PKG install
}

I take almost no credit for this one though, since the heavy lifting was done by Colin Zheng’s PKGBUILD2Pkgfile script. I just polished some of the corners. :)

I should probably revise some of my old Frankenscripts and see if Colin’s tool makes them any smoother. :|