Max Baker — A Man with a Hand

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

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.

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
  • xine-lib-1.1.18.1.tar.bz2
  • taglib-1.6.1.tar.gz
  • ffmpeg-0.5.1.tar.bz2
  • My Patch

Building

For taglib, ffmpeg, and binutils:

config_gapp
make
make install

For xine-lib :

config_gapp --without-speex
make
make install

For amarok:

config_gapp

Then apply this patch :

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

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=/usr:$HOME/lib64/kde3:$HOME
 
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

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

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.

Requirements

  • Python-2.5.5.tar.bz2
  • wxPython-src-2.8.10.1.tar.bz2
  • TaskCoach-1.0.1.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.

    config_gapp
    make 
    make install
  2. wxWidgets (included w/ wxPython)
    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; } 
     };

    Then run :

    config_gapp --enable-unicode
    make install
    cd contrib/src/gizmos && make install
  3. wxPython
    cd wxPython
    vim config.py
       # Turn off all the contrib features except gizmos
    run_gapp python2.5 setup.py build_ext
    run_gapp python2.5 setup.py install
  4. TaskCoach
    run_gapp python2.5 setup.py build
    run_gapp python2.5 setup.py install
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

Mythdora 10 / MythTV + Antec Fusion 430 VFD LCD + lircd + LCDd

Problem

This guide is how to setup the Antec Fusion 430 Case to work with Mythdora 10 and MythTV. I found a lot of guides on how to setup the drivers, but they were all out of date.

Pieces

There are three things you need to get running :

  1. lirc_imon kernel driver
  2. LCDd daemon
  3. mythlcdserver daemon

All of these things came installed w/ Myth and didn’t require any additional patching or compiling.

To see the exact device we’re working with, run lsusb :

Bus 003 Device 002: ID 15c2:ffdc SoundGraph Inc. iMON PAD Remote Controller

This is all for the “Old” imon, or 1st generation, or “FFDC” version of the LCD device.

1. LIRC lirc_imon kernel driver

yum install lirc lirc-libs

Edit /etc/modprob.conf and add this line :

options lirc_imon display_type=1

The display_type=1 option was not documented well, but that was the key in making the module work. Without it I was seeing the following in the /var/log/messages after adding debug=1 to the above. I also was missing /dev/lcd0 even though the kernel driver was loading!

Nov 22 21:18:09 localhost kernel: lirc_imon: imon_probe: found IMON device
Nov 22 21:18:09 localhost kernel: lirc_imon: imon_probe: found IR endpoint
Nov 22 21:18:09 localhost kernel: lirc_imon: imon_probe: found VFD endpoint
Nov 22 21:18:09 localhost kernel: lirc_imon: imon_probe: device has no display
Nov 22 21:18:09 localhost kernel: lirc_imon: ir_onboard_decode: 1
Nov 22 21:18:09 localhost kernel: lirc_dev: lirc_register_plugin: sample_rate: 0
Nov 22 21:18:09 localhost kernel: lirc_imon: imon_probe: Registered iMON plugin(minor:1)
Nov 22 21:18:09 localhost kernel: lirc_imon: imon_probe: iMON device on usb<3:2> initialized

That “device has no display” line is cured by the “display_type=1″ option. /var/log/messages now looks like this (with debug=1) :

Nov 22 21:21:55 localhost kernel: lirc_imon: Driver for Soundgraph iMON MultiMedia IR/VFD, v0.4
Nov 22 21:21:55 localhost kernel: lirc_imon: Venky Raju 
Nov 22 21:21:55 localhost kernel: lirc_imon: imon_probe: found IMON device
Nov 22 21:21:55 localhost kernel: lirc_imon: imon_probe: found IR endpoint
Nov 22 21:21:55 localhost kernel: lirc_imon: imon_probe: found VFD endpoint
Nov 22 21:21:55 localhost kernel: lirc_imon: ir_onboard_decode: 1
Nov 22 21:21:55 localhost kernel: lirc_imon: vfd_proto_6p: 1
Nov 22 21:21:55 localhost kernel: lirc_dev: lirc_register_plugin: sample_rate: 0
Nov 22 21:21:55 localhost kernel: lirc_imon: imon_probe: Registered iMON plugin(minor:1)
Nov 22 21:21:55 localhost kernel: lirc_imon: Registering VFD with sysfs
Nov 22 21:21:55 localhost kernel: lirc_imon: imon_probe: iMON device on usb<3:2> initialized
Nov 22 21:21:55 localhost kernel: usbcore: registered new interface driver lirc_imon

