1 #ENABLE_GDC_DEPS = tan ;
12 if $(USE_GDC) || ! $(USE_DMD) {
15 if ! $(PHOBOS_DYNAMIC) && ! $(DYNAMIC) {
17 #GDC += -static-libphobos ;
18 #GDCLINK += -static-libphobos ;
20 GDCFLAGS.all += -fPIC ;
23 GDCLINKFLAGS.all += -Wl,--gc-sections ;
27 if ! $(PHOBOS_DYNAMIC) && ! $(DYNAMIC) {
37 if $(USE_DMD) && ! $(DMD_STATIC) {
38 GDCFLAGS.all += -defaultlib=libphobos2.so -L/home/ketmar/zoft/dmd/lib ;
39 LINKFLAGS.all += -defaultlib=libphobos2.so -L/home/ketmar/zoft/dmd/lib ;
43 DLANG_BASE_DIR = $(HOME)/.D ;
44 DLANG_LIBSRC_DIR = $(DLANG_BASE_DIR)/libsrc ;
47 DLANG_LIB_DIR = $(DLANG_BASE_DIR)/libs_dmd ;
49 DLANG_LIB_DIR = $(DLANG_BASE_DIR)/libs ;
52 GDCFLAGS.all += -Wcast-result -Wdeprecated -Wno-unknown-pragmas -fno-property -fignore-unknown-pragmas ;
54 GDCFLAGS.all += -I$(DLANG_LIBSRC_DIR) ;
55 GDCFLAGS.all += -J$(DLANG_LIBSRC_DIR) ;
56 LINKFLAGS.all += -L$(DLANG_LIB_DIR) ;
58 HDRS += $(HOME)/.D/k8dmd ;
59 HDRS += $(HOME)/.D/k8dmd/iv ;
60 HDRS += $(HOME)/.D/k8dmd/k8 ;
70 rule dlang.addlib libnames : ddeps : sysdeps : pkgdeps {
72 #Echo "dlang.addlib:" $(libnames) ":" $(ddeps) ":" $(sysdeps) ;
73 for local lib in $(libnames) {
74 if ! $(lib) in $(DLANG.LIBS) {
75 DLANG.LIBS += $(lib) ;
77 vn = DLANG.LIBDDEPS.$(lib) ;
78 for local ln in $(ddeps) { $(vn) += $(ln) ; }
80 vn = DLANG.LIBSDEPS.$(lib) ;
81 for local ln in $(sysdeps) { $(vn) += $(ln) ; }
83 vn = DLANG.LIBPDEPS.$(lib) ;
84 for local ln in $(pkgdeps) { $(vn) += $(ln) ; }
86 Exit "D: duplicate library registration:" $(lib) ;
92 # take libname in form 'derelict.sdl2' and returns path to this lib relative to $(DLANG_LIBSRC_DIR)
93 rule dlang.libsrcdir libname {
94 local res = [ Split $(libname) : '.' ] ;
99 # take libname in form 'derelict.sdl2' and returns path to this lib relative to $(DLANG_LIB_DIR)
100 rule dlang.libdir libname {
101 local res = [ Split $(libname) : '.' ] ;
106 # take libname in form 'derelict.sdl2' and returns a library name for it
107 # (but without 'lib' prefix and '.a' suffix)
108 rule dlang.linkname libname : retvars {
109 ### if ! $(USE_DMD) {
110 ### local res = [ Split $(libname) : '.' ] ;
111 ### return -l_d_$(res:J=_) ;
113 ### local res = [ Split $(libname) : '.' ] ;
114 ### return $(DLANG_LIB_DIR)/lib_d_$(res:J=_).a ;
116 local res = [ Split $(libname) : '.' ] ;
118 local res = '$(DLANG_LIB_DIR)'/lib_d_$(res:J=_).a ;
121 return $(DLANG_LIB_DIR)/lib_d_$(res:J=_).a ;
126 # take libname in form 'derelict.sdl2' and returns a library name for it
127 # (like 'lib_d_derelict_sdl2.a')
128 rule dlang.libaname libname {
129 local res = [ Split $(libname) : '.' ] ;
130 return lib_d_$(res:J=_).a ;
134 softinclude $(HOME)/.D/libsrc/liblist.jam ;
137 rule dlang.require libnames {
138 local ddep sdep pdep ;
139 for local lib in $(libnames) {
140 if $(lib) in $(DLANG_LIBS_ADDED) { return ; }
141 if ! $(lib) in $(DLANG.LIBS) { Exit "FATAL: unknown D library:" $(lib) ; }
142 DLANG_LIBS_ADDED += $(lib) ;
143 ddep = $(DLANG.LIBDDEPS.$(lib)) ;
144 sdep = $(DLANG.LIBSDEPS.$(lib)) ;
145 pdep = $(DLANG.LIBPDEPS.$(lib)) ;
146 local ln = [ dlang.linkname $(lib) ] ;
148 LINKLIBS.all += $(ln) ;
149 if $(ddep) { dlang.require $(ddep) ; }
150 for local slib in $(sdep) { LINKLIBS.all += -l$(slib) ; }
151 for local plib in $(pdep) {
152 #Echo "checking" $(plib) ;
153 local ex = [ pkg-config-exists $(plib) ] ;
155 local flg = [ lib-config-ex "pkg-config '$(plib)' --cflags" ] ;
156 local lib = [ lib-config-ex "pkg-config '$(plib)' --libs" ] ;
157 if $(flg) { GDCFLAGS.all += $(flg) ; }
158 if $(lib) { LINKLIBS.all += $(lib) ; }
165 DLANG_INCLUDES_ADDED = ;
167 rule -configure-dlang-require- liblist {
168 if $(_CONFIGURE_FATAL_) = 'tan' { return ; }
169 if ! $(DLANG_INCLUDES_ADDED) {
170 DLANG_INCLUDES_ADDED = tan ;
171 -configure-add-line- '# D flags' ;
172 #-configure-add-line- 'GDCFLAGS.all +=' -I$(DLANG_LIBSRC_DIR) ';' ;
173 #-configure-add-line- 'GDCFLAGS.all +=' -J$(DLANG_LIBSRC_DIR) ';' ;
174 #-configure-add-line- 'LINKFLAGS.all +=' -L$(DLANG_LIB_DIR) ';' ;
175 -configure-add-line- 'GDCFLAGS.all += -I$(DLANG_LIBSRC_DIR) ;' ;
176 -configure-add-line- 'GDCFLAGS.all += -J$(DLANG_LIBSRC_DIR) ;' ;
177 -configure-add-line- 'LINKFLAGS.all += -L$(DLANG_LIB_DIR) ;' ;
179 for local lib in $(liblist) {
181 if $(lib) in $(DLANG_LIBS_ADDED) { return ; }
182 Echo "checking for D: $(lib) ... " : -n ;
183 if ! $(lib) in $(DLANG.LIBS) { -configure-fatal- ; Exit "not found" ; }
184 DLANG_LIBS_ADDED += $(lib) ;
185 -configure-add-line- '# D:' $(lib) ;
186 local ln = [ dlang.linkname $(lib) : 'tan' ] ;
187 -configure-add-line- 'LINKLIBS.all +=' $(ln) ';' ;
188 dep = $(DLANG.LIBPDEPS.$(lib)) ;
189 for local plib in $(dep) {
190 local ex = [ -configure-pkg-config-check-done- $(plib) ] ;
192 #-CONFIGURE-PKG-CONFIG-DONE- += $(plib) ;
193 ex = [ Match '^\s*([^\s<>=]+)' : $(plib) ] ;
194 -CONFIGURE-PKG-CONFIG-DONE-NAMES- += $(ex[1]) ;
195 local ex = [ pkg-config-exists $(plib) ] ;
197 local flg = [ lib-config-ex "pkg-config '$(plib)' --cflags" ] ;
198 local lib = [ lib-config-ex "pkg-config '$(plib)' --libs" ] ;
199 if $(flg) { -configure-add-line- 'GDCFLAGS.all +=' $(flg) ';' ; }
200 if $(lib) { -configure-add-line- 'LINKLIBS.all +=' $(lib) ';' ; }
203 Exit "not found (pkg-config dependency" $(plib) ")" ;
206 #Echo "(here" $(plib) ")" ;
210 dep = $(DLANG.LIBDDEPS.$(lib)) ;
211 if $(dep) { -configure-dlang-require- $(dep) ; }
212 dep = $(DLANG.LIBSDEPS.$(lib)) ;
213 for local slib in $(dep) { -configure-add-line- 'LINKLIBS.all +=' -l$(slib) ';' ; }