How to build Xephem-3.7.1 on amd64

I just installed the latest Xephem-3.7.1 onto my debian amd64. The problem with the default deb package in the Debian repository is that the version is quite old, at 3.4.5. Unfortunately, building Xephem-3.7.1 isn't quite straightforward; here's a small howto to craft the binaries (no package, unfortunately) :

* download the source from the Xephem site
* unpack the tgz tarball
* create and run this script in the ./xephem-3.7.1 directory :

# Fix gcc flags
for i in libastro/Makefile libip/Makefile \ 
 libjpegd/Makefile liblilxml/Makefile GUI/xephem/Makefile ; 
  echo "Fixing CFLAGS in ${i}"
  sed -e "s~^CFLAGS[ ]*=\(.*\)-O2\(.*\)~CFLAGS= \1 \2 \ 
  ${CFLAGS}~" -i ${i} || die "sed failed"
sed -e 's~^CFLAGS[ ]*=\(.*\)$(CLDFLAGS)\(.*\)~CFLAGS=\1 \2~' \ 
  -i GUI/xephem/Makefile

* Remove the ./xephem-3.7.1/libXm/linux86 directory, as it contains 32bit libraries
* Create a symlink ./xephem-3.7.1/libXm/linux86 towards /usr/lib
* Install the lesstif2 and lesstif2-dev packages
* Build as described in the INSTALL file

That's it ! Copy your binary to /usr/bin, and you're ready to rumble.

Anonymous Wed, 01/24/2007 - 06:59

Tried to execute above script in a bash shell but trip up in line 8 with:

line 8: die: command not found

kristof Wed, 01/24/2007 - 09:30

In reply to by Anonymous

You could replace 'die' with an 'exit 1'. Your script will continue to fail, however, cause your sed command onthe same line is failing.

Denebe Sat, 01/27/2007 - 23:41


I am a linux beginner. My OS is opensuse 10.2 x86_64, and I am trying to install xephem 3.7.2.
I wrote your srcipt, I saved it to "test", and I made it executable in xephem directory.
After I have a mistake answer:

thierry@linux-k2h5:~/Desktop/xephem-3.7.2> ./test
./test: line 4: syntax error near unexpected token `libjpegd/Makefile'
./test: line 4: ` libjpegd/Makefile liblilxml/Makefile GUI/xephem/Makefile ; '

Can you help me to find out what's wrong ?

kristof Sun, 01/28/2007 - 16:12

In reply to by Denebe

Looks like bash doesn't recognize the '\' character on the end of line 3. In fact, this character tells bash that the next line is part of the current line. So line 3 and 4 are one line. Try to remove all '\' characters, and place the following lines on one line.

denebe Wed, 01/31/2007 - 12:55

In reply to by kristof


I din't write your script, I only used copy and paste. For a mysterious reason (for me), there was a dot at the end of the 4th line. Your answer show me my mystake. Now the srcipt work fine, thank you.