Compile mp3info and install from source

Aug 02, '10 07:30:00AM

Contributed by: Anonymous

Sure you could install mp3info with MacPorts, but if you prefer to build it manually -- this hint is for you.

From the developer page:

MP3Info is a little utility used to read and modify the ID3 tags of MP3 files. MP3Info can also display various technical aspects of an MP3 file including playing time, bit-rate, sampling frequency and other attributes in a pre-defined or user-specifiable output format.

This process requires the Apple Developer Tools to compile the source code.

Copy and paste the following code into a text document named 'compilemp3info'; make it executable; chmod 755 compilemp3info, then run it by typing ./compilemp3info. The code will download the mp3info source code, patch the code with the patch from MacPorts, then build and install.

#!/bin/bash

# create temporary build directory (optional)
mkdir BUILD
cd BUILD

# download mp3info src
curl -O ftp://ftp.ibiblio.org/pub/linux/apps/sound/mp3-utils/mp3info/mp3info-0.8.5a.tgz

# download MacPorts patch
curl -O http://mirror.lug.udel.edu/pub/macports/dpupdate/dports/audio/mp3info/files/patch-mp3tech.c.diff

# create Makefile patch (optional)
# this just removes all the GTK GUI build stuff that won't compile in Mac OS X
cat > patch-Makefile.diff <<'EOF'
--- Makefile-orig  2010-07-29 12:44:04.000000000 -0400
+++ Makefile  2010-07-29 12:43:47.000000000 -0400
@@ -47,7 +47,7 @@
 CC = gcc
 CFLAGS = -g -O2 -Wall
 
-all: mp3info gmp3info doc
+all: mp3info doc
 
 doc: mp3info.txt
 
@@ -77,7 +77,7 @@
   $(STRIP) gmp3info
   $(INSTALL) gmp3info $(bindir)/gmp3info
 
-install: install-mp3info install-gmp3info
+install: install-mp3info
 
 uninstall:
   rm -f $(bindir)/mp3info
EOF

# decompress
tar -zxvf mp3info-0.8.5a.tgz
cd mp3info-0.8.5a

# patch file
patch -i ../patch-mp3tech.c.diff
patch -i ../patch-Makefile.diff

# make and install
make         # ignore errors that appear
sudo make install  # install into /usr/local/bin



[crarko adds: I only partially tested this. This is a nice little script that could be adapted to other projects if you wish to modify it. It was modified to use curl instead of wget since curl is installed by default in the system. I've mirrored the script code here. If it opens in your browser window just do a Save As... ]

Comments (7)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20100729102046991