1XCOMM $XTermId: Imakefile,v 1.123 2019/11/02 21:50:51 tom Exp $ 2XCOMM 3XCOMM Attention xterm porters 4XCOMM 5XCOMM 6XCOMM Xterm assumes that bcopy can handle overlapping arguments. If your 7XCOMM bcopy (or memcpy) cannot, write a routine called bcopy and link it in 8XCOMM or add -Dbcopy=mybcopy to the DEFINES list below. 9XCOMM 10 11/* Uncomment SCROLLBAR_RIGHT if you want the scroll bar to be on the right */ 12SCROLLBAR_RIGHT = -DSCROLLBAR_RIGHT 13 14/* Define UTF8support to compile-in support for UTF-8 */ 15#define UTF8support 16 17/* 18 * setgid mode works for systems that do not require setuid to open pty. 19 * 20 * This feature could also be applied to FreeBSD, but requires the installer 21 * to define a "utmp" group as well as chgrp the utmp file to match. 22 * 23 * Note: InstallXtermSetUID is always defined; InstallXtermSetGID is defined 24 * in newer imake configurations. 25 */ 26#if !defined(InstallXtermSetGID) && !InstallXtermSetUID 27#if defined(OpenBSDArchitecture) || \ 28 (defined(LinuxArchitecture) && \ 29 (LinuxCLibMajorVersion == 6)) 30#define InstallXtermSetGID YES 31#endif 32#endif 33 34/* 35 * Override the set uid/gid flags to use the utempter library. 36 */ 37#if defined(UseUtempter) 38#undef InstallXtermSetUID /* imake sets this */ 39#undef InstallXtermSetGID /* we set this */ 40#define InstallXtermSetUID NO 41#define InstallXtermSetGID NO 42 UTMPLIB = -lutempter 43#endif 44 45/* 46 * Fixes to allow compile with X11R5, etc. 47 */ 48#ifndef InstGidFlags 49#define InstGidFlags -m 2755 -g utmp 50#endif 51 52#ifndef InstUidFlags 53#define InstUidFlags -m 4711 54#endif 55 56#ifndef XkbClientDefines 57#define XkbClientDefines /**/ 58#endif 59 60#ifndef InstallXtermSetUID 61#define InstallXtermSetUID NO 62#endif 63 64#ifndef InstallXtermSetGID 65#define InstallXtermSetGID NO 66#endif 67 68#ifndef XkbClientDepLibs 69#define XkbClientDepLibs /**/ 70#endif 71 72#ifndef XkbClientLibs 73#define XkbClientLibs /**/ 74#endif 75 76/* This must come before setting DEFINES */ 77#if InstallXtermSetGID 78CSGIDFLAGS = -DUSE_UTMP_SETGID 79INSTSETIDFLAGS = InstGidFlags 80#elif InstallXtermSetUID 81INSTSETIDFLAGS = InstUidFlags 82#else 83INSTSETIDFLAGS = NullParameter 84#endif 85 86/* 87 * Compensate for broken imake configuration. 88 */ 89#ifdef LinuxGnuSourceDefines 90# ifdef UseInstalled 91 IMAKEDEFINES = -D_DEFAULT_SOURCE -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600 92# endif 93#endif 94 95#ifndef SpecialCObjectRule 96#define SpecialCObjectRule(module,ignore,defines) \ 97module.o: ; $(CC) -c defines $(CFLAGS) module.c 98#endif 99 100#ifndef ProgramTargetName 101#define ProgramTargetName(program) program 102#endif 103 104/* 105 * add -DWTMP and -DLASTLOG if you want them; make sure that bcopy can 106 * handle overlapping copies before using it. 107 */ 108#if SetTtyGroup /* turn on in config/machine.cf */ 109 TTYGROUPDEF = -DUSE_TTY_GROUP 110#endif 111#ifdef UsePUCCPtyd /* turn on in config/site.def */ 112 PUCCPTYDDEF = -DPUCC_PTYD /* does not need to be setuid */ 113 PTYLIB = -lpucc 114#endif 115 116#if defined(NetBSDArchitecture) || \ 117 defined(OpenBSDArchitecture) || \ 118 defined(FreeBSDArchitecture) || \ 119 (defined(LinuxArchitecture) && \ 120 (LinuxCLibMajorVersion == 6) && (LinuxCLibMinorVersion < 1)) 121 PTYLIB = -lutil 122#endif 123 124#ifdef DarwinArchitecture 125/* dyld can deadlock if a signal comes in when it is looking up a symbol */ 126 LOCAL_LDFLAGS = -Wl,-bind_at_load 127#endif 128 129 OSMAJORVERSION = OSMajorVersion 130 OSMINORVERSION = OSMinorVersion 131 132/* none of these can be expected to use termcap unless emulated by terminfo */ 133#if defined(NTOArchitecture) || \ 134 defined(OpenBSDArchitecture) || \ 135 defined(SGIArchitecture) || \ 136 defined(SunArchitecture) || \ 137 defined(NetBSDArchitecture) || \ 138 defined(OpenBSDArchitecture) || \ 139 defined(FreeBSDArchitecture) || \ 140 defined(LinuxArchitecture) 141TERMCAPDEFINES=-DUSE_TERMINFO -DHAVE_TIGETSTR -DHAVE_TERM_H 142#endif 143 144#if !defined(OS2Architecture) && !defined(__GNU__) && !defined(Minix3Architecture) 145#if defined(UseUtempter) 146 UTMPDEF = -DUSE_UTEMPTER 147#else 148 UTMPDEF = -DUTMP 149#endif 150#endif 151 152#ifdef UTF8support 153 UTF8_OPTION = -DOPT_WIDE_CHARS -DOPT_LUIT_PROG 154 UTF8SRC = charclass.c precompose.c wcwidth.c xutf8.c 155 UTF8OBJ = charclass.o precompose.o wcwidth.o xutf8.o 156#endif 157#if BuildXftLibrary 158#define XRenderSupport 159#endif 160#ifdef XRenderSupport 161 XRFDEF = -DXRENDERFONT -DXFREE86_FT2 162 XRFLIBS = XftClientLibs 163 XRFDEPLIBS = XftClientDepLibs 164 XRFINCLUDES = $(XFTINCLUDES) 165#endif 166#if !HasPutenv 167 PUTENVDEF = -DNOPUTENV 168#endif 169#ifdef RegisXTerm 170 SIXELDEF = -DOPT_REGIS_GRAPHICS=1 171#endif 172#ifdef SixelXTerm 173 SIXELDEF = -DOPT_SIXEL_GRAPHICS=1 174#endif 175#ifdef TraceXTerm 176 TRACEDEF = -DOPT_TRACE=1 177#endif 178 MAIN_DEFINES = $(UTMPDEF) $(TTYGROUPDEF) $(PUCCPTYDDEF) $(CSGIDFLAGS) \ 179 -DOSMAJORVERSION=$(OSMAJORVERSION) \ 180 -DOSMINORVERSION=$(OSMINORVERSION) 181 MISC_DEFINES = /* -DALLOWLOGGING -DALLOWLOGFILEEXEC */ 182 XKB_DEFINES = XkbClientDefines 183 PATH_DEFINES = -DPROJECTROOT=$(PROJECTROOT) 184 DEFINES = $(XKB_DEFINES) $(TERMCAPDEFINES) $(FEATURE_DEFINES) $(SCROLLBAR_RIGHT) $(UTF8_OPTION) $(XRFDEF) $(PATH_DEFINES) $(PUTENVDEF) $(IMAKEDEFINES) $(SIXELDEF) $(TRACEDEF) 185 INCLUDES = -I. $(XRFINCLUDES) 186 187 MAINSRC = main.c 188 MAINOBJ = main.o 189 DUMPSSRC = html.c svg.c 190 DUMPSOBJ = html.o svg.o 191#ifdef RegisXTerm 192 SIXELSRC = graphics_regis.c 193 SIXELOBJ = graphics_regis.o 194#endif 195#ifdef SixelXTerm 196 SIXELSRC = graphics_sixel.c 197 SIXELOBJ = graphics_sixel.o 198#endif 199#ifdef TraceXTerm 200 TRACESRC = trace.c 201 TRACEOBJ = trace.o 202#endif 203 SRCS1 = button.c cachedGCs.c charproc.c charsets.c cursor.c \ 204 data.c doublechr.c fontutils.c input.c \ 205 linedata.c menu.c misc.c print.c ptydata.c scrollback.c \ 206 screen.c scrollbar.c tabs.c util.c version.c xstrings.c \ 207 xtermcap.c TekPrsTbl.c Tekproc.c VTPrsTbl.c \ 208 $(MAINSRC) $(EXTRASRC) $(UTF8SRC) $(SIXELSRC) $(TRACESRC) $(DUMPSSRC) 209 OBJS1 = button.o cachedGCs.o charproc.o charsets.o cursor.o \ 210 data.o doublechr.o fontutils.o input.o \ 211 linedata.o menu.o misc.o print.o ptydata.o scrollback.o \ 212 screen.o scrollbar.o tabs.o util.o version.o xstrings.o \ 213 xtermcap.o TekPrsTbl.o Tekproc.o VTPrsTbl.o \ 214 $(MAINOBJ) $(EXTRAOBJ) $(UTF8OBJ) $(SIXELOBJ) $(TRACEOBJ) $(DUMPSOBJ) 215 SRCS2 = resize.c version.c xstrings.c 216 OBJS2 = resize.o version.o xstrings.o 217 SRCS = $(SRCS1) $(SRCS2) 218 OBJS = $(OBJS1) $(OBJS2) 219 PROGRAMS = ProgramTargetName(resize) ProgramTargetName(xterm) 220 DEPLIBS1 = XkbClientDepLibs XawClientDepLibs $(XRFDEPLIBS) 221 DEPLIBS2 = 222 223#ifndef TermcapLibrary 224#if SystemV && !defined(MacIIArchitecture) 225#if defined(CrayArchitecture) || \ 226 (defined(HPArchitecture) && (OSMajorVersion < 10)) || \ 227 defined(RsArchitecture) || \ 228 defined(SCOArchitecture) || \ 229 defined(USLArchitecture) 230#define TermcapLibrary -lcurses /* special cases of System V */ 231#else 232#define TermcapLibrary -ltermlib /* usually in here */ 233#endif 234#else 235#define TermcapLibrary -ltermcap /* bsd puts it here */ 236#endif 237#endif 238 239 TERMCAPLIB = TermcapLibrary 240 241AllTarget($(PROGRAMS)) 242 243VTPARSE_H = VTparse.h VTparse.hin 244TEKPARSE_H = Tekparse.h Tekparse.hin 245 246VTPARSE_C = VTparse.h VTparse.cin 247TEKPARSE_C = Tekparse.h Tekparse.cin 248 249.SUFFIXES : .def .cin .hin 250.def.cin : 251 awk '/^CASE_/{printf "{ %d, \"%s\" },\n", n++, $$1; }' < $< >$@ 252.def.hin : 253 awk '/^CASE_/{printf "#define %s %d\n", $$1, n++}' < $< >$@ 254 255SpecialCObjectRule(main,$(_NOOP_),$(MAIN_DEFINES)) 256SpecialCObjectRule(menu,$(_NOOP_),$(MISC_DEFINES)) 257SpecialCObjectRule(misc,$(VTPARSE_H),$(MISC_DEFINES)) 258SpecialCObjectRule(VTPrsTbl,$(VTPARSE_H),$(MISC_DEFINES)) 259SpecialCObjectRule(charproc,$(VTPARSE_H),$(MISC_DEFINES)) 260SpecialCObjectRule(data,$(_NOOP_),$(MISC_DEFINES)) 261SpecialCObjectRule(TekPrsTbl,$(TEKPARSE_H),$(MISC_DEFINES)) 262SpecialCObjectRule(TekProc,$(TEKPARSE_H),$(MISC_DEFINES)) 263SpecialCObjectRule(trace,$(VTPARSE_C) $(TEKPARSE_C),$(MISC_DEFINES)) 264 265#if InstallXtermSetUID 266SetUIDProgramTarget(xterm,$(OBJS1),$(DEPLIBS1),$(XRFLIBS) XkbClientLibs XawClientLibs,$(TERMCAPLIB) $(PTYLIB)) 267#else 268NormalProgramTarget(xterm,$(OBJS1),$(DEPLIBS1),$(XRFLIBS) XkbClientLibs XawClientLibs,$(TERMCAPLIB) $(UTMPLIB) $(PTYLIB)) 269#endif 270 271#if defined(OpenBSDArchitecture) || defined(MirBSDArchitecture) 272/* On OpenBSD xterm is now setgid utmp */ 273INSTUIDFLAGS= -m 2555 -g utmp 274#endif 275 276#if InstallXtermSetUID && defined(SunArchitecture) && HasSharedLibraries && (OSMajorVersion < 5) 277#if AlternateUsrLibDir 278#if ((OSMajorVersion == 4) && (OSMinorVersion >= 1)) 279LDOVERRIDE = -L$(DESTDIR)$(USRLIBDIR) 280#else 281#if HasGcc 282LDOVERRIDE = -static -L$(DESTDIR)$(USRLIBDIR) 283#else 284LDOVERRIDE = -Bstatic -L$(DESTDIR)$(USRLIBDIR) 285LDRESUME = -Bdynamic 286#endif 287#endif 288#endif 289install:: 290 MakeDir($(DESTDIR)$(BINDIR)) 291 RemoveFile(ProgramTargetName(xterm.inst)) 292 LinkRule(ProgramTargetName(xterm.inst),$(CDEBUGFLAGS) $(CCOPTIONS) 293 $(EXTRA_LDOPTIONS) $(LOCAL_LDFLAGS),$(OBJS1),$(LDOVERRIDE) 294 $(XRFLIBS) XawClientLibs $(LDRESUME) $(LDLIBS) $(TERMCAPLIB) 295 $(PTYLIB)) 296 $(INSTALL) -c $(INSTPGMFLAGS) $(INSTSETIDFLAGS) ProgramTargetName(xterm.inst) $(DESTDIR)$(BINDIR)/ProgramTargetName(xterm) 297 RemoveFile(ProgramTargetName(xterm.inst)) 298#else 299InstallProgramWithFlags(xterm,$(BINDIR),$(INSTSETIDFLAGS)) 300#endif 301 302InstallNamedProg(uxterm,uxterm,$(BINDIR)) 303 304/* 305 * Link with the termcap library if USE_TERMCAP is defined in resize.c 306 */ 307#if defined(NTOArchitecture) || \ 308 defined(LinuxArchitecture) || \ 309 defined(OpenBSDArchitecture) || \ 310 defined(SGIArchitecture) || \ 311 defined(SunArchitecture) 312NormalProgramTarget(resize,$(OBJS2),$(DEPLIBS2),NullParameter,NullParameter) 313#else 314NormalProgramTarget(resize,$(OBJS2),$(DEPLIBS2),NullParameter,$(TERMCAPLIB)) 315#endif 316 317InstallProgramWithFlags(resize,$(BINDIR),NullParameter) 318 319/* 320 * termcap is a special name that does not install correctly with 321 * InstallNamedNonExec() 322 */ 323install:: 324 MakeDir($(DESTDIR)$(LIBDIR)/etc) 325 $(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) termcap \ 326 $(DESTDIR)$(LIBDIR)/etc/xterm.termcap 327InstallNamedNonExec(terminfo,xterm.terminfo,$(LIBDIR)/etc) 328 329InstallAppDefaults(XTerm) 330InstallAppDefaults(UXTerm) 331InstallAppDefaultsLong(XTerm-col,XTerm-color) 332InstallManPage(xterm,$(MANDIR)) 333InstallManPage(resize,$(MANDIR)) 334 335cleandir:: 336 $(RM) *parse.hin *parse.cin 337 338DependTarget() 339