Sunday, July 20, 2008
Installing TTF fonts under Debian
I am still not sure I am fully understand the inner workings of fonts under Linux; using hints from this page, here is how I recently installed RedHat Liberations fonts under Debian:
cd /tmp # using link from https://fedorahosted.org/liberation-fonts wget https://fedorahosted.org/releases/l/i/liberation-fonts/liberation-fonts-1.04.tar.gz tar -xvzf liberation-fonts-1.04.tar.gz cd liberation-fonts-1.04 # remove everything except font *.ttf files rm `ls -1 | grep -iv \.ttf$` # I prefer to install under /usr/local, but it's irrelevant mkdir -p /usr/local/share/fonts/truetype cp -pr /tmp/liberation-fonts-1.04 /usr/local/share/fonts/truetype/liberation-fonts # defoma is Perl-based; for some reason, some required Perl dependencies weren't # installed by default apt-get install libft-perl defoma-hints -c --no-question truetype \ /usr/local/share/fonts/truetype/liberation-fonts/* > /etc/defoma/hints/liberation-fonts.hints defoma-font register-all /etc/defoma/hints/liberation-fonts.hints defoma-reconfigure xset fp rehash
I just hope one day I'll understand what all of that really means....
Labels: debian, fonts, linux, redhat
Tuesday, March 18, 2008
Installing Mono with yum
Creators of Mono so far haven't made it very simple to install; precompiled binaries exist only for few not the most popular distributions like Red Hat Enterprise 4 or OpenSuSe 10.3. But even there, it is a bit of a pain to download, verify dependencies and install all required packages.
One tool suggested to help somewhat with with problem is yum. Today we will talk about what it takes to use yam on Red Hat Enterprise 4 to install latest Mono release.
Note that at any point during that process it may turn out that your system is missing some requirements which mine didn't; it is assumed you know to to locate missing packages on whatever media you are using and install them.
We begin by installing certain prerequisites of yum. All of them are python packages, and all of them should be compatible with python 2.3.4 which comes with RHE4; upgrading to a newer python version may be possible, but not recommended since yum also depends on python package rpm, which is part of RedHat distribution.
- urlgrabber.
cd /tmp
wget http://linux.duke.edu/projects/urlgrabber/download/urlgrabber-3.1.0.tar.gz
tar -xvzf urlgrabber-3.1.0.tar.gz
cd urlgrabber-3.1.0
python setup.py build
python setup.py install
- ElementTree. Using http://effbot.org/media/downloads/elementtree-1.2-20040618.tar.gz, same procedure as above;
- cElementTree.
Using http://effbot.org/media/downloads/cElementTree-1.0.5-20051216.tar.gz, same procedure as above.
cd /tmp wget http://linux.duke.edu/projects/yum/download/2.6/yum-2.6.1.tar.gz tar -xvzf yum-2.6.1.tar.gz cd yum-2.6.1 make DESTDIR=/ make DESTDIR=/ installMake sure yum module loads properly, and fix problems if there are any :
[root@myRHE4 ~]# python Python 2.3.4 (#1, Jan 9 2007, 16:40:18) [GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import yum >>>Create info about mono repository:
cd /etc/yum.repos.d wget http://www.go-mono.com/download-stable/rhel-4-i386/mono.repoYou're ready to begin installation! Here is what I installed:
yum install mono-complete yum install gtk-sharp2-complete yum install mono-basic yum install mono-debuggerOne last item - optional, but nice - it is to make sure Linux kernel can run your Mono applications "natively" (like Windows), without using "mono" every time. Following these directions, create script like that:
#! /bin/bash
if [ ! -e /proc/sys/fs/binfmt_misc/register ]; then
/sbin/modprobe binfmt_misc
# Some distributions, like Fedora Core, perform
# the following command automatically when the
# binfmt_misc module is loaded into the kernel.
# Thus, it is possible that the following line
# is not needed at all. Look at /etc/modprobe.conf
# to check whether this is applicable or not.
mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
fi
# Register support for .NET CLR binaries
if [ -e /proc/sys/fs/binfmt_misc/register ]; then
# Replace /usr/bin/mono with the correct pathname to
# the Mono CLR runtime (usually /usr/local/bin/mono
# when compiling from sources or CVS).
echo ':CLR:M::MZ::/usr/bin/mono:' > /proc/sys/fs/binfmt_misc/register
else
echo "No binfmt_misc support"
exit 1
fi
and run it as root (or append to file /etc/rc.local as suggested)
To verify your installation, use program "Hello, World!" from here :
using Gtk;
using System;
class Hello {
static void Main()
{
Application.Init ();
// Set up a button object.
Button btn = new Button ("Hello World");
// when this button is clicked, it'll run hello()
btn.Clicked += new EventHandler (hello);
Window window = new Window ("helloworld");
// when this window is deleted, it'll run delete_event()
window.DeleteEvent += delete_event;
// Add the button to the window and display everything
window.Add (btn);
window.ShowAll ();
Application.Run ();
}
// runs when the user deletes the window using the "close
// window" widget in the window frame.
static void delete_event (object obj, DeleteEventArgs args)
{
Application.Quit ();
}
// runs when the button is clicked.
static void hello (object obj, EventArgs args)
{
Console.WriteLine("Hello World");
Application.Quit ();
}
}
To compile and run:
gmcs helloworld.cs -pkg:gtk-sharp-2.0 ./helloworld.exe
Labels: linux, mono, redhat, yum
Friday, May 18, 2007
Compiling MPlayer on linux-amd64
I now have a new desktop computer (DELL Precision Workstation 390n, RH Enterprise 4) and already spent a few days setting it up in various ways. Most of the time, it has been straightforward, but setting up MPlayer was much less than trivial.
Here is an overview of the main steps required to install it (MPlayer 1.0rc1-4.1.1 © 2000-2006)
1. 64-bit vs. 32-bit problems
(This section will not apply to you if your OS is 32-bit)
MPlayer must be compiled in 32-bit mode since it invokes proprietary Windows codecs and therefore some basic 32-bit environment must be available.- Make sure gcc -m32 can be used to compile 32-bit programs (you might also want to setup gcc4, see below; note that you will not need C++ support, plain gcc will suffice);
- Create special new directory for 32-bit stuff, e.g. /usr/local32, set your $PATH and $LD_LIBRARY_PATH accordingly;
- Install 32-bit version of libpng library, by setting export CFLAGS="-m32 -O2" and executing ./configure --prefix="/usr/local32";
- Now you need 32-bit version of gtk-2 libraries. You can compile them from scratch, but in my case I only had to setup symbolic links (in /usr/local32/lib): libatk-1.0.so -> /usr/lib/libatk-1.0.so.0 libgdk_pixbuf-2.0.so -> /usr/lib/libgdk_pixbuf-2.0.so.0 libgdk-x11-2.0.so -> /usr/lib/libgdk-x11-2.0.so.0 libglib-2.0.so -> /usr/lib/libglib-2.0.so.0 libgmodule-2.0.so -> /usr/lib/libgmodule-2.0.so.0 libgobject-2.0.so -> /usr/lib/libgobject-2.0.so.0 libgtk-x11-2.0.so -> /usr/lib/libgtk-x11-2.0.so.0 libpango-1.0.so -> /usr/lib/libpango-1.0.so.0 libpangox-1.0.so -> /usr/lib/libpangox-1.0.so.0 libpangoxft-1.0.so -> /usr/lib/libpangoxft-1.0.so.0
- Download appropriate "Binary Codec Packages", e.g. "essential" and "win32codecs" from http://www.mplayerhq.hu/MPlayer/releases/codecs/ , and install them under /usr/local32/lib/codecs;
- Download "Skins" (at least one) from main download page http://www.mplayerhq.hu/design7/dload.html, and install under /usr/local32/share/mplayer/skins, and make symbolic link "default" to default skin, e.g. default -> Blue
- Download one bitmap font from here and install per documentation, which is to say, unpack it under /usr/local32/share/mplayer and make symbolic link "font": /usr/local32/share/mplayer/font -> font-arial-14-iso-8859-1
- Install a true type font in directory ~/.mplayer and make a symbolic link subfont.ttf, e.g: ~/.mplayer/subfont.ttf -> tahoma.ttf
- unset CFLAGS (or open a new shell); otherwise, you will disregard special compilation flags used by mplayer;
- configure with the command: ./configure --enable-gui --cc='gcc4 -m32' --target=i386-linux --with-extraincdir=/usr/local32/include --with-extralibdir=/usr/local32/lib --prefix="/usr/local32" (using gcc4 is nor relevant to the crash, but was helpful with some other problems which appeared with gcc3. Versions used: gcc3 = 3.4.6, gcc4 = 4.1.1)
- in a separate directory, configure as above but with additional option --enable-debug. and compile only one object: libvo/sub.o (you can run make to compile everything, there is no harm)
- Copy libvo/sub.o from 2-nd directory to the 1-st and re-build MPlayer in the 1-st directory;
- Now execute "make install" in the 1-st directory (with appropriate permissions) and enjoy!
- Standard mplayer help suggests to use Command Line Option -slang to select subtitles, e.g. -slang en. In fact, for some reason this is not very reliable. It is in fact much more convenient to use option -sid
. This way, trying sequentially -sid 0, -sid 1, -sid 2, ... you will find what you need. E.g., most often this is what you'd use to play DVD: gmplayer -sid 0 -fs dvd://1 - Perhaps it is worth looking at new project Democracy (to be renamed to Miro), which is a multi-platform universal media player, implemented in Python and using Pyrex, xine and some other packages.
Labels: 64-bit, mplayer, redhat