At this point you should have a /dev/lcd0 and you can test it with this command :

echo "hello world" > /dev/lcd0

OK, now that we have a working kernel driver, let’s move on to the LCD daemon

2. LCDd Daemon

  1. yum install lcdproc
  2. Edit /etc/sysconfig/lcdproc/LCD.conf to look like this :
    [server]
    Driver=imon
    Bind=127.0.0.1
    Port=13666
    
    # Sets the reporting level; defaults to 2 (warnings and errors only).
    #ReportLevel=3
    
    # Should we report to syslog instead of stderr ? Default: no
    ReportToSyslog=yes
    
    # Sets the default time in seconds to displays a screen.
    WaitTime=5
    
    # User to run as.  LCDd will drop its root priviledges,
    # if any, and run as this user instead.
    User=nobody
    
    # If yes, the the serverscreen will be rotated as a usual info screen. If no,
    # it will be a background screen, only visible when no other screens are
    # active.
    ServerScreen=no
    
    # The server will stay in the foreground if set to true.
    #Foreground=no
    
    DriverPath=/usr/lib/lcdproc/
    
    # GoodBye message: each entry represents a display line; default: builtin
    GoodBye=""
    GoodBye=""
    
    ToggleRotateKey=Enter
    PrevScreenKey=Left
    NextScreenKey=Right
    
    [menu]
    MenuKey=Escape
    EnterKey=Enter
    UpKey=Up
    DownKey=Down
    
    [imon]
    Device=/dev/lcd0
    Size=16x2
    

    Note that you want the imon driver, not imon_lcd or any other one.

  3. Boot the driver
    service LCDd restart
    tail /var/log/messages
    dmesg | tail
    

At this point you should see the output of LCDd on the VFD display. If not, rinse and repeat.

3. mythlcdserver

Follow these directions on mythtv.org to turn on the LCD settings in MythTV from the front-end in the Appearance menu. Restart the front-end and it should launch mythlcdserver. If not, you can launch mythlcdserver as the same user as the front-end.

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

Updating your BIOS in DOS w/ Window 7 / Vista using a USB Drive

Problem

You need to update your BIOS using a DOS boot disk and you’re running Windows 7, or Vista. Chances are you haven’t seen a DOS floppy, much less the floppy drive to put it in, since 1985.

Solution

I found many sites telling you how to make a USB stick bootable for installing Windows 7, but none on how to make it bootable for DOS for upgrading the BIOS or other diag.

Here is one solution I found :

  1. Download a Windows 98 Bootable CD image from http://www.allbootdisks.com/download/iso.html and burn it to a CD.
  2. Download the HP Flash Drive Format program that you will find mentioned on tons of differents sites : http://h20000.www2.hp.com/bizsupport/TechSupport/SoftwareDescription.jsp?lang=en&cc=us&swItem=MTX-UNITY-I23839&jumpid=reg_R1002_USEN and install it.
  3. Using that utility, format your flash drive with FAT32, Make it Bootable, and point the utility to your CDROM drive with the CD you made in Step 1.
  4. Copy your BIOS and flash utility to the USB drive
  5. Boot the computer using the USB stick. This may require entering a Boot Menu w/ F11 or F12, and/or changing some settings in the BIOS such as “Enable Legacy USB Support”. Chances are it will just work by putting the USB stick in and rebooting.
  6. Follow the motherboard manufacturer instructions on how to flash the BIOS.

Good luck and enjoy!
-m

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

Getting Accents / UTF8 in Mutt using Xterm with TrueType

Overview

I’m starting to adopt Unicode/UTF-8 into my world to allow for more internationalization in my projects. Someday I might play with Perl6’s UTF-8 stuff too. I also want to be able have different charactersets render correctly while using Mutt. I often get email from people in Western Europe, Eastern Europe, and SouthEast Asia, and they are all using different character sets. UTF-8 is the “universal” one.

Shows Hebrew, Chinese and Western European characters all at the same time.

Shows Hebrew, Chinese and Western European characters all at the same time.

The Components

Xterm

