ch0wn3d – Keeping your own Perl library and cpan in your home directory

ch0wned. adj. This is the state when you are a Linux user and don't have root access.

Intro

This tutorial is for people wanting to install perl modules using CPAN who do not have root access or wish to keep a network-central module repository that is separated from the local install.

Downloads

Installing

  1. Unpackage lib::local

    tar xvfz local-lib-1.008004.tar.gz

  2. Choose a library directory

    I use a value of $HOME which installs the modules into $HOME/lib/perl5

  3. Install lib::local into the above spot

    cd lib-local-1.008004
    perl Makefile.PL --bootstrap=$HOME
    make 
    make install

Running CPAN

eval `perl -I$HOME/lib/perl5 -Mlocal::lib=$HOME`
perl -I$HOME/lib/perl5 -Mlocal::lib=$HOME -MCPAN -e shell
cpan[1]> install Awesome::Module::From::CPAN

Now you can install modules from CPAN as normal as shown above. You might want to put the first two lines into a shell script named “my_cpan” or something.

Specifying your library path in your Perl scripts

use lib '/home/you/lib/perl5';
use Awesome::Module::From::CPAN;

Share and Enjoy:
  • Facebook
  • Digg
  • del.icio.us
  • Google Bookmarks
  • Blogosphere News
  • email
  • LinkedIn
  • Print
  • Reddit
  • Slashdot
  • Add to favorites
  • RSS
  • Technorati
  • PDF

ch0wn3d – Firefox 4 in Redhat 5 (EL5) / CentOS 5 / CentOS 5.5

ch0wned. adj. This is the state when you are a Linux user and don't have root access.

Intro

The latest Firefox 4 Beta (rc2) requires GCC 4.x and a libstdc++ to match. Unfortunately, Redhat EL5 and CentOS 5 / CentOS 5.5 do not meet this requirement, no matter how many packages you update. But, luckily for us our friend rkl found a solution and posted it on mozillazine. Much to our dismay, the mozilla developers have decided to stop supporting these old of libraries in bug 621704.

Downloads

Installing

  1. Unpackage Firefox

    tar xvfj firefox-4.0rc2.tar.bz2
    mv firefox firefox-4.0rc2

  2. Unpackage RPM and copy library file into firefox directory

    mkdir tmp
    cd tmp
    rpm2cpio ../libstdc++-4.3.0-8.i386.rpm | cpio -i --make-directories
    cp usr/lib/libstdc++.so.6.0.10 ../firefox-4.0rc2/libstdc++.so.6

Running

Firefox should run just fine now :

firefox-4.0rc2/firefox &
Share and Enjoy:
  • Facebook
  • Digg
  • del.icio.us
  • Google Bookmarks
  • Blogosphere News
  • email
  • LinkedIn
  • Print
  • Reddit
  • Slashdot
  • Add to favorites
  • RSS
  • Technorati
  • PDF

ch0wned – Getting a Logitech G500 Mouse and all its Buttons Working in Redhat EL5

ch0wned. adj. This is the state when you are a Linux user and don't have root access. Ok, so technically for this edition of ch0wned you need to have root :-P Hint – Sys admins usually like beer.

Intro

You have a Logitech G500 or other multi-button mouse and want to get all the buttons working. These mice use the evdev driver in xserver. Unfortunately, Redhat EL5 ships with a very buggy version 1.0.0.5-5 !!! We will replace that with a slightly-less buggy version 1.1.2.

Prerequisites

Building

  1. evdev
    tar xvfz xserver-xorg-input-evdev_1.1.2.orig.tar.gz
    cd xf86-input-evdev-1.1.2
    ./configure
    make

    If you have any problems in that stage, make sure you’ve installed the xserver devel package.

Installing

cp /usr/lib64/xorg/modules/input/evdev_drv.so /root/evdev_drv.so.SAVEME
cd xf86-input-evdev-1.1.2
cp src/.libs/evdev_drv.so /usr/lib64/xorg/modules/input/evdev_drv.so

If you have stability problems later, copy the original driver back over your new one.

Configuring

  1. /etc/X11/xorg.conf
    Section "ServerLayout"
    ...
        InputDevice    "FakeMouse"
        InputDevice    "LogitechG500" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
    ...
    EndSection
     
    # xorg 7.1 can't handle evdev as the main device.  this is a hack to have it not create a fake device
    # http://www.chromakode.com/blog/2007/09/19/logitech-lx7-in-ubuntu-edgy-ihatekludgers/
    Section "InputDevice"
        Identifier     "FakeMouse"
        Driver         "void"
    EndSection
    Section "InputDevice"
     
        Identifier     "LogitechG500"
        Driver         "evdev"
        Option         "Protocol" "auto"
        Option         "Device" "/dev/input/event0"
       # If X keeps crashing then you need to change /dev/input/eventX to the right slot.
       # Check /proc/bus/input/devices to find the right one
     
        # Apparently you can't assign two buttons to the same function anymore.  Suckage.
        #Option "ButtonMapping" "1 2 3 4 5 9 8 7 6 2  11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32"
        # https://bugs.freedesktop.org/show_bug.cgi?id=16723
        # Option         "ButtonMapping" "1 2 3 4 5 6 7 4 5 2"
        # Swapping Middle button w/ left thumb...  and l/r scroll wheel w/ l/r left thumb
        #                       1 2  3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
        #Option "ButtonMapping" "1 10 3 4 5 9 8 7 6 2  11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32"
        # oh except for the following..
     
        # Apparently the evdev driver that comes w/ EL5 (version 1.x) sucks.
        # NONE of these options are recognized
        #Option         "Emulate3Buttons" "no"
        #Option        "Buttons" "10"
        #Option        "ZAxisMapping" "4 5"
        #Option         "EmulateWheel" "TRUE"
        #Option         "EmulateWheelButton" "10"
        #Option "ZAxisMapping" "4 5"
     
        # Solution : Run xmodmap from the commandline :
        #xmodmap -e "pointer = 1 3 10 4 5 8 9 7 6 2 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32"
        # Or add to Xmodmap
    EndSection

    Notice the line that says

    Option         "Device" "/dev/input/event0"

    This is where you are telling X where your mouse is plugged into. Unfortunately it may move around between reboots if you are not lucky.
    To find out where it is cat /proc/bus/input/devices and look for the mouse entries…

    I: Bus=0003 Vendor=046d Product=c068 Version=5802
    N: Name="Logitech G500"
    P: Phys=usb-0000:00:1d.1-1/input0
    S: Sysfs=/class/input/input0
    H: Handlers=mouse0 event0 
    B: EV=7
    B: KEY=ffff0000 0 0 0 0
    B: REL=143
     
    I: Bus=0003 Vendor=046d Product=c068 Version=5802
    N: Name="Logitech G500"
    P: Phys=usb-0000:00:1d.1-1/input1
    S: Sysfs=/class/input/input1
    H: Handlers=kbd event1 
    B: EV=10000f
    B: KEY=c0002 40000000000 1 10f8000078007 ffe639fad84157ff febeffdfffefffff fffffffffffffffe
    B: REL=40
    B: ABS=100000000

    Look for the entry that DOES NOT have Handlers=kbd.

  2. /etc/X11/Xmodmap
    ! See notes in xorg.conf - max's fancy logitech mouse
    ! Swap L/R scroll w/ L/R thumb; swap middle->thumb
    ! old exdev - 2/3 swapped, 8/9 swapped
    !pointer = 1 3 10 4 5 8 9 7 6 2 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
    !pointer = 1 10 3 4 5 8 9 7 6 2 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
    ! Swap L/R scroll w/ L/R thumb; swap middle->thumb, switch thumb buttons
    pointer = 1 10 3 4 5 9 8 2 6 7 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
    

    This is where you can remap buttons on your mouse! Unfortunately the button mapping between version 1.0.0 and 1.1.2 of evdev have
    some buttons crossed up. Trial and error are the name of the game. For me using 1.1.2 the final listing above does the following

    • Swap the middle-click and biggest thumb button. You use this a lot in CAD work for electrical engineering. It’s a lot easier on your hands to not have to try to click the moving scroll wheel, especially when it’s in “free-ball” mode.
    • Swap the right/left scroll-wheel with the up-down on the thumb. Now the thumb can be used to scroll left and right and the mouse wheel can be used to do history back/forward in Firefox. This just works out of the box in FF3 for me on RHEL EL5.
    • Mouse acceleration just seems to work too, no settings needed. There is some program out there that lets you reclaim the little acceleration +/- buttons, but i’ve never tried it.

    The way you test it is to run the program xev. Then click in the little white box that appears and see a bunch of gibberish on the console

    ButtonPress event, serial 32, synthetic NO, window 0x2000002,
        root 0x28c, subw 0x2000003, time 4086723575, (47,40), root:(1159,65),
        state 0x0, button 1, same_screen YES
     
    EnterNotify event, serial 32, synthetic NO, window 0x2000002,
        root 0x28c, subw 0x0, time 4086723575, (47,40), root:(1159,65),
        mode NotifyGrab, detail NotifyInferior, same_screen YES,
        focus YES, state 256
     
    KeymapNotify event, serial 32, synthetic NO, window 0x0,
        keys:  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
               0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
     
    ButtonRelease event, serial 32, synthetic NO, window 0x2000002,
        root 0x28c, subw 0x2000003, time 4086723710, (47,40), root:(1159,65),
        state 0x100, button 1, same_screen YES

    This was me pushing the left button (1) and releasing it. Do this with all the buttons and you can see how your remap is working.

Share and Enjoy:
  • Facebook
  • Digg
  • del.icio.us
  • Google Bookmarks
  • Blogosphere News
  • email
  • LinkedIn
  • Print
  • Reddit
  • Slashdot
  • Add to favorites
  • RSS
  • Technorati
  • PDF

Phone + Endomondo + Google Earth = Geeks Workout

Overview

Let’s say you want to track a run, hike or bike using your smart phone and GPS. Now let’s say you want to brag about it on facebook, store stats, and then make little fly-over tours in Google Earth.

Enter EndoMondo a web site for tracking such things using GPS. It has the best GPS logger for Android as far as I can tell, and also has clients for “Android, Blackberry, iPhone, Java, Symbian S60, Windows Mobile 6.1 and newer”. And if that’s not enough it will just import GPS files from your watch or stand-alone GPS.

  1. Install the Endomondo app on your phone
  2. Log your trek using the Endomondo application for your phone or your GPS.
  3. Go to the endomondo.com website and Choose export from the log:

    Endomondo
  4. Export to .gpx format :

    gps_export
  5. Now you need to translate the Garamond .gpx XML file into Google Earth’s .kml format. At some point Endomondo will add this export feature straight in, but until then use the fabulous GPS Visualizer File Converter. Click “upload the file” and then choose output type of “Google Earth KML”.
  6. Now double click the file to open it in Google Earth. Once in there you may want to change your Tour settings in Options.

    google_earth_touring

    Try starting with 10 degrees, 500 meters and Speed of 250.
  7. Now let’s start the tour. Once you have opened the .KML file you then double-click on the trek in “Tracks”, then Click the little tour icon nearby, then you can start and stop the tour in the scroll bar thinger at the bottom. The three red arrows show you the steps:
    google_earth_go
    You can then send that .KML file to anyone or post it to Facebook.

Enjoy!

Share and Enjoy:
  • Facebook
  • Digg
  • del.icio.us
  • Google Bookmarks
  • Blogosphere News
  • email
  • LinkedIn
  • Print
  • Reddit
  • Slashdot
  • Add to favorites
  • RSS
  • Technorati
  • PDF

ch0wned – Adding Open Office 3.x and Java on EL4 for X86_64 in your homedir

ch0wned. adj. This is the state when you are a Linux user and don't have root access.

Intro

Continuing my install series, here’s how you get OpenOffice 3 and Java w/ the Browser plugin working out of your homedirectory on an old linux install (EL4) without root access. I assume you already have a working 64-bit firefox compiled.

This guide assumes you’re leaving off from my previous post : http://warped.org/blog/2009/03/04/chown3d-part-2-gtk-and-glib-in-your-own-home-directory/ where you’ve setup a script called config_gapp.

Downloads

  • OOo_3.2.0_LinuxX86-64_install_wJRE_en-US.tar.gz
  • jdk-6u19-linux-x64.bin

Building

  1. Open Office

    After unpackaging open office run ./setup in the directory it creates. Select $HOME/share/oo-3.2 as a destination and now you will run into your first error:

     error: can't create transaction lock on /var/lock/rpm/transaction

    This is due to a janky version of RPM that comes with EL4 and maybe EL5. Create the file ~/.rpmmacros with the following line :

    %_rpmlock_path %{_dbpath}/__db.000

    Now go run ./setup again. Choose Advanced, uncheck “Gnome Integration”. Here you will run into the second error :

    Package Name: ooobasis3.2-core04-3.2.0-9483.x86_64.rpm 
     
    rpm --upgrade --ignoresize -vh --relocate /opt=/home/$USER/share/oo --dbpath /home/$USER/share/oo/.RPM_OFFICE_DATABASE OOO320_m12_native_packed-1_en-US.9483/RPMS/ooobasis3.2-core04-3.2.0-9483.x86_64.rpm 
    Returns: 1 
    Error during installation  
    error: Failed dependencies: libfreetype.so.6()(64bit) is needed by ooobasis3.2-core04-3.2.0-9483.x86_64

    But since we know we already have this dependency installed in from my previous ch0wned post in $HOME, we can work around this. Create a file $HOME/bin/rpm that will override this for the time being:

     #!/bin/sh
     
    exec /bin/rpm --nodeps "$@"

    And now you can re-run setup a 3rd time, select advanced, deselect gnome integration and GO. Last step is to create some symlinks to the sbase / scalc / sdraw / swriter / smath / soffice executables in your $HOME/bin directory. You may need to create a small wrapper that calls them with run_gapp. Be sure to remove that $HOME/bin/rpm script when you’re done.

  2. Java x86_64 w/ Firefox Plugin

    Download the .bin copy of the JDK.

    chmod +x jdk*
    ./jdk*
    mv jdk* $HOME/share 
    cd $HOME/bin && ln -s $HOME/share/jdk*/bin/j* .

    Now for the browser plugin part

    cd ~/.mozilla/plugins
    ln -s ~/share/jdk*/jre/lib/amd64/libnpjp2.so .

    Restart your browser and go to “about:plugins” et viola.

Share and Enjoy:
  • Facebook
  • Digg
  • del.icio.us
  • Google Bookmarks
  • Blogosphere News
  • email
  • LinkedIn
  • Print
  • Reddit
  • Slashdot
  • Add to favorites
  • RSS
  • Technorati
  • PDF

ch0wned – Building your own Thunderbird 3 on EL4 for X86_64 in your homedir

ch0wned. adj. This is the state when you are a Linux user and don't have root access.

Intro

Having just gone through my guide on installing Firefox now you’re ready to do basically the same thing for Thunderbird.

This guide assumes you’re leaving off from my previous post : http://warped.org/blog/2009/03/04/chown3d-part-2-gtk-and-glib-in-your-own-home-directory/ where you’ve setup a script called config_gapp.

Prerequisites

Building

Follow my guide on installing Firefox for all the prereqs.

Thunderbird 3.0 Building

Configuring

Make a file called mozconfig-tbird

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-tb-release
mk_add_options MOZ_MAKE_FLAGS="-j4"
 
ac_add_options --enable-application=mail
ac_add_options --enable-official-branding
ac_add_options --prefix=/home/$USER/share/thunderbird
# required for make package for tbird now?
ac_add_options --enable-static
 
# Optimization
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --enable-optimize="-O2 -funroll-loops -fexpensive-optimizations"
ac_add_options --enable-strip
 
# Features
ac_add_options --disable-accessibility
ac_add_options --disable-updater
ac_add_options --disable-installer
#ac_add_options --enable-safe-browsing
ac_add_options --enable-xinerama
 
# Libraries / Dependencies
ac_add_options --disable-libnotify
ac_add_options --disable-gnomevfs
ac_add_options --enable-default-toolkit=cairo-gtk2
ac_add_options --enable-system-cairo
ac_add_options --with-system-nss
ac_add_options --with-nss-prefix=/home/$USER
ac_add_options --with-system-nspr
ac_add_options --with-nspr-prefix=/home/$USER
ac_add_options --enable-system-sqlite

Building

I had to patch firefox to use OSS instead of ALSA because EL4 doesn’t have a working ALSA by default. If you have ALSA working, you may not have to do this step. I got the guts of this patch from somewhere, but I can’t find it now, thanks whoever you are!

The patch is on my build firefox page referenced above.

The following is a fork of my config_gapp script. There are some tricky bits because I’ve left off some -L’s to avoid the NSS and NSPR libs that are installed in /usr/lib64.

#!/bin/sh
 
LOCAL_HOME=/home/$USER
export PATH=$LOCAL_HOME/bin:$PATH
 
export CPPFLAGS="-I$LOCAL_HOME/include -I$LOCAL_HOME/include/nss -I/usr/X11R6/include $CPPFLAGS"
export CFLAGS="-I$LOCAL_HOME/include -I$LOCAL_HOME/include/nss -I/usr/X11R6/include $CFLAGS"
export CXXFLAGS="-I$LOCAL_HOME/include -I$LOCAL_HOME/include/nss  -I/usr/X11R6/include  $CXXFLAGS"
#export LDFLAGS="-L$LOCAL_HOME/lib -L/usr/lib64 -L/usr/X11R6/lib64 $LDFLAGS"
export LDFLAGS="-L$LOCAL_HOME/lib -L/usr/X11R6/lib64 $LDFLAGS"
export PKG_CONFIG=$LOCAL_HOME/bin/pkg-config
export PKG_CONFIG_PATH="$LOCAL_HOME/lib/pkgconfig:/usr/lib64/pkgconfig:$PKG_CONFIG_PATH"
#export LD_LIBRARY_PATH="$LOCAL_HOME/lib:/usr/X11R6/lib64:/usr/lib64"
export LD_LIBRARY_PATH="$LOCAL_HOME/lib:/usr/X11R6/lib64"
 
# NOTE: I had to hardcode the path for some reason
export MOZCONFIG=/path/to/mozconfig-tbird
 
make -j 4 -f client.mk build 
 
# make package
# look in dist/*.tar.bz2

Installing

First you make a .tar.bz2, then you go install it.

cd objdir-tb-release
make package
cp mozilla/dist/*.tar.bz2 /somewhere
cd $HOME/share
tar xvfj /path/to/that/*.tar.bz2

Now make a wrapper script $HOME/bin/thunderbird :

#!/bin/sh
 
exec run_gapp /home/$USER/share/thunderbird/thunderbird "$@"

Errors

Here are some of the error messages I encountered along the way that were solved w/ the prerequisites and patch. Hopefully this helps future googlers.

nsUrlClassifierDBService.cpp:(.text+0x678): undefined reference to `inflateInit_'
nsUrlClassifierDBService.cpp:(.text+0x69c): undefined reference to `inflate'
nsUrlClassifierDBService.cpp:(.text+0x6d4): undefined reference to `inflateEnd'

Changed thunderbird-3.0.4/objdir-tb-release/mozilla/toolkit/components/build/Makefile to add libz to the compile. I’m sure there’s a classier way of doing this.

EXTRA_DSO_LDOPTS += \
    $(LIBS_DIR) \
    $(EXTRA_DSO_LIBS) \
    $(MOZ_UNICHARUTIL_LIBS) \
    $(MOZ_COMPONENT_LIBS) \
    $(MOZ_JS_LIBS) \
    $(NULL) \
    -lz
/path/to/thunderbird-3.0.4/directory/c-sdk/ldap/libraries/libprldap/ldappr-public.c:45:27: /$HOME/include/nss/private/pprio.h: Permission denied

Fix yer permissions. duh.

Share and Enjoy:
  • Facebook
  • Digg
  • del.icio.us
  • Google Bookmarks
  • Blogosphere News
  • email
  • LinkedIn
  • Print
  • Reddit
  • Slashdot
  • Add to favorites
  • RSS
  • Technorati
  • PDF

ch0wned – Building your own Firefox on EL4 for X86_64 in your homedir

ch0wned. adj. This is the state when you are a Linux user and don't have root access.

Intro

So you want Firefox 3.new on your EL4 workstation and don’t have root access? Worse off it’s an x86_64 machine? This is not for the faint of heart, and you will run into some snags, but hopefully with my help you can make it work.

This guide assumes you’re leaving off from my previous post : http://warped.org/blog/2009/03/04/chown3d-part-2-gtk-and-glib-in-your-own-home-directory/ where you’ve setup a script called config_gapp.

Prerequisites

Building

  1. SQL Lite

    Make sure you get the “amalgamation” package.

    config_gapp
    make
    make install

  2. NSPR

    Cheers to the Linux from Scratch gurus. See above link.
    Apply this patch using “patch -p1 < file.patch" . You might have to change 1 to another number. I did this on the above newer version of NSPR/NSS w/out a problem.

    Submitted By: DJ Lucas (dj at linuxfromscratch dot org)
    Date: 2009-08-28
    Initial Package Version: 4.8
    Upstream Status: not applicable
    Origin: self
    Description: Adds pkg-config file for nspr.
     
    diff -Naur nspr-4.8-orig/mozilla/nsprpub/config/config.mk nspr-4.8/mozilla/nsprpub/config/config.mk
    --- nspr-4.8-orig/mozilla/nsprpub/config/config.mk	2005-04-29 16:02:53.000000000 -0500
    +++ nspr-4.8/mozilla/nsprpub/config/config.mk	2009-08-28 15:42:46.000000000 -0500
    @@ -162,3 +162,4 @@
     RELEASE_INCLUDE_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/include
     RELEASE_BIN_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/bin
     RELEASE_LIB_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/lib
    +RELEASE_PC_DIR = $(RELEASE_LIB_DIR)/pkgconfig
    diff -Naur nspr-4.8-orig/mozilla/nsprpub/config/Makefile.in nspr-4.8/mozilla/nsprpub/config/Makefile.in
    --- nspr-4.8-orig/mozilla/nsprpub/config/Makefile.in	2009-03-03 16:04:23.000000000 -0600
    +++ nspr-4.8/mozilla/nsprpub/config/Makefile.in	2009-08-28 15:42:46.000000000 -0500
    @@ -52,9 +52,10 @@
     
     # autoconf.mk must be deleted last (from the top-level directory)
     # because it is included by every makefile.
    -DIST_GARBAGE	= nsprincl.mk nsprincl.sh nspr-config
    +DIST_GARBAGE	= nsprincl.mk nsprincl.sh nspr-config nspr.pc
     
     RELEASE_BINS	= nspr-config
    +RELEASE_PC	= nspr.pc
     
     include $(topsrcdir)/config/config.mk
     
    diff -Naur nspr-4.8-orig/mozilla/nsprpub/config/nspr.pc.in nspr-4.8/mozilla/nsprpub/config/nspr.pc.in
    --- nspr-4.8-orig/mozilla/nsprpub/config/nspr.pc.in	1969-12-31 18:00:00.000000000 -0600
    +++ nspr-4.8/mozilla/nsprpub/config/nspr.pc.in	2009-08-28 15:43:13.000000000 -0500
    @@ -0,0 +1,11 @@
    +prefix=@prefix@
    +exec_prefix=@exec_prefix@
    +libdir=@libdir@
    +includedir=@includedir@
    +
    +Name: NSPR
    +Description: The Netscape Portable Runtime
    +Version: @MOD_MAJOR_VERSION@.@MOD_MINOR_VERSION@.@MOD_PATCH_VERSION@
    +Libs: -L${libdir} -lplds@MOD_MAJOR_VERSION@ -lplc@MOD_MAJOR_VERSION@ -lnspr@MOD_MAJOR_VERSION@ -lpthread 
    +Cflags: -I${includedir}
    +
    diff -Naur nspr-4.8-orig/mozilla/nsprpub/config/rules.mk nspr-4.8/mozilla/nsprpub/config/rules.mk
    --- nspr-4.8-orig/mozilla/nsprpub/config/rules.mk	2009-05-01 18:08:01.000000000 -0500
    +++ nspr-4.8/mozilla/nsprpub/config/rules.mk	2009-08-28 15:42:46.000000000 -0500
    @@ -211,7 +211,7 @@
     	rm -rf $(wildcard *.OBJ *.OBJD) dist $(ALL_TRASH) $(DIST_GARBAGE)
     	+$(LOOP_OVER_DIRS)
     
    -install:: $(RELEASE_BINS) $(RELEASE_HEADERS) $(RELEASE_LIBS)
    +install:: $(RELEASE_BINS) $(RELEASE_HEADERS) $(RELEASE_LIBS) $(RELEASE_PC)
     ifdef RELEASE_BINS
     	$(NSINSTALL) -t -m 0755 $(RELEASE_BINS) $(DESTDIR)$(bindir)
     endif
    @@ -221,6 +221,9 @@
     ifdef RELEASE_LIBS
     	$(NSINSTALL) -t -m 0755 $(RELEASE_LIBS) $(DESTDIR)$(libdir)/$(lib_subdir)
     endif
    +ifdef RELEASE_PC
    +	$(NSINSTALL) -t -m 0644 $(RELEASE_PC) $(DESTDIR)$(libdir)/pkgconfig/
    +endif
     	+$(LOOP_OVER_DIRS)
     
     release:: export
    @@ -272,6 +275,23 @@
     	fi
     	cp $(RELEASE_HEADERS) $(RELEASE_HEADERS_DEST)
     endif
    +ifdef RELEASE_PC
    +	@echo "Copying pkg-config files to release directory"
    +	@if test -z "$(BUILD_NUMBER)"; then \
    +		echo "BUILD_NUMBER must be defined"; \
    +		false; \
    +	else \
    +		true; \
    +	fi
    +	@if test ! -d $(RELEASE_PC_DEST); then \
    +		rm -rf $(RELEASE_PC_DEST); \
    +		$(NSINSTALL) -D $(RELEASE_PC_DEST);\
    +	else \
    +		true; \
    +	fi
    +	cp $(RELEASE_PC) $(RELEASE_PC_DEST)
    +endif
    +
     	+$(LOOP_OVER_DIRS)
     
     alltags:
    diff -Naur nspr-4.8-orig/mozilla/nsprpub/configure nspr-4.8/mozilla/nsprpub/configure
    --- nspr-4.8-orig/mozilla/nsprpub/configure	2009-05-08 08:12:31.000000000 -0500
    +++ nspr-4.8/mozilla/nsprpub/configure	2009-08-28 15:42:46.000000000 -0500
    @@ -6037,6 +6037,7 @@
     config/nsprincl.mk
     config/nsprincl.sh
     config/nspr-config
    +config/nspr.pc
     lib/Makefile 
     lib/ds/Makefile 
     lib/libc/Makefile 
    diff -Naur nspr-4.8-orig/mozilla/nsprpub/configure.in nspr-4.8/mozilla/nsprpub/configure.in
    --- nspr-4.8-orig/mozilla/nsprpub/configure.in	2009-05-01 18:08:00.000000000 -0500
    +++ nspr-4.8/mozilla/nsprpub/configure.in	2009-08-28 15:42:46.000000000 -0500
    @@ -2871,6 +2871,7 @@
     config/nsprincl.mk
     config/nsprincl.sh
     config/nspr-config
    +config/nspr.pc
     lib/Makefile 
     lib/ds/Makefile 
     lib/libc/Makefile

    Once patched, run this script to configure and build NSPR

    #!/bin/sh 
     
    cd mozilla/nsprpub
    config_gapp \
                --with-mozilla \
                --with-pthreads \
                --enable-64bit \
                --disable-debug \
                --enable-optimize="-O2"
     
    run_gapp make -j4
     
    run_gapp make install
    cp -v -f -LR dist/include/nspr $HOME/include
  3. NSS

    Again cheers to DJ for this gem. Apply it.

    Submitted By: DJ Lucas (dj at linuxfromscratch dot org)
    Date: 2009-09-05
    Initial Package Version: 3.12.4
    Upstream Status: not applicable
    Origin: self
    Description: Adds auto-generated nss.pc and nss-config script, and allows
                 building without nspr in the source tree.
     
    diff -Naur nss-3.12.4-orig/mozilla/security/nss/config/Makefile nss-3.12.4/mozilla/security/nss/config/Makefile
    --- nss-3.12.4-orig/mozilla/security/nss/config/Makefile	1969-12-31 18:00:00.000000000 -0600
    +++ nss-3.12.4/mozilla/security/nss/config/Makefile	2009-08-31 19:15:20.000000000 -0500
    @@ -0,0 +1,40 @@
    +CORE_DEPTH = ../..
    +DEPTH      = ../..
    +
    +include $(CORE_DEPTH)/coreconf/config.mk
    +
    +NSS_MAJOR_VERSION = `grep "NSS_VMAJOR" ../lib/nss/nss.h | awk '{print $$3}'`
    +NSS_MINOR_VERSION = `grep "NSS_VMINOR" ../lib/nss/nss.h | awk '{print $$3}'`
    +NSS_PATCH_VERSION = `grep "NSS_VPATCH" ../lib/nss/nss.h | awk '{print $$3}'`
    +PREFIX = /usr
    +
    +all: export libs
    +
    +export:
    +	# Create the nss.pc file
    +	mkdir -p $(DIST)/lib/pkgconfig
    +	sed -e "s,@prefix@,$(PREFIX)," \
    +	    -e "s,@exec_prefix@,\$${prefix}," \
    +	    -e "s,@libdir@,\$${prefix}/lib," \
    +	    -e "s,@includedir@,\$${prefix}/include/nss," \
    +	    -e "s,@NSS_MAJOR_VERSION@,$(NSS_MAJOR_VERSION),g" \
    +	    -e "s,@NSS_MINOR_VERSION@,$(NSS_MINOR_VERSION)," \
    +	    -e "s,@NSS_PATCH_VERSION@,$(NSS_PATCH_VERSION)," \
    +	    nss.pc.in > nss.pc
    +	chmod 0644 nss.pc
    +	ln -sf ../../../../security/nss/config/nss.pc $(DIST)/lib/pkgconfig
    +
    +	# Create the nss-config script
    +	mkdir -p $(DIST)/bin
    +	sed -e "s,@prefix@,$(PREFIX)," \
    +	    -e "s,@NSS_MAJOR_VERSION@,$(NSS_MAJOR_VERSION)," \
    +	    -e "s,@NSS_MINOR_VERSION@,$(NSS_MINOR_VERSION)," \
    +	    -e "s,@NSS_PATCH_VERSION@,$(NSS_PATCH_VERSION)," \
    +	    nss-config.in > nss-config
    +	chmod 0755 nss-config
    +	ln -sf ../../../security/nss/config/nss-config $(DIST)/bin
    +
    +libs:
    +
    +dummy: all export libs
    +
    diff -Naur nss-3.12.4-orig/mozilla/security/nss/config/nss-config.in nss-3.12.4/mozilla/security/nss/config/nss-config.in
    --- nss-3.12.4-orig/mozilla/security/nss/config/nss-config.in	1969-12-31 18:00:00.000000000 -0600
    +++ nss-3.12.4/mozilla/security/nss/config/nss-config.in	2009-08-31 19:16:56.000000000 -0500
    @@ -0,0 +1,153 @@
    +#!/bin/sh
    +
    +prefix=@prefix@
    +
    +major_version=@NSS_MAJOR_VERSION@
    +minor_version=@NSS_MINOR_VERSION@
    +patch_version=@NSS_PATCH_VERSION@
    +
    +usage()
    +{
    +	cat < <EOF
    +Usage: nss-config [OPTIONS] [LIBRARIES]
    +Options:
    +	[--prefix[=DIR]]
    +	[--exec-prefix[=DIR]]
    +	[--includedir[=DIR]]
    +	[--libdir[=DIR]]
    +	[--version]
    +	[--libs]
    +	[--cflags]
    +Dynamic Libraries:
    +	nss
    +	nssutil
    +	smime
    +	ssl
    +	softokn
    +EOF
    +	exit $1
    +}
    +
    +if test $# -eq 0; then
    +	usage 1 1>&2
    +fi
    +
    +lib_nss=yes
    +lib_nssutil=yes
    +lib_smime=yes
    +lib_ssl=yes
    +lib_softokn=yes
    +
    +while test $# -gt 0; do
    +  case "$1" in
    +  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
    +  *) optarg= ;;
    +  esac
    +
    +  case $1 in
    +    --prefix=*)
    +      prefix=$optarg
    +      ;;
    +    --prefix)
    +      echo_prefix=yes
    +      ;;
    +    --exec-prefix=*)
    +      exec_prefix=$optarg
    +      ;;
    +    --exec-prefix)
    +      echo_exec_prefix=yes
    +      ;;
    +    --includedir=*)
    +      includedir=$optarg
    +      ;;
    +    --includedir)
    +      echo_includedir=yes
    +      ;;
    +    --libdir=*)
    +      libdir=$optarg
    +      ;;
    +    --libdir)
    +      echo_libdir=yes
    +      ;;
    +    --version)
    +      echo ${major_version}.${minor_version}.${patch_version}
    +      ;;
    +    --cflags)
    +      echo_cflags=yes
    +      ;;
    +    --libs)
    +      echo_libs=yes
    +      ;;
    +    nss)
    +      lib_nss=yes
    +      ;;
    +    nssutil)
    +      lib_nssutil=yes
    +      ;;
    +    smime)
    +      lib_smime=yes
    +      ;;
    +    ssl)
    +      lib_ssl=yes
    +      ;;
    +    softokn)
    +      lib_softokn=yes
    +      ;;
    +    *)
    +      usage 1 1>&2
    +      ;;
    +  esac
    +  shift
    +done
    +
    +# Set variables that may be dependent upon other variables
    +if test -z "$exec_prefix"; then
    +    exec_prefix=`pkg-config --variable=exec_prefix nss`
    +fi
    +if test -z "$includedir"; then
    +    includedir=`pkg-config --variable=includedir nss`
    +fi
    +if test -z "$libdir"; then
    +    libdir=`pkg-config --variable=libdir nss`
    +fi
    +
    +if test "$echo_prefix" = "yes"; then
    +    echo $prefix
    +fi
    +
    +if test "$echo_exec_prefix" = "yes"; then
    +    echo $exec_prefix
    +fi
    +
    +if test "$echo_includedir" = "yes"; then
    +    echo $includedir
    +fi
    +
    +if test "$echo_libdir" = "yes"; then
    +    echo $libdir
    +fi
    +
    +if test "$echo_cflags" = "yes"; then
    +    echo -I$includedir
    +fi
    +
    +if test "$echo_libs" = "yes"; then
    +      libdirs="-L$libdir"
    +      if test -n "$lib_nss"; then
    +	libdirs="$libdirs -lnss${major_version}"
    +      fi
    +      if test -n "$lib_nssutil"; then
    +        libdirs="$libdirs -lnssutil${major_version}"
    +      fi
    +      if test -n "$lib_smime"; then
    +	libdirs="$libdirs -lsmime${major_version}"
    +      fi
    +      if test -n "$lib_ssl"; then
    +	libdirs="$libdirs -lssl${major_version}"
    +      fi
    +      if test -n "$lib_softokn"; then
    +        libdirs="$libdirs -lsoftokn${major_version}"
    +      fi
    +      echo $libdirs
    +fi      
    +
    diff -Naur nss-3.12.4-orig/mozilla/security/nss/config/nss.pc.in nss-3.12.4/mozilla/security/nss/config/nss.pc.in
    --- nss-3.12.4-orig/mozilla/security/nss/config/nss.pc.in	1969-12-31 18:00:00.000000000 -0600
    +++ nss-3.12.4/mozilla/security/nss/config/nss.pc.in	2009-08-31 19:15:20.000000000 -0500
    @@ -0,0 +1,12 @@
    +prefix=@prefix@
    +exec_prefix=@exec_prefix@
    +libdir=@libdir@
    +includedir=@includedir@
    +
    +Name: NSS
    +Description: Network Security Services
    +Version: @NSS_MAJOR_VERSION@.@NSS_MINOR_VERSION@.@NSS_PATCH_VERSION@
    +Requires: nspr >= 4.8
    +Libs: -L@libdir@ -lnss@NSS_MAJOR_VERSION@ -lnssutil@NSS_MAJOR_VERSION@ -lsmime@NSS_MAJOR_VERSION@ -lssl@NSS_MAJOR_VERSION@ -lsoftokn@NSS_MAJOR_VERSION@
    +Cflags: -I${includedir}
    +
    diff -Naur nss-3.12.4-orig/mozilla/security/nss/Makefile nss-3.12.4/mozilla/security/nss/Makefile
    --- nss-3.12.4-orig/mozilla/security/nss/Makefile	2008-12-02 17:24:39.000000000 -0600
    +++ nss-3.12.4/mozilla/security/nss/Makefile	2009-08-31 19:15:20.000000000 -0500
    @@ -78,7 +78,7 @@
     # (7) Execute "local" rules. (OPTIONAL).                              #
     #######################################################################
     
    -nss_build_all: build_coreconf build_nspr build_dbm all
    +nss_build_all: build_coreconf build_dbm all
     
     nss_clean_all: clobber_coreconf clobber_nspr clobber_dbm clobber
     
    @@ -140,12 +140,6 @@
     	--with-dist-prefix='$(NSPR_PREFIX)' \
     	--with-dist-includedir='$(NSPR_PREFIX)/include'
     
    -build_nspr: $(NSPR_CONFIG_STATUS)
    -	cd $(CORE_DEPTH)/../nsprpub/$(OBJDIR_NAME) ; $(MAKE)
    -
    -clobber_nspr: $(NSPR_CONFIG_STATUS)
    -	cd $(CORE_DEPTH)/../nsprpub/$(OBJDIR_NAME) ; $(MAKE) clobber
    -
     build_dbm:
     ifndef NSS_DISABLE_DBM
     	cd $(CORE_DEPTH)/dbm ; $(MAKE) export libs
    diff -Naur nss-3.12.4-orig/mozilla/security/nss/manifest.mn nss-3.12.4/mozilla/security/nss/manifest.mn
    --- nss-3.12.4-orig/mozilla/security/nss/manifest.mn	2008-04-04 15:36:59.000000000 -0500
    +++ nss-3.12.4/mozilla/security/nss/manifest.mn	2009-08-31 19:15:20.000000000 -0500
    @@ -42,6 +42,6 @@
     
     RELEASE = nss
     
    -DIRS = lib cmd
    +DIRS = lib cmd config

    I had to add the following line to nss-3.12.6/mozilla/security/coreconf/location.mk to get it to find the newly installed NSPR.

    INCLUDES += -I$HOME/include

    Then run this:

    #!/bin/sh
     
    export BUILD_OPT=1 
    export NSS_USE_SYSTEM_SQLITE=1 
    export NSPR_INCLUDE_DIR=/home/$USER/include/nspr 
    export USE_SYSTEM_ZLIB=1 
    export ZLIB_LIBS=-lz 
    export USE_64=1
     
    #patch -Np1 -i ../nss-3.12.5-standalone-1.patch 
     
    run_gapp \
        make -C mozilla/security/nss nss_build_all

    Then run this to install it :

    #!/bin/sh
     
    LOC_HOME=/home/$USER
     
    export NSS_LINUXDIR=$(basename `ls -d $PWD/mozilla/dist/Linux*`)
     
    echo "NSS_LINUXDIR=$NSS_LINUXDIR"
     
    cd mozilla/dist
    install -v -m755 $NSS_LINUXDIR/lib/*.so $LOC_HOME/lib 
    install -v -m644 $NSS_LINUXDIR/lib/{*.chk,libcrmf.a} $LOC_HOME/lib 
    install -v -m755 -d $LOC_HOME/include/nss 
    install -v -m755 $NSS_LINUXDIR/bin/{certutil,nss-config,pk12util} $LOC_HOME/bin 
    install -v -m644 $NSS_LINUXDIR/lib/pkgconfig/nss.pc $LOC_HOME/lib/pkgconfig 
    cp -v -RL {public,private}/nss/* $LOC_HOME/include/nss 
    chmod 644 $LOC_HOME/include/nss/*

  4. Python

    See my other post here : http://warped.org/blog/2010/04/02/ch0wned-installing-taskcoach-and-all-its-depenencies-in-home-for-el4/

Firefox

Configuring

Make a file called mozconfig-firefox or some such.

export BUILD_OFFICIAL=1
mk_add_options BUILD_OFFICIAL=1
mk_add_options MOZ_CO_PROJECT=browser
# the following line uses 4 CPUs to build
#mk_add_options MOZ_MAKE_FLAGS="-j4"
 
ac_add_options --enable-application=browser
ac_add_options --enable-official-branding
ac_add_options --prefix=/home/$USER/share/firefox
 
# Optimization
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --enable-optimize="-O2 -funroll-loops -fexpensive-optimizations"
ac_add_options --enable-strip
 
# Features
ac_add_options --disable-accessibility
ac_add_options --disable-updater
ac_add_options --disable-installer
ac_add_options --enable-safe-browsing
ac_add_options --enable-xinerama
 
# Libraries / Dependencies
ac_add_options --disable-libnotify
ac_add_options --disable-gnomevfs
ac_add_options --enable-default-toolkit=cairo-gtk2
ac_add_options --enable-system-cairo
ac_add_options --with-system-nss
ac_add_options --with-nss-prefix=/home/$USER
ac_add_options --with-system-nspr
ac_add_options --with-nspr-prefix=/home/$USER
ac_add_options --enable-system-sqlite

Building

I had to patch firefox to use OSS instead of ALSA because EL4 doesn’t have a working ALSA by default. If you have ALSA working, you may not have to do this step. I got the guts of this patch from somewhere, but I can’t find it now, thanks whoever you are!

diff -ur firefox-3.6.2-orig/media/libsydneyaudio/src/Makefile.in firefox-3.6.2/media/libsydneyaudio/src/Makefile.in
--- firefox-3.6.2-orig/media/libsydneyaudio/src/Makefile.in	2010-03-16 02:56:36.000000000 -0700
+++ firefox-3.6.2/media/libsydneyaudio/src/Makefile.in	2010-04-01 10:13:27.000000000 -0700
@@ -47,7 +47,7 @@
 
 ifeq ($(OS_ARCH),Linux)
 CSRCS		= \
-		sydney_audio_alsa.c \
+		sydney_audio_oss.c \
 		$(NULL)
 endif
 
diff -ur firefox-3.6.2-orig/media/libsydneyaudio/src/sydney_audio_oss.c firefox-3.6.2/media/libsydneyaudio/src/sydney_audio_oss.c
--- firefox-3.6.2-orig/media/libsydneyaudio/src/sydney_audio_oss.c	2010-03-16 02:56:36.000000000 -0700
+++ firefox-3.6.2/media/libsydneyaudio/src/sydney_audio_oss.c	2010-04-01 10:15:40.000000000 -0700
@@ -47,11 +47,11 @@
 #include "sydney_audio.h"
 
 // for versions newer than 3.6.1
-#define OSS_VERSION(x, y, z) (x < < 16 | y << 8 | z)
+#define OSS_VERSION_(x, y, z) (x << 16 | y << 8 | z)
 // support only versions newer than 3.6.1
-#define SUPP_OSS_VERSION OSS_VERSION(3,6,1)
+#define SUPP_OSS_VERSION OSS_VERSION_(3,6,1)
 
-#if (SOUND_VERSION < SUPP_OSS_VERSION)
+#if (SOUND_VERSION < SUPP_OSS_VERSION_)
 #error Unsupported OSS Version
 #else
 
@@ -127,7 +127,7 @@
         case SA_PCM_FORMAT_S16_BE:
             *fmt = AFMT_S16_BE;
             break;
-#if SOUND_VERSION >= OSS_VERSION(4,0,0)
+#if SOUND_VERSION >= OSS_VERSION_(4,0,0)
         /* 24-bit formats (LSB aligned in 32 bit word) */
         case SA_PCM_FORMAT_S24_LE:
             *fmt = AFMT_S24_LE;
@@ -563,6 +563,8 @@
 #if 0 /* TODO */
   AudioOutputUnitStop(s->output_unit);
 #endif
+  close(s->output_fd);
+  s->output_fd = -1;
   pthread_mutex_unlock(&s->mutex);
   return SA_SUCCESS;
 }
@@ -581,10 +583,11 @@
    * The audio device resets its mSampleTime counter after pausing,
    * so we need to clear our tracking value to keep that in sync.
    */
-  s->bytes_played = 0;
+  //s->bytes_played = 0;
 #if 0 /* TODO */
   AudioOutputUnitStart(s->output_unit);
 #endif
+  sa_stream_open(s);
   pthread_mutex_unlock(&s->mutex);
   return SA_SUCCESS;
 }
@@ -615,7 +618,7 @@
   if (s == NULL || s->output_fd == -1) {
     return SA_ERROR_NO_INIT;
   }
-#if SOUND_VERSION >= OSS_VERSION(4,0,0)
+#if SOUND_VERSION >= OSS_VERSION_(4,0,0)
   int mvol = ((int)(100*vol)) | ((int)(100*vol) < < 8);
   if (ioctl(s->output_fd, SNDCTL_DSP_SETPLAYVOL, &mvol) < 0){
     return SA_ERROR_SYSTEM;
@@ -637,7 +640,7 @@
   if (s == NULL || s->output_fd == -1) {
     return SA_ERROR_NO_INIT;
   }
-#if SOUND_VERSION >= OSS_VERSION(4,0,0)
+#if SOUND_VERSION >= OSS_VERSION_(4,0,0)
   int mvol;
   if (ioctl(s->output_fd, SNDCTL_DSP_SETPLAYVOL, &mvol) < 0){
     return SA_ERROR_SYSTEM;

The following is a fork of my config_gapp script. There are some tricky bits because I’ve left off some -L’s to avoid the NSS and NSPR libs that are installed in /usr/lib64.

#!/bin/sh
 
LOCAL_HOME=/home/$USER
export PATH=$LOCAL_HOME/bin:$PATH
 
export CPPFLAGS="-I$LOCAL_HOME/include -I$LOCAL_HOME/include/nss -I/usr/X11R6/include $CPPFLAGS"
export CFLAGS="-I$LOCAL_HOME/include -I$LOCAL_HOME/include/nss -I/usr/X11R6/include $CFLAGS"
export CXXFLAGS="-I$LOCAL_HOME/include -I$LOCAL_HOME/include/nss  -I/usr/X11R6/include  $CXXFLAGS"
#export LDFLAGS="-L$LOCAL_HOME/lib -L/usr/lib64 -L/usr/X11R6/lib64 $LDFLAGS"
export LDFLAGS="-L$LOCAL_HOME/lib -L/usr/X11R6/lib64 $LDFLAGS"
export PKG_CONFIG=$LOCAL_HOME/bin/pkg-config
export PKG_CONFIG_PATH="$LOCAL_HOME/lib/pkgconfig:/usr/lib64/pkgconfig:$PKG_CONFIG_PATH"
#export LD_LIBRARY_PATH="$LOCAL_HOME/lib:/usr/X11R6/lib64:/usr/lib64"
export LD_LIBRARY_PATH="$LOCAL_HOME/lib:/usr/X11R6/lib64"
 
export MOZCONFIG=../mozconfig-firefox
 
make -j 4 -f client.mk build

Installing

First you make a .tar.bz2, then you go install it.

make package
cp dist/*.tar.bz2 /somewhere
cd $HOME/share
tar xvfj /path/to/that/*.tar.bz2

Now make a wrapper script $HOME/bin/firefox :

#!/bin/sh
 
exec run_gapp /home/$USER/share/firefox/firefox "$@"

Errors

Here are some of the error messages I encountered along the way that were solved w/ the prerequisites and patch. Hopefully this helps future googlers.

../../staticlib/components/libpipnss.a(nsNSSCallbacks.o)(.text+0x150a): In function `RegisterMyOCSPAIAInfoCallback()':
: undefined reference to `CERT_RegisterAlternateOCSPAIAInfoCallBack'
../../staticlib/components/libpipnss.a(nsNSSCallbacks.o)(.text+0x154d): In function `UnregisterMyOCSPAIAInfoCallback()':
: undefined reference to `CERT_RegisterAlternateOCSPAIAInfoCallBack'
../../staticlib/components/libpipnss.a(nsNSSCallbacks.o)(.text+0x2aa9): In function `HandshakeCallback(PRFileDesc*, void*)':
: undefined reference to `SSL_HandshakeNegotiatedExtension'
collect2: ld returned 1 exit status
make[4]: *** [libxul.so] Error 1
make[4]: Leaving directory `/opt/local/mbaker/firefox-3.6.2/toolkit/library'
make[3]: *** [libs_tier_toolkit] Error 2
make[3]: Leaving directory `/opt/local/mbaker/firefox-3.6.2'
make[2]: *** [tier_toolkit] Error 2
make[2]: Leaving directory `/opt/local/mbaker/firefox-3.6.2'
make[1]: *** [default] Error 2
make[1]: Leaving directory `/opt/local/mbaker/firefox-3.6.2'
make: *** [build] Error 2

That one was solved by installing NSS and NSPR separately with the linux-from-scratch patches.

error: system NSPR does not support PR_STATIC_ASSERT

Look in config.log and then fix your permissions in $HOME/include/nss.

Share and Enjoy:
  • Facebook
  • Digg
  • del.icio.us
  • Google Bookmarks
  • Blogosphere News
  • email
  • LinkedIn
  • Print
  • Reddit
  • Slashdot
  • Add to favorites
  • RSS
  • Technorati
  • PDF

ch0wned – Building Amarok 1.4.10 in $HOME on Redhat EL4/EL5

ch0wned. adj. This is the state when you are a linux user and don't have root access.

Intro

All I wanted to do was play Internet radio via a SOCKS proxy. Is that too much to ask for on Redhat EL4? Apparently so. So after many hours of frustration, here is how you get Amarok 1.x (1.4.10 was the last one made) to compile and run from your homedir on Linux 2.ANCIENT.

UPDATE 1/28/2011: Updated for EL5 too!

This guide assumes you’re leaving off from my previous post : http://warped.org/blog/2009/03/04/chown3d-part-2-gtk-and-glib-in-your-own-home-directory/ where you’ve setup a script called config_gapp.

Prerequisites

  • amarok-1.4.10.tar.bz2
  • binutils-2.20.1.tar.bz2 (EL4 Only)
  • xine-lib-1.1.18.1.tar.bz2
  • taglib-1.6.1.tar.gz
  • ruby-devel package or ruby 1.8+ installed in $HOME
  • ffmpeg-0.5.1.tar.bz2
  • My Patches (EL4 or /dev/dsp1 only)

Building

For taglib, ffmpeg, and binutils:

config_gapp
make
make install
cp taglib-1.6.1/taglib.pc ~/lib/pkgconfig

For xine-lib :

config_gapp --without-speex
make
make install

For amarok:

config_gapp

Then apply this patch for EL4 only:

diff -ru amarok-1.4.10/amarok/src/mediadevice/generic/genericmediadevice.cpp amarok-1.4.10-max/amarok/src/mediadevice/generic/genericmediadevice.cpp
--- amarok-1.4.10/amarok/src/mediadevice/generic/genericmediadevice.cpp	2008-08-13 14:21:51.000000000 -0700
+++ amarok-1.4.10-max/amarok/src/mediadevice/generic/genericmediadevice.cpp	2010-04-05 16:21:11.000000000 -0700
@@ -557,7 +557,7 @@
     args["artist"] = artist;
     args["albumartist"] = albumartist;
     args["initial"] = albumartist.mid( 0, 1 ).upper();
-    args["filetype"] = mb.url().pathOrURL().section( ".", -1 ).lower();
+    args["filetype"] = mb.url().url().section( ".", -1 ).lower();
     QString track;
     if ( mb.track() )
         track.sprintf( "%02d", mb.track() );
@@ -657,7 +657,7 @@
 
     if( !kioCopyTrack( bundle.url(), desturl ) )
     {
-        debug() < < "Failed to copy track: " << bundle.url().pathOrURL() << " to " << desturl.pathOrURL() << endl;
+        debug() << "Failed to copy track: " << bundle.url().url() << " to " << desturl.url() << endl;
         return 0;
     }
 
@@ -833,7 +833,7 @@
 void
 GenericMediaDevice::dirListerClear( const KURL &url )
 {
-    QString directory = url.pathOrURL();
+    QString directory = url.path();
     GenericMediaFile *vmf = m_mfm[directory];
     if( vmf )
         vmf->deleteAll( false );
@@ -842,7 +842,7 @@
 void
 GenericMediaDevice::dirListerDeleteItem( KFileItem *fileitem )
 {
-    QString filename = fileitem->url().pathOrURL();
+    QString filename = fileitem->url().path();
     GenericMediaFile *vmf = m_mfm[filename];
     if( vmf )
         vmf->deleteAll( true );
diff -ru amarok-1.4.10/amarok/src/plugin/plugin.h amarok-1.4.10-max/amarok/src/plugin/plugin.h
--- amarok-1.4.10/amarok/src/plugin/plugin.h	2008-08-13 14:21:51.000000000 -0700
+++ amarok-1.4.10-max/amarok/src/plugin/plugin.h	2010-04-05 16:07:18.000000000 -0700
@@ -9,9 +9,11 @@
 
 #define AMAROK_EXPORT_PLUGIN( classname ) \
     extern "C" { \
-          KDE_EXPORT Amarok::Plugin* create_plugin() { return new classname; } \
+           __attribute__ ((visibility("default"))) Amarok::Plugin* create_plugin() { return new classname; } \
     }
 
+          //KDE_EXPORT Amarok::Plugin* create_plugin() { return new classname; } 
+
 #include <qmap .h>
 #include <qstring .h>
 
--- amarok-1.4.10/amarok/src/amarokcore/amarokconfig.cpp	2010-04-05 17:19:09.000000000 -0700
+++ amarok-1.4.10-max/amarok/src/amarokcore/amarokconfig.cpp	2010-04-05 15:46:37.000000000 -0700
@@ -465,8 +465,8 @@
   KConfigSkeleton::ItemBool  *itemMonitorChanges;
   itemMonitorChanges = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "Monitor Changes" ), mMonitorChanges, true );
   addItem( itemMonitorChanges, QString::fromLatin1( "MonitorChanges" ) );
-  KConfigSkeleton::ItemPathList  *itemCollectionFolders;
-  itemCollectionFolders = new KConfigSkeleton::ItemPathList( currentGroup(), QString::fromLatin1( "Collection Folders" ), mCollectionFolders );
+  KConfigSkeleton::ItemString *itemCollectionFolders;
+  itemCollectionFolders = new KConfigSkeleton::ItemString ( currentGroup(), QString::fromLatin1( "Collection Folders" ), mCollectionFolders );
   addItem( itemCollectionFolders, QString::fromLatin1( "CollectionFolders" ) );
 
   setCurrentGroup( QString::fromLatin1( "MySql" ) );
 
</qstring></qmap>

Then go ahead with:

make
make install

Using /dev/dsp1 in Amarok 1.4

Let’s say you have an external soundcard or headphone amp plugged in USB and the thing registers as /dev/dsp1.

You will need to modify xine-lib to handle this :

--- xine-lib-1.1.18.1/src/audio_out/audio_oss_out.c.orig        2011-01-28 14:52:17.000000000 -0800
+++ xine-lib-1.1.18.1/src/audio_out/audio_oss_out.c     2011-01-28 15:07:03.000000000 -0800
@@ -662,7 +662,7 @@
  * If not, the function returns 0.
  */
 static int probe_audio_devices(oss_driver_t *this) {
-  const char *base_names[2] = {"/dev/dsp", "/dev/sound/dsp"};
+  const char *base_names[2] = {"/dev/dsp", "/dev/dsp1"};
   int base_num, i;
   int audio_fd, rate;
   int best_rate;
@@ -707,7 +707,7 @@
   int              audio_fd;
   int              num_channels, status, arg;
   static char     *sync_methods[] = {"auto", "getodelay", "getoptr", "softsync", "probebuffer", NULL};
-  static char     *devname_opts[] = {"auto", "/dev/dsp", "/dev/sound/dsp", NULL};
+  static char     *devname_opts[] = {"auto", "/dev/dsp", "/dev/dsp1", NULL};
   int devname_val, devname_num;
   /* for usability reasons, keep this in sync with audio_alsa_out.c */
   static char     *speaker_arrangement[] = {"Mono 1.0", "Stereo 2.0", "Headphones 2.0", "Stereo 2.1",

Then choose Amarok – Engine – Xine – OSS Device Configuration – Device = /dev/sound/dsp1. Enjoy. If you did the above steps and then got to this step, you will need to ‘make clean’ and ‘config_gapp’ again in xinelib and amarok.

Errors

Here are some of the error messages I encountered along the way that were solved w/ the prerequisites and patch. Hopefully this helps future googlers.

/usr/bin/ld: .libs/xine.o: relocation R_X86_64_PC32 against `xine_event_send' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value

Needs a newer version of binutils that handles X86_64 better.

amarokconfig.cpp: In constructor `AmarokConfig::AmarokConfig()':
amarokconfig.cpp:468: error: `ItemPathList' is not a member of `KConfigSkeleton'
amarokconfig.cpp:468: error: `itemCollectionFolders' was not declared in this scope
amarokconfig.cpp:469: error: `class KConfigSkeleton::ItemPathList' has not been declared

This is due to the old version of KDE 3.3 on EL4. Needs the patch above to amarokconfig.cpp.

void-engine.cpp:22: error: visibility arg must be one of "default", "hidden", "protected" or "internal"

Again, some ancient KDE 3.3 bug that is fixed by the patch above.

genericmediadevice.cpp: In member function `QString GenericMediaDevice::buildDestination(const QString&, const MetaBundle&)':
genericmediadevice.cpp:560: error: 'const class KURL' has no member named 'pathOrURL'
genericmediadevice.cpp: In member function `virtual MediaItem* GenericMediaDevice::copyTrackToDevice(const MetaBundle&)':
genericmediadevice.cpp:660: error: 'const class KURL' has no member named 'pathOrURL'
genericmediadevice.cpp:660: error: 'const class KURL' has no member named 'pathOrURL'
genericmediadevice.cpp: In member function `void GenericMediaDevice::dirListerClear(const KURL&)':
genericmediadevice.cpp:836: error: 'const class KURL' has no member named 'pathOrURL'
genericmediadevice.cpp: In member function `void GenericMediaDevice::dirListerDeleteItem(KFileItem*)':
genericmediadevice.cpp:845: error: 'const class KURL' has no member named 'pathOrURL'

More ancient KDE 3.3 stuff — pathOrURL() doesn’t exist yet, so we use either url() or path().

Last thing : doc/ was giving me issue, so I removed it from the Makefile under TOPSUBDIRS.

Running

I kept getting errors about “no sound-engine plugins found” until I added the two paths to $KDEDIRS as below :

#!/bin/sh
 
export KDEDIRS=$HOME/lib64/kde3:$HOME:/usr
 
exec run_gapp amarok "$@"

Share and Enjoy:
  • Facebook
  • Digg
  • del.icio.us
  • Google Bookmarks
  • Blogosphere News
  • email
  • LinkedIn
  • Print
  • Reddit
  • Slashdot
  • Add to favorites
  • RSS
  • Technorati
  • PDF

ch0wned – Installing TaskCoach and all its depenencies in $HOME for EL4/EL5

ch0wned. adj. This is the state when you are a linux user and don't have root access.

Installing TaskCoach and its dependencies in $HOME for EL4/EL5

This guide assumes you’re leaving off from my previous post : http://warped.org/blog/2009/03/04/chown3d-part-2-gtk-and-glib-in-your-own-home-directory/ where you’ve setup a script called config_gapp.

Update: 2/1/2011 – Added EL5 . Irony : Spending a half-day trying to install an application that’s going to make you more productive.

Requirements

  • Python-2.5.5.tar.bz2 / python26
  • wxPython-src-2.8.11.tar.bz2
  • TaskCoach-1.2.8.tar.gz

Directions

  1. Python

    Install it like normal unless you have a modern distro that has a decent install of Python 2.5, in which case you will need to install the following things into $HOME. Not sure how to do that in Python, so you might as well have your own local version. If you have EL5, you may have the ‘python26′ package installed in which you can use that and can skip this step.

    config_gapp
    make 
    make install
  2. wxWidgets (included w/ wxPython)
    EL4 Only : Install the following patch from This Thread :

    --- wxPython/src/gtk/_gdi_wrap.cpp.orig 2009-08-08 16:26:48.000000000 +0200
    +++ wxPython/src/gtk/_gdi_wrap.cpp      2009-08-08 16:32:50.000000000 +0200
    @@ -4195,6 +4195,10 @@
         virtual wxGraphicsBrush CreateRadialGradientBrush(wxDouble , wxDouble , wxDouble , wxDouble , wxDouble ,
                                                           const wxColour &, const wxColour &)  { return wxNullGraphicsBrush; }
         virtual wxGraphicsFont CreateFont( const wxFont & , const wxColour & ) { return wxNullGraphicsFont; }
    +
    +    // patch required as explained in
    +    // http://groups.google.com/group/wxPython-users/browse_thread/thread/129ba27e2f868c3c?pli=1
    +    wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) const { return wxNullGraphicsBitmap; } 
     };

    For EL4 run :

    config_gapp --enable-unicode
    make install
    cd contrib/src/gizmos

    For EL5 using installed python26 run :

    config_gapp --enable-unicode --enable-compat24 --enable-compat26
    make install
    cd contrib/src/gizmos && make install

    If you later get errors about “the library and executable don’t match”, you may need to tweak the –enable-compat* flags above till it works.

  3. wxPython
    cd wxPython
    vim config.py
      BUILD_GLCANVAS = 0 # If true, build the contrib/glcanvas extension module
      BUILD_OGL = 0      # If true, build the contrib/ogl extension module
      BUILD_STC = 0      # If true, build the contrib/stc extension module
      BUILD_GIZMOS = 1   # Build a module for the gizmos contrib library
    # EL4 / EL5 w/ self-installed python25
    run_gapp python2.5 setup.py build_ext
    run_gapp python2.5 setup.py install  --home=$HOME
    # EL5 w/ system installed python26
    # python26 setup.py build_ext
    # python26 setup.py install --home=$HOME
  4. TaskCoach Install
    # EL4 / EL5 w/ self-install python:
    run_gapp python2.5 setup.py build
    run_gapp python2.5 setup.py install
     
    # EL5 w/ system python26
    # For system installed python26 I needed to specify the above installed libraries in my $PYTHONPATH :
    export PYTHONPATH=$LIB/lib64/python:$HOME/lib64/python/wx-2.8-gtk2-unicode/wxPython:$HOME/lib64/python/wx-2.8-gtk2-unicode/wx:$HOME/python/wx-2.8-gtk2-unicode
    python26 setup.py build
    python26 setup.py install --home=$HOME
  5. TaskCoach Wrapper Script
    # EL4 / EL5 w/ self-install python2.5
    run_gapp $HOME/bin/taskcoach.py
     
    # EL5 w/ system python26
    export PYTHONPATH=$HOME/lib64/python:$HOME/lib/python
    python26 $HOME/bin/taskcoach.py
Share and Enjoy:
  • Facebook
  • Digg
  • del.icio.us
  • Google Bookmarks
  • Blogosphere News
  • email
  • LinkedIn
  • Print
  • Reddit
  • Slashdot
  • Add to favorites
  • RSS
  • Technorati
  • PDF

Spam / Ham Learning folders for VirtualMin / Maildir-based systems

I’ve created a simple script that will monitor folders called ‘ham’ and ‘spam’ for new entries. Once found, the ‘ham’ folder will send the message to sa-learn --ham, strip off the headers, and return it to the inbox. The spam folder will simply run sa-learn --spam on the message.

Any additions are welcome!
Download : spam_folders script.

#!/usr/bin/perl -w
# spam_folder - Turns the 'ham' and 'spam' folders 
#               into training folders for spam assassin
#
# For VirtualMin
#
# Max Baker <max @warped.org> 12/17/09
# No license retained, distribute and modify freely
 
use File::Glob qw/bsd_glob/;
use File::Temp;
use File::Copy qw/copy/;
 
# Config
$sa_learn = '/usr/bin/sa-learn';
$sa       = '/usr/bin/spamassassin';
@spam  = bsd_glob("/home/*/homes/*/Maildir/.spam/cur/*");
@ham   = bsd_glob("/home/*/homes/*/Maildir/.ham/cur/*");
 
# Mark everything in spam folder that's not already marked as spam
#  (trust spamassassin header)
foreach my $s (@spam) {
    next if is_marked($s);
    system("$sa_learn --spam \"$s\" > /dev/null") 
        and warn "sa-learn errored on $s\n";
}
 
# Mark everything in ham folder as ham, strip off junk and move into
# inbox
foreach my $h (@ham) {
    # Strip off headers
    my $tmp = new File::Temp;
    my $tmp_file = $tmp->filename;
    system("$sa -d \"$h\" > $tmp_file") 
        and die "$sa errored on $h\n";
 
    # Unmark as spam
    system("$sa_learn --ham $tmp_file > /dev/null") 
        and warn "$sa_learn errored on $tmp_file\n";
 
    # Remove from ham
    unlink($h) or die "Can't remove $h. $!\n";
 
    # Move to inbox
    my $new_h = $h;
    $new_h =~ s,Maildir/.*cur/,Maildir/cur/,;
    copy($tmp_file,$new_h) or die "Can't move message to inbox. $tmpfile -> $new_h.  $!\n"
}
 
# is_marked() - Looks to see if spam assassin has already tagged this,
sub is_marked {
    my $s = shift;
    open (S,"< $s") or return;
    my $is = 0;
    while (<S>){
        if (/^X-Spam-Flag: YES/i) {
            $is = 1;
            last;
        }
    }
    close S;
    return $is;
}
</max>
Share and Enjoy:
  • Facebook
  • Digg
  • del.icio.us
  • Google Bookmarks
  • Blogosphere News
  • email
  • LinkedIn
  • Print
  • Reddit
  • Slashdot
  • Add to favorites
  • RSS
  • Technorati
  • PDF