Showing posts with label 64-bit linux. Show all posts
Showing posts with label 64-bit linux. Show all posts

Wednesday, August 19, 2009

Better Flash Compatibility for 64-bit Linux

It's pretty easy to install Adobe Flash in Ubuntu, but unfortunately the version that's used by default has some bugs on 64-bit systems and crashes often (at least on my system). The problem is that Adobe hasn't officially released a 64-bit version of the plugin for Linux, and something called NSPluginWrapper has to be used to get it to play nice.

Fortunately, Adobe has been working on a 64-bit version for some time, and you can get the pre-release at their Adobe Labs site. The trick is to replace the old implementation with this one. Below is a little script that will do it all for you. Follow along and run the commands manually, or save it and run as root (no arguments required).
#!/bin/bash

# This URL points to the most current version of the plugin as of 8/20/2009. Check the link at the bottom of http://labs.adobe.com/downloads/flashplayer10.html for the latest version and replace it here.
PLUGIN_URL=http://download.macromedia.com/pub/labs/flashplayer10/libflashplayer-10.0.32.18.linux-x86_64.so.tar.gz
PLUGIN_DIR=/usr/lib/mozilla/plugins

if [ "`whoami`" != "root" ]; then
echo "You must run this script as root (sudo). Nothing will be done."
exit
fi

# First, we must remove the default flash plugin if its already installed.
# If you installed the plugin manually make sure you remove it manually prior to running this script. You can do this by deleting it from /usr/lib/mozilla/plugins/
echo "Removing old Flash plugins..."
echo "-----------------------------"
apt-get --assume-yes --quiet remove flashplugin-nonfree flashplugin-installer
echo "-----------------------------"

# Now lets download and extract the plugin to the correct location in one fell swoop.
echo "Downloading and installing plugin..."
echo "-----------------------------"
wget --output-document=- $PLUGIN_URL | tar --extract --gunzip --directory $PLUGIN_DIR
echo "-----------------------------"

echo "Please restart all instances of Firefox for changes to take effect."
If you decide to install a different version of flash, remember to delete this plugin. Simply remove /usr/lib/mozilla/plugins/libflashplayer.so.

Thursday, July 16, 2009

Getting the Palm Mojo SDK to work on 64-bit linux

This is my first post, and I hope you will find it helpful.

Today, Palm released the Mojo SDK to the public. Awesome! I've been meaning to try developing for a mobile platform and have been put off by the iPhone's price and the fact that it only runs on a Mac. Palm's SDK claims to be cross-platform, but the .deb package it has available for linux is built for i386 only. I have Ubuntu 9.04 (Jaunty) on my machine in x86-64 mode so I was really bummed when I wasnt allowed to install the package.

Determined to get it working I dug around in the package (any .deb can be opened as a .tar.gz) and found that most tools are just scripts, which shouldnt care about the platform they run under. Now how do I fool the installer to use the package they gave me? It turns out there is a file in each .deb that specifies which architecture the package is for. If you look inside the .deb you will find a file called control.tar.gz, and in that archive you will find a file called "control" which is just a list of properties, one of which is "Architecture". Change it from "i386" to "all" and you're all set!

Since the file is kind of deep in the .deb, its not trivial to edit the "control" file, so here is a script that will do it for you:

#!/bin/bash
packageName=$1
tempDir=`mktemp -d`
architecture="all"

# extract the files from the original package
mkdir $tempDir/DEBIAN
ar p $packageName control.tar.gz | tar -xz --directory $tempDir/DEBIAN
ar p $packageName data.tar.gz | tar -xz --directory $tempDir

# replace stuff
if [ -n "$controlFile" ]; then
cp $controlFile $tempDir/DEBIAN/control
fi
if [ -n "$architecture" ]; then
sed "s/Architecture:.*/Architecture: $architecture/g" < $tempDir/DEBIAN/control > $tempDir/DEBIAN/control2
mv $tempDir/DEBIAN/control2 $tempDir/DEBIAN/control
fi

# rebuild the package
dpkg --build $tempDir $packageName

# get rid of temporary working files
rm -rf $tempDir
To use it, save as debAllArch.sh and run it from the terminal:
./debAllArch.sh mojo.deb