#!/usr/bin/cons # # Atom-4 build script. Requires cons, in case you haven't clued in yet. # # Configurable parameters: (run with 'cons $VARNAME=$VALUE ...') # # BINDIR=$dir Where to install Atom-4 binaries # COMPILER=$binary Compiler to use (default: g++) # DATADIR=$dir Where data files should be installed # MANDIR=$dir Directory to store manpages # REALDATADIR=$dir Where Atom-4 should look for data files (default # is $DATADIR; this option is mainly for packaging # builds where the build-time dir is different from # the run-time dir) # PROGLIBPATH=$dir Path to prog/lib libraries (default: #../lib) # X11LIBPATH=$dir Where to find X11 libraries (default: /usr/X11R6/lib) # DEBUG=1 Build with debugging symbols # OPTIMIZE=$n Optimize to level $n. Set to 0 to disable. # (Default: 2) # PROFILE=1 Build with profiling code (for development use only) # # # I *love* cons. Make is just an idiotic overly-bandaged contraption way past # its lifetime. Everyone should use Cons for all new products! It will save # you countless hours, days, weeks, of endless build frustrations. I swear # I'll never, ever, use Make again. It's about time it died a long overdue # death. # # # $Id: Construct,v 1.16 2003/04/15 13:47:09 hsteoh Exp hsteoh $ # # # Useful routines # # abspath $relpath sub abspath { my $path=shift; my $pwd=`pwd`; chomp $pwd; $path=~s#^#$pwd/# unless $path=~m#^/#; return $path; } # # Cons setup # # Chdir while processing subdir Conscripts Conscript_chdir 1; Export qw( BINDIR DATADIR INCDIR LIBDIR MANDIR OBJDIR PROGLIB PROGLIBPATH NCURSESLIB X11LIB X11LIBPATH CONS COMPILER CFLAGS ); # External configuration (can be overridden by running Cons with the # appropriate X=Y W=Z ... options) $DATADIR = $ARG{DATADIR} || '#data'; $OPTIMIZE = defined $ARG{OPTIMIZE} ? $ARG{OPTIMIZE} : 2; $PROFILE = $ARG{PROFILE} || 0; # Shared files $BINDIR = $ARG{BINDIR} || '#bin'; $INCDIR = '#include'; $MANDIR = $ARG{MANDIR} || '#man'; $LIBDIR = '#lib'; $OBJDIR = '#obj'; # Locations of required libs $PROGLIB = '-lt++'; $PROGLIBPATH = $ARG{PROGLIBPATH} || '#../lib'; $NCURSESLIB = '-lpanel -lncurses'; $X11LIB = '-lX11 -lXpm'; $X11LIBPATH = $ARG{X11LIBPATH} || '/usr/X11R6/lib'; # Global configuration $COMPILER = $ARG{COMPILER} || 'g++'; $REALDATADIR = $ARG{REALDATADIR} || abspath(DirPath($DATADIR)); $CFLAGS = "-pedantic -DDATADIR=\\\"$REALDATADIR\\\""; $CFLAGS .= " -g3" if $ARG{DEBUG}; $CFLAGS .= " -O$OPTIMIZE" if $OPTIMIZE; $CFLAGS .= " -pg -DPROFILE" if $PROFILE; # Local configuration $INCPATH = "$INCDIR:$PROGLIBPATH/include"; $LIBPATH = "$PROGLIBPATH/lib:$LIBDIR:$X11LIBPATH"; $LIBS = "$PROGLIB -lxatom4 -latom4 $NCURSESLIB $X11LIB"; $LIBS .= " -pg" if $PROFILE; $CONS = new cons( CC => $COMPILER, CFLAGS => $CFLAGS, CPPPATH => $INCPATH, LIBS => $LIBS, LIBPATH => $LIBPATH ); # Build tree Build qw( engine/Conscript general/Conscript ncurses/Conscript net/Conscript x/Conscript ); # # Headers # Install $CONS $INCDIR, 'interface.h'; # # Main program # Install $CONS $BINDIR, 'atom4'; Program $CONS 'atom4', 'atom4.cc', 'interface.cc', "$OBJDIR/event.o", "$OBJDIR/textui.o"; # # Auxilliary stuff # Install $CONS "$MANDIR/man6", 'atom4.6';