In order to have a nice playing Xterm with UTF-8, 256-colors and TrueType, I have to roll my own.

  1. Download the latest one from ftp://invisible-island.net/xterm/xterm.tar.gz.
  2. Compile it
    ./configure \
         --disable-desktop \
         --with-x \
         --enable-256-color \
         --enable-load-vt-fonts \
         --enable-paste64 \
         --enable-readline-mouse \
         --enable-tcap-fkeys \
         --enable-tcap-query \
         --enable-wide-chars \
         --with-Xaw3d
     
    make
    make install

    Note the crucial –enable-wide-chars needed for UTF-8. Your xterm may already be compiled with some or all of these options.

Once I have that, I create a small shell script that I call xt that launches it for me :

#!/bin/sh
# None of these have extended charsets :-(
font="Consolas"
#font="DejaVu Sans Mono"
#font="Bitstream Vera Sans Mono"
#font="luxi mono"
#font="Andale Mono"
#font="courier"
font_size=12
 
exec xterm -bg black -fg white \
    -fa "$font" \
    -fd "$font" \
    -fs $font_size \
    -j -s \
    -sb -si -sk -vb -sl 1024 -rightbar \
    +sf +dc -cr darkgreen  \
    -u8 -geometry 100x40 \
    $@ & 
exit

The important options here are -u8, -fa and -fd. This would be perfect, except that I can’t find a good mono-spaced TrueType font that has all of the character sets. More on that in the font section.

If you want support for all character sets, you can use the “fixed” font built in to X, which has a very
complete character set. I use this script inspired by Marjan Parsa instead :

#!/bin/sh
 
exec xterm -bg black -fg white \
    -j -s \
    -sb -si -sk -vb -sl 1024 -rightbar \
    +sf +dc -cr darkgreen  \
    -u8 -geometry 100x40 \
    -xrm "xterm*font:-misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1"  \
    -xrm "xterm*wideFont:-misc-fixed-medium-r-normal-ja-18-120-100-100-c-180-iso10646-1"  \
    $@ & 
exit

Fonts

You have two choices here : Fixed fonts and TrueType fonts. In my experience, the TrueType fonts look better, and the Fixed fonts have more characters supported.

TrueType

I can’t seem to find a perfect TrueType “Console” font that is fixed-width, looks great, and supports all the Unicode (UTF-8) character sets like Europe, Hebrew, Japanese, Chinese, etc. So I compromise the character set support and just get the pretty one. So far I am most happy with Microsoft’s “Consolas”. Yes, Microsoft!

Here are some good ones to check out:

If you would like to add TrueType fonts to your account / home directory locally, just create a ~/.fonts directory and then copy the .ttf fonts into it. Try these command to explore what fonts you have :

fc-list                 #  see what fonts are loaded.
xfd -fa "DejaVu Sans Mono"  #  explore a certain font

Fixed / System Fonts

I use the following two options when launching Xterm to specify the system fonts :

-xrm "xterm*font:-misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1"
-xrm "xterm*wideFont:-misc-fixed-medium-r-normal-ja-18-120-100-100-c-180-iso10646-1"

Try these commands to see what UTF-8 fonts you have and what’s in them :

xlsfonts | grep 10646
xfd -fn "-ibm-courier-medium-r-normal--0-0-0-0-m-0-iso10646-1"

This is the settings / fonts I used for the above screen shot. See also this Linux Font Tutorial.

Shell / Environment Variables

Key to all of this is that you have your LANG environment variable set correctly

Edit ~/.bashrc and make sure this line is happening :

export LANG=en_US.utf8

Remember, you will need this on two machines : the machine you are creating the X-Term window on, and the machine that you are launching mutt on. These may be the same machine, maybe not.

To get a list of the locales available use this command :

locale -a | grep -i utf

Note that these are case-sensitive, so if you have it set to en_US.UTF8 instead of en_US.utf8 you will get some wanky errors.

Mutt

Mutt works pretty well out of the box w/ UTF8. For reference see The Mutt FAQ.

I used these options in my .muttrc:

set allow_8bit
set allow_ansi=yes                  # in msgs
charset-hook us-ascii iso-8859-1
set send_charset="us-ascii:iso-8859-1"

So what this is doing is still using UTF-8 as my LANG setting and encoding for the terminal, but it’s sending my messages out as iso-8859-1. It also is assuming that anything that comes in as “us-ascii” is actually iso-8859-1.

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