Debian Codegraph @

Construct

raw ◀ ▶
1 Debian patch touch this file
1 #!/usr/bin/cons
2 #
3 # Atom-4 build script. Requires cons, in case you haven't clued in yet.
4 #
5 # Configurable parameters: (run with 'cons $VARNAME=$VALUE ...')
6 #
7 # BINDIR=$dir Where to install Atom-4 binaries
8 # COMPILER=$binary Compiler to use (default: g++)
9 # DATADIR=$dir Where data files should be installed
10 # MANDIR=$dir Directory to store manpages
11 # REALDATADIR=$dir Where Atom-4 should look for data files (default
12 # is $DATADIR; this option is mainly for packaging
13 # builds where the build-time dir is different from
14 # the run-time dir)
15 # PROGLIBPATH=$dir Path to prog/lib libraries (default: #../lib)
16 # X11LIBPATH=$dir Where to find X11 libraries (default: /usr/X11R6/lib)
17 # DEBUG=1 Build with debugging symbols
18 # OPTIMIZE=$n Optimize to level $n. Set to 0 to disable.
19 # (Default: 2)
20 # PROFILE=1 Build with profiling code (for development use only)
21 #
22 # <obligatory Cons promotion>
23 # I *love* cons. Make is just an idiotic overly-bandaged contraption way past
24 # its lifetime. Everyone should use Cons for all new products! It will save
25 # you countless hours, days, weeks, of endless build frustrations. I swear
26 # I'll never, ever, use Make again. It's about time it died a long overdue
27 # death.
28 # </obligatory Cons promotion>
29 #
30 # $Id: Construct,v 1.16 2003/04/15 13:47:09 hsteoh Exp hsteoh $
31 #
32
33 #
34 # Useful routines
35 #
36
37 # abspath $relpath
38 sub abspath {
39 my $path=shift;
40 my $pwd=`pwd`;
41 chomp $pwd;
42 $path=~s#^#$pwd/# unless $path=~m#^/#;
43 return $path;
44 }
45
46 #
47 # Cons setup
48 #
49
50 # Chdir while processing subdir Conscripts
51 Conscript_chdir 1;
52
53 Export qw(
54 BINDIR DATADIR INCDIR LIBDIR MANDIR OBJDIR
55 PROGLIB PROGLIBPATH NCURSESLIB X11LIB X11LIBPATH
56 CONS COMPILER CFLAGS
57 );
58
59
60 # External configuration (can be overridden by running Cons with the
61 # appropriate X=Y W=Z ... options)
62 $DATADIR = $ARG{DATADIR} || '#data';
63 $OPTIMIZE = defined $ARG{OPTIMIZE} ? $ARG{OPTIMIZE} : 2;
64 $PROFILE = $ARG{PROFILE} || 0;
65
66 # Shared files
67 $BINDIR = $ARG{BINDIR} || '#bin';
68 $INCDIR = '#include';
69 $MANDIR = $ARG{MANDIR} || '#man';
70 $LIBDIR = '#lib';
71 $OBJDIR = '#obj';
72
73 # Locations of required libs
74 $PROGLIB = '-lt++';
75 $PROGLIBPATH = $ARG{PROGLIBPATH} || '#../lib';
76 $NCURSESLIB = '-lpanel -lncurses';
77 $X11LIB = '-lX11 -lXpm';
78 $X11LIBPATH = $ARG{X11LIBPATH} || '/usr/X11R6/lib';
79
80 # Global configuration
81 $COMPILER = $ARG{COMPILER} || 'g++';
82 $REALDATADIR = $ARG{REALDATADIR} || abspath(DirPath($DATADIR));
83 $CFLAGS = "-pedantic -DDATADIR=\\\"$REALDATADIR\\\"";
84 $CFLAGS .= " -g3" if $ARG{DEBUG};
85 $CFLAGS .= " -O$OPTIMIZE" if $OPTIMIZE;
86 $CFLAGS .= " -pg -DPROFILE" if $PROFILE;
87
88 # Local configuration
89 $INCPATH = "$INCDIR:$PROGLIBPATH/include";
90 $LIBPATH = "$PROGLIBPATH/lib:$LIBDIR:$X11LIBPATH";
•91 $LIBS = "$PROGLIB -lxatom4 -latom4 $NCURSESLIB $X11LIB";
92 $LIBS .= " -pg" if $PROFILE;
93
94 $CONS = new cons(
95 CC => $COMPILER,
96 CFLAGS => $CFLAGS,
97 CPPPATH => $INCPATH,
98 LIBS => $LIBS,
99 LIBPATH => $LIBPATH
100 );
101
102 # Build tree
103 Build qw(
104 engine/Conscript
105 general/Conscript
106 ncurses/Conscript
107 net/Conscript
108 x/Conscript
109 );
110
111
112 #
113 # Headers
114 #
115
116 Install $CONS $INCDIR,
117 'interface.h';
118
119 #
120 # Main program
121 #
122
123 Install $CONS $BINDIR, 'atom4';
124 Program $CONS 'atom4',
125 'atom4.cc',
126 'interface.cc',
127 "$OBJDIR/event.o",
128 "$OBJDIR/textui.o";
129
130 #
131 # Auxilliary stuff
132 #
133
134 Install $CONS "$MANDIR/man6", 'atom4.6';
135