1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
/* $NetBSD: xpkgwedge.def,v 1.11 2004/04/30 19:44:21 tv Exp $ */
#ifdef BeforeVendorCF
/*
* OS-specific overrides for Interix to make it behave similarly to NetBSD
* when creating binaries for pkgsrc.
*/
#ifdef __INTERIX
#undef ForceNormalLib /* this is always YES on Interix */
#define NullMakeCommand @ true
#define SharedLibraryLoadFlags -shared -Wl,-rpath,$(USRLIBDIRPATH)
#ifdef UseInstalled
#define ExtraLoadFlags -Wl,-rpath,$(USRLIBDIRPATH)
#define LinkBuildSonameLibrary(lib) true
#else
#define ExtraLoadFlags -Wl,-rpath,$(USRLIBDIRPATH) -Wl,-rpath-link,$(BUILDLIBDIR)
#define LinkBuildSonameLibrary(lib) (RemoveFile($(BUILDLIBDIR)/lib); \
cd $(BUILDLIBDIR); $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/lib .)
#endif
/*
* Oy, what a hack: see pkgsrc/devel/libtool for an explanation of the
* bizarre --image-base option used below.
*/
#define SharedLibraryTarget(libname,rev,solist,down,up) @@\
AllTarget(Concat(lib,libname.so.rev)) @@\
@@\
Concat(lib,libname.so.rev): solist @@\
$(RM) $@~ @@\
@SONAME=`echo $@ | sed 's/\.[^\.]*$$//'`; set -x; \ @@\
(cd down; $(CC) -o up/$@~ $(SHLIBLDFLAGS) \ @@\
-Wl,--image-base,$$(($$RANDOM %4096/2*262144+1342177280)) \ @@\
-Wl,-h,$$SONAME solist $(REQUIREDLIBS)); \ @@\
$(RM) $$SONAME; $(LN) $@ $$SONAME; \ @@\
LinkBuildSonameLibrary($$SONAME) @@\
$(RM) $@ @@\
$(MV) $@~ $@ @@\
LinkBuildLibrary($@) @@\
$(RM) Concat(lib,libname.so) @@\
$(LN) $@ Concat(lib,libname.so) @@\
LinkBuildLibrary(Concat(lib,libname.so)) @@\
@@\
clean:: @@\
@SONAME=`echo Concat(lib,libname.so.rev) | sed 's/\.[^\.]*$$//'`; \ @@\
set -x; $(RM) $$SONAME @@\
$(RM) Concat(lib,libname.so) @@\
$(RM) Concat(lib,libname.so.rev)
#define InstallSharedLibrary(libname,rev,dest) @@\
install:: Concat(lib,libname.so.rev) @@\
MakeDir($(DESTDIR)dest) @@\
$(INSTALL) $(INSTALLFLAGS) $(INSTBINFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest @@\
@T=`echo Concat($(DESTDIR)dest/lib,libname.so.rev) | sed 's/\.[^\.]*$$//'`;\ @@\
set -x; $(RM) $$T && $(LN) Concat(lib,libname.so.rev) $$T @@\
$(RM) Concat($(DESTDIR)dest/lib,libname.so) @@\
$(LN) Concat(lib,libname.so.rev) Concat($(DESTDIR)dest/lib,libname.so)
#endif /* __INTERIX && BeforeVendorCF */
#endif /* BeforeVendorCF */
#ifdef AfterVendorCF
/*
* The following defines inject a "PREFIX=" make-time option that lets the
* user twiddle the ProjectRoot setting with a single switch. This makes
* the command "make PREFIX=/path/to/install all install" work as expected.
*/
#ifndef ProjectRoot
/*
* Assume the worst: this should not happen in practice, as this setup
* does not work with the classical /usr/{include,lib}/X11 layout.
*/
#define ProjectRoot /usr/X11
#endif
X11_ROOT = ProjectRoot
#undef ProjectRoot
#define ProjectRoot $(PREFIX)
#undef ConfigDir
#define ConfigDir $(X11_ROOT)/lib/X11/config
/*
* This emits dual -I and -L options to cc automatically, one for the actual
* X11 root, and one for the user-set prefix.
*/
#define X11ProjectRoot $(X11_ROOT)
/*
* InstallAppDefaultsLong - general rule to install application default file
* if the InstallAppDefFiles configuration parameter is set.
*
* This is the same as the one in X11.tmpl, but without the LinkConfDirectory.
* LinkConfDirectory removes the app-defaults directory in $(PREFIX)/lib/X11
* and creates a link to the real X11 app-defaults directory and moves the old
* app-defaults files into it. This is not what we want for pkgsrc.
*/
#ifndef InstallAppDefaultsLong
#if InstallAppDefFiles
#define InstallAppDefaultsLong(file,class) @@\
InstallNamedTarget(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class)
#else
#define InstallAppDefaultsLong(file,class) @@\
InstallNamedTargetNoClobber(install,file.ad,$(INSTAPPFLAGS),$(XAPPLOADDIR),class)
#endif /* InstallAppDefFiles */
#endif /* InstallAppDefaultsLong */
#ifdef UseInstalled
/*
* We need to redefine ImakeCmd so that imake will look in both
* $(PREFIX)/lib/X11/config and $(VIEWBASE)/lib/X11/config *before*
* looking in the standard X11 config directory to override any
* configuration files installed there.
*/
#undef ImakeCmd
#define ImakeCmd imake -I$(PREFIX)/lib/X11/config -I$(VIEWBASE)/lib/X11/config
#endif
#endif /* AfterVendorCF */
|