summaryrefslogtreecommitdiffstats
path: root/components.mk
blob: d218fa4ee42d51460b15d0f7bfcea99081e4814a (plain)
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
#
# BEGIN COPYRIGHT BLOCK
# This Program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
# 
# This Program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License along with
# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
# 
# In addition, as a special exception, Red Hat, Inc. gives You the additional
# right to link the code of this Program with code not covered under the GNU
# General Public License ("Non-GPL Code") and to distribute linked combinations
# including the two, subject to the limitations in this paragraph. Non-GPL Code
# permitted under this exception must only link to the code of this Program
# through those well defined interfaces identified in the file named EXCEPTION
# found in the source code files (the "Approved Interfaces"). The files of
# Non-GPL Code may instantiate templates or use macros or inline functions from
# the Approved Interfaces without causing the resulting work to be covered by
# the GNU General Public License. Only Red Hat, Inc. may make changes or
# additions to the list of Approved Interfaces. You must obey the GNU General
# Public License in all respects for all of the Program code and other code used
# in conjunction with the Program except the Non-GPL Code covered by this
# exception. If you modify this file, you may extend this exception to your
# version of the file, but you are not obligated to do so. If you do not wish to
# provide this exception without modification, you must delete this exception
# statement from your version and license this file solely under the GPL without
# exception. 
# 
# 
# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#
# this file contains definitions for component macros used during the build
# process.  Things like the component location in the build tree, etc.
# this file should be included by nsconfig.mk after it figures out all
# of the OS, architecture, security, and other platform and build related
# macros.  This file also contains the instructions for making the component
# up to date e.g. copying the files from their repository to an area where
# the build process has access to it.  For some components and OS's, this may
# be as simple as creating a symbolic link to the repository

# Each component should define a COMPONENT_DEP macro which can be used in
# other makefiles for dependency checking e.g.
# target: $(COMPONENT1_DEP) $(COMPONENT2_DEP) ...
# This macro should evaluate to the name of a single file which must be
# present for the package to be complete e.g. some library or include
# file name
# Each component then should define a target for that dependency which will
# bring the component up to date if that target does not exist e.g.
# $(COMPONENT1_DEP):
#	use ftp or symlinks or ??? to get the necessary files to the build
#	area

# Each component should define a COMPONENT_LINK macro which can be used to
# link the component's libraries with the target.  For NT, this will typically
# be something like
# /LIBPATH:path_to_library lib1 lib2 lib3 /LIBPATH:more_libs lib4 lib5 ...
# On Unix, this will be something like
# -Lpath_to_library -l1 -l2 -l3 -Lmore_libs -l4 -l5 ...

# Each component should define a COMPONENT_INCLUDE macro which can be used
# to compile using the component's header files e.g.
# -Ipath_to_include_files -Ipath_to_more_include_files

# Once this file is working, I will DELETE compvers.sh and ns_ftp.sh
# from the tree, so help me god.

# this macro contains a list of source files and directories to copy to
# the directory where DLLs/SOs go at runtime; each component will add the files/dirs to
# this macro that it needs to package; not all components will have
# files which need packaging
# if you need some other behavior, see PACKAGE_SRC_DEST below
LIBS_TO_PKG =

# this macro contains a list of source files and directories to copy to
# the directory where DLLs/SOs go at runtime; each component will add the files/dirs to
# this macro that it needs to package; this is for DLLs/SOs for the shared/bin
# directory where the ldap c sdk command line tools, some security tools, and
# the i18n conversion tools live
LIBS_TO_PKG_SHARED = 

# this macro contains a list of source files and directories to copy to
# the shared tools directory - things like the ldap c sdk command line
# tools, shared security tools, etc.
BINS_TO_PKG_SHARED =

# this macro contains a list of shared libraries/dlls needed during
# setup to run the setup pre-install program on unix (ns-config) or
# the slapd plugin on NT (DSINST_PreInstall)
PACKAGE_SETUP_LIBS =

# this macro contains a list of libraries/dlls to copy to the clients
# library directory
LIBS_TO_PKG_CLIENTS =

# this macro contains a list of source files and directories to copy to
# the release/java directory; usually a list of jar files
PACKAGE_UNDER_JAVA =

# this macro contains a list of pairs of source and dest files and directories
# the source is where to find the item in the build tree, and the dest is
# the place in the release to put the item, relative to the server root e.g.
# nls locale files are in libnls31/locale, but for packaging they need to
# go into lib/nls, not just lib; the destination should be a directory name;
# separate the src from the dest with a single space
PACKAGE_SRC_DEST =

# these defs are useful for doing pattern search/replace
COMMA := ,
NULLSTRING :=
SPACE := $(NULLSTRING) # the space is between the ) and the #

ifeq ($(ARCH), WINNT)
EXE_SUFFIX = .exe
else # unix - windows has no lib name prefix, except for nspr
LIB_PREFIX = lib
endif

ifeq ($(INTERNAL_BUILD), 1)
include $(BUILD_ROOT)/internal_buildpaths.mk
else
include $(BUILD_ROOT)/buildpaths.mk
endif

# NSPR20 Library
NSPR_LIBNAMES = plc4 plds4
ifeq ($(ARCH), SOLARIS)
  ifeq ($(NSPR_RELDATE), v4.2.2)
# no need after v4.4.1
NSPR_LIBNAMES += ultrasparc4 
# just need ultrasparc for now
LIBS_TO_PKG += $(addsuffix .$(DLL_SUFFIX),$(addprefix $(NSPR_LIBPATH)/lib,ultrasparc4))
  endif
endif
NSPR_LIBNAMES += nspr4
ifdef NSPR_SOURCE_ROOT
  NSPR_LIBPATH = $(NSPR_SOURCE_ROOT)/dist/$(MOZ_OBJDIR_NAME)/lib
  NSPR_INCDIR = $(NSPR_SOURCE_ROOT)/dist/$(MOZ_OBJDIR_NAME)/include
else
  NSPR_LIBPATH = $(NSPR_BUILD_DIR)/lib
  NSPR_INCDIR = $(NSPR_BUILD_DIR)/include
endif
NSPR_INCLUDE = -I$(NSPR_INCDIR)
NSPR_LIBS_TO_PKG = $(addsuffix .$(DLL_SUFFIX),$(addprefix $(NSPR_LIBPATH)/lib,$(NSPR_LIBNAMES)))

LIBS_TO_PKG += $(NSPR_LIBS_TO_PKG)
LIBS_TO_PKG_SHARED += $(NSPR_LIBS_TO_PKG) # needed for cmd line tools
ifeq ($(USE_SETUPSDK), 1)
  PACKAGE_SETUP_LIBS += $(NSPR_LIBS_TO_PKG)
endif
ifeq ($(USE_DSGW), 1)
  LIBS_TO_PKG_CLIENTS += $(NSPR_LIBS_TO_PKG) # for dsgw
endif

ifeq ($(ARCH), WINNT)
  NSPRDLL_NAME = $(addprefix lib, $(NSPR_LIBNAMES))
  NSPROBJNAME = $(addsuffix .lib, $(NSPRDLL_NAME))
  NSPRLINK = /LIBPATH:$(NSPR_LIBPATH) $(NSPROBJNAME)
  LIBNSPRDLL_NAMES = $(addsuffix .dll, $(addprefix $(NSPR_LIBPATH)/, \
	$(addprefix lib, $(NSPR_LIBNAMES))))
else
  NSPR_SOLIBS = $(addsuffix .$(DLL_SUFFIX),  $(addprefix $(LIB_PREFIX), $(NSPR_LIBNAMES)))
  NSPROBJNAME = $(addsuffix .a, $(addprefix $(LIB_PREFIX), $(NSPR_LIBNAMES))
  LIBNSPR = $(addprefix $(NSPR_LIBPATH)/, $(NSPR_SOLIBS))
  NSPRLINK = -L$(NSPR_LIBPATH) $(addprefix -l, $(NSPR_LIBNAMES))
endif

### DBM #############################

ifdef DBM_SOURCE_ROOT
  DBM_LIBPATH = $(DBM_SOURCE_ROOT)/dist/$(MOZ_OBJDIR_NAME)/lib
  DBM_INCDIR = $(DBM_SOURCE_ROOT)/dist/public/dbm
else
  DBM_LIBPATH = $(DBM_BUILD_DIR)/lib
  DBM_INCDIR = $(DBM_BUILD_DIR)/include
endif
DBM_INCLUDE = -I$(DBM_INCDIR)
DBM_LIBNAMES = dbm

ifeq ($(ARCH), WINNT)
  DBMOBJNAME = $(addsuffix .lib, $(DBM_LIBNAMES))
  LIBDBM = $(addprefix $(DBM_LIBPATH)/, $(DBMOBJNAME))
  DBMLINK = /LIBPATH:$(DBM_LIBPATH) $(DBMOBJNAME)
else
  DBM_SOLIBS = $(addsuffix .$(DLL_SUFFIX),  $(addprefix $(LIB_PREFIX), $(DBM_LIBNAMES)))
  DBMROBJNAME = $(addsuffix .a, $(addprefix $(LIB_PREFIX), $(DBM_LIBNAMES)))
  LIBDBM = $(addprefix $(DBM_LIBPATH)/, $(DBMROBJNAME))
  DBMLINK = -L$(DBM_LIBPATH) $(addprefix -l, $(DBM_LIBNAMES))
endif

### DBM END #############################

### SECURITY #############################
ifdef SECURITY_SOURCE_ROOT
  SECURITY_LIBPATH = $(SECURITY_SOURCE_ROOT)/dist/$(MOZ_OBJDIR_NAME)/lib
  SECURITY_BINPATH = $(SECURITY_SOURCE_ROOT)/dist/$(MOZ_OBJDIR_NAME)/bin
  SECURITY_INCDIR = $(SECURITY_SOURCE_ROOT)/dist/public/nss
else
  SECURITY_LIBPATH = $(SECURITY_BUILD_DIR)/lib
  SECURITY_BINPATH = $(SECURITY_BUILD_DIR)/bin
  SECURITY_INCDIR = $(SECURITY_BUILD_DIR)/include
endif
SECURITY_INCLUDE = -I$(SECURITY_INCDIR)
# add crlutil and ocspclnt when we support CRL and OCSP cert checking in DS
SECURITY_BINNAMES = certutil derdump pp pk12util ssltap modutil shlibsign
SECURITY_LIBNAMES = ssl3 nss3 softokn3
# these libs have a corresponding .chk file
SECURITY_NEED_CHK = softokn3

SECURITY_LIBNAMES.pkg = $(SECURITY_LIBNAMES) smime3

# these are only needed on 32 bit Solaris and HP-UX
ifneq ($(USE_64), 1)
ifeq ($(ARCH), SOLARIS)
SECURITY_LIBNAMES.pkg += freebl_hybrid_3 freebl_pure32_3
# these libs have a corresponding .chk file
SECURITY_NEED_CHK += freebl_hybrid_3 freebl_pure32_3
endif
ifeq ($(ARCH), HPUX)
SECURITY_LIBNAMES.pkg += freebl_hybrid_3 freebl_pure32_3
# these libs have a corresponding .chk file
SECURITY_NEED_CHK += freebl_hybrid_3 freebl_pure32_3
endif
endif # USE_64

SECURITY_TOOLS = $(addsuffix $(EXE_SUFFIX),$(SECURITY_BINNAMES))
SECURITY_TOOLS_FULLPATH = $(addprefix $(SECURITY_BINPATH)/, $(SECURITY_TOOLS))

SECURITY_LIBS_TO_PKG = $(addsuffix .$(DLL_SUFFIX),$(addprefix $(SECURITY_LIBPATH)/$(LIB_PREFIX),$(SECURITY_LIBNAMES.pkg)))
SECURITY_LIBS_TO_PKG += $(addsuffix .chk,$(addprefix $(SECURITY_LIBPATH)/$(LIB_PREFIX),$(SECURITY_NEED_CHK)))
LIBS_TO_PKG += $(SECURITY_LIBS_TO_PKG)
LIBS_TO_PKG_SHARED += $(SECURITY_LIBS_TO_PKG) # for cmd line tools
ifeq ($(USE_SETUPSDK), 1)
  PACKAGE_SETUP_LIBS += $(SECURITY_LIBS_TO_PKG)
endif
ifeq ($(USE_DSGW), 1)
  LIBS_TO_PKG_CLIENTS += $(SECURITY_LIBS_TO_PKG) # for dsgw
endif

ifeq ($(ARCH), WINNT)
  SECURITYOBJNAME = $(addsuffix .$(LIB_SUFFIX), $(SECURITY_LIBNAMES))
  LIBSECURITY = $(addprefix $(SECURITY_LIBPATH)/, $(SECURITYOBJNAME))
  SECURITYLINK = /LIBPATH:$(SECURITY_LIBPATH) $(SECURITYOBJNAME)
else
  SECURITYOBJNAME = $(addsuffix .$(DLL_SUFFIX), $(addprefix $(LIB_PREFIX), $(SECURITY_LIBNAMES)))
  LIBSECURITY = $(addprefix $(SECURITY_LIBPATH)/, $(SECURITYOBJNAME))
  SECURITYLINK = -L$(SECURITY_LIBPATH) $(addprefix -l, $(SECURITY_LIBNAMES))
endif

# we need to package the root cert file in the alias directory
PACKAGE_SRC_DEST += $(SECURITY_LIBPATH)/$(LIB_PREFIX)nssckbi.$(DLL_SUFFIX) alias

# need to package the sec tools in shared/bin
BINS_TO_PKG_SHARED += $(SECURITY_TOOLS_FULLPATH)

### SECURITY END #############################

### SVRCORE #############################
ifdef SVRCORE_SOURCE_ROOT
  SVRCORE_LIBPATH = $(SVRCORE_SOURCE_ROOT)/dist/$(MOZ_OBJDIR_NAME)/lib
  SVRCORE_INCDIR = $(SVRCORE_SOURCE_ROOT)/dist/public/svrcore
else
  SVRCORE_LIBPATH = $(SVRCORE_BUILD_DIR)/lib
  SVRCORE_INCDIR = $(SVRCORE_BUILD_DIR)/include
endif
SVRCORE_INCLUDE = -I$(SVRCORE_INCDIR)
SVRCORE_LIBNAMES = svrcore

ifeq ($(ARCH), WINNT)
  SVRCOREOBJNAME = $(addsuffix .lib, $(SVRCORE_LIBNAMES))
  LIBSVRCORE = $(addprefix $(SVRCORE_LIBPATH)/, $(SVRCOREOBJNAME))
  SVRCORELINK = /LIBPATH:$(SVRCORE_LIBPATH) $(SVRCOREOBJNAME)
else
  SVRCOREOBJNAME = $(addsuffix .a, $(addprefix $(LIB_PREFIX), $(SVRCORE_LIBNAMES)))
  LIBSVRCORE = $(addprefix $(SVRCORE_LIBPATH)/, $(SVRCOREOBJNAME))
  SVRCORELINK = -L$(SVRCORE_LIBPATH) $(addprefix -l, $(SVRCORE_LIBNAMES))
endif

### SVRCORE END #############################

####################################################
# LDAP SDK
###################################################

ifdef LDAPSDK_SOURCE_ROOT
  LDAPSDK_LIBPATH = $(LDAPSDK_SOURCE_ROOT)/dist/lib
  LDAPSDK_INCDIR = $(LDAPSDK_SOURCE_ROOT)/dist/public/ldap
  LDAPSDK_BINPATH = $(LDAPSDK_SOURCE_ROOT)/dist/bin
else
  LDAPSDK_LIBPATH = $(LDAP_ROOT)/lib
  LDAPSDK_INCDIR = $(LDAP_ROOT)/include
  LDAPSDK_BINPATH = $(LDAP_ROOT)/tools
endif
LDAPSDK_INCLUDE = -I$(LDAPSDK_INCDIR)

# package the command line programs
LDAPSDK_TOOLS = $(wildcard $(LDAPSDK_BINPATH)/ldap*$(EXE_SUFFIX))
BINS_TO_PKG_SHARED += $(LDAPSDK_TOOLS)
# package the include files - needed for the plugin API
LDAPSDK_INCLUDE_FILES = $(wildcard $(LDAPSDK_INCDIR)/*.h)
PACKAGE_SRC_DEST += $(subst $(SPACE),$(SPACE)plugins/slapd/slapi/include$(SPACE),$(LDAPSDK_INCLUDE_FILES))
PACKAGE_SRC_DEST += plugins/slapd/slapi/include

ifeq ($(ARCH), WINNT)
  LDAP_LIBNAMES = ldapssl32v$(LDAP_SUF) ldap32v$(LDAP_SUF) ldappr32v$(LDAP_SUF)
  LDAPDLL_NAME = $(addprefix ns, $(LDAP_LIBNAMES))
  LDAPOBJNAME = $(addsuffix .$(LIB_SUFFIX), $(LDAPDLL_NAME))
  LDAPLINK = /LIBPATH:$(LDAPSDK_LIBPATH) $(LDAPOBJNAME)
  LDAP_NOSSL_LINK = /LIBPATH:$(LDAPSDK_LIBPATH) nsldap32v$(LDAP_SUF).$(LIB_SUFFIX)
  LIBLDAPDLL_NAMES = $(addsuffix .dll, $(addprefix $(LDAP_LIBPATH)/, $(LDAPDLL_NAME)))

  LIBS_TO_PKG += $(addsuffix .$(DLL_SUFFIX),$(addprefix $(LDAPSDK_LIBPATH)/,$(LDAPDLL_NAME)))
  LIBS_TO_PKG_SHARED += $(addsuffix .$(DLL_SUFFIX),$(addprefix $(LDAPSDK_LIBPATH)/,$(LDAPDLL_NAME)))
  ifeq ($(USE_SETUPSDK), 1)
    PACKAGE_SETUP_LIBS += $(addsuffix .$(DLL_SUFFIX),$(addprefix $(LDAPSDK_LIBPATH)/,$(LDAPDLL_NAME)))
  endif
  ifeq ($(USE_DSGW), 1)
    LIBS_TO_PKG_CLIENTS += $(addsuffix .$(DLL_SUFFIX),$(addprefix $(LDAPSDK_LIBPATH)/,$(LDAPDLL_NAME)))
  endif
else # not WINNT
  LDAP_SOLIB_NAMES = ssldap$(LDAP_SUF)$(LDAP_DLL_PRESUF) ldap$(LDAP_SUF)$(LDAP_DLL_PRESUF) prldap$(LDAP_SUF)$(LDAP_DLL_PRESUF)
  ifndef LDAP_NO_LIBLCACHE
	LDAP_SOLIB_NAMES += lcache30$(LDAP_DLL_PRESUF)
  endif
  LDAP_DOTALIB_NAMES =
  LDAP_LIBNAMES = $(LDAP_DOTALIB_NAMES) $(LDAP_SOLIB_NAMES)
  LDAP_SOLIBS = $(addsuffix .$(LDAP_DLL_SUFFIX), $(addprefix $(LIB_PREFIX), $(LDAP_SOLIB_NAMES)))
  LDAPOBJNAME = $(addsuffix .$(LIB_SUFFIX), $(addprefix $(LIB_PREFIX), $(LDAP_DOTALIB_NAMES))) \
		$(LDAP_SOLIBS)
  LDAPLINK = -L$(LDAPSDK_LIBPATH) $(addprefix -l,$(LDAP_SOLIB_NAMES))
  LDAP_NOSSL_LINK = -L$(LDAPSDK_LIBPATH) -lldap$(LDAP_SUF)$(LDAP_DLL_PRESUF)

  LIBS_TO_PKG += $(addprefix $(LDAPSDK_LIBPATH)/,$(LDAP_SOLIBS))
  LIBS_TO_PKG_SHARED += $(addprefix $(LDAPSDK_LIBPATH)/,$(LDAP_SOLIBS))
  ifeq ($(USE_SETUPSDK), 1)
    PACKAGE_SETUP_LIBS += $(addprefix $(LDAPSDK_LIBPATH)/,$(LDAP_SOLIBS))
  endif
  ifeq ($(USE_DSGW), 1)
    LIBS_TO_PKG_CLIENTS += $(addprefix $(LDAPSDK_LIBPATH)/,$(LDAP_SOLIBS))
  endif
endif

LDAP_LIBPATH = $(LDAPSDK_LIBPATH)
LDAP_INCLUDE = $(LDAPSDK_INCDIR)
LDAP_TOOLDIR = $(LDAPSDK_BINPATH)
LIBLDAP = $(addprefix $(LDAP_LIBPATH)/, $(LDAPOBJNAME))

### SASL package ##########################################

ifdef SASL_SOURCE_ROOT
  SASL_LIBPATH = $(SASL_SOURCE_ROOT)/lib
  SASL_BINPATH = $(SASL_SOURCE_ROOT)/bin
  SASL_INCDIR = $(SASL_SOURCE_ROOT)/include
else
  SASL_LIBPATH = $(SASL_BUILD_DIR)/lib
  SASL_BINPATH = $(SASL_BUILD_DIR)/bin
  SASL_INCDIR = $(SASL_BUILD_DIR)/include
endif
SASL_INCLUDE = $(SASL_INCDIR)

ifeq ($(ARCH), WINNT)
  SASL_LIB_ROOT_NAME = sasl
  SASL_LINK = /LIBPATH:$(SASL_LIBPATH) lib$(SASL_LIB_ROOT_NAME).lib
  SASL_LIBS = lib$(SASL_LIB_ROOT_NAME).lib,lib$(SASL_LIB_ROOT_NAME).dll,saslDIGESTMD5.dll
else
  # for cyrus it's sasl2
  SASL_LIB_ROOT_NAME = sasl2
  SASL_LIBS = lib$(SASL_LIB_ROOT_NAME).a
  ifeq ($(ARCH), Linux)
    GSSAPI_LIBS=-L/usr/kerberos/lib -lgssapi_krb5
  endif
  ifeq ($(ARCH), SOLARIS)
    GSSAPI_LIBS=-lgss
  endif
  ifeq ($(ARCH), HPUX)
      GSSAPI_LIBS=-lgss
      ifeq ($(USE_64),1)
        GSSAPI_LIBS=-L/usr/lib/pa20_64 -lgss
      endif
  endif

  SASL_LINK = -L$(SASL_LIBPATH) -l$(SASL_LIB_ROOT_NAME) $(GSSAPI_LIBS)
endif
###########################################################

### Net-SNMP package ######################################
ifdef NETSNMP_SOURCE_ROOT
  NETSNMP_LIBPATH = $(NETSNMP_SOURCE_ROOT)/built/lib
  NETSNMP_INCDIR = $(NETSNMP_SOURCE_ROOT)/built/include
  NETSNMP_BINDIR = $(NETSNMP_SOURCE_ROOT)/built/bin
else
  NETSNMP_LIBPATH = $(NETSNMP_BUILD_DIR)/lib
  NETSNMP_INCDIR = $(NETSNMP_BUILD_DIR)/include
  NETSNMP_BINDIR = $(NETSNMP_BUILD_DIR)/bin
endif

NETSNMP_INCLUDE = -I$(NETSNMP_INCDIR)
NETSNMP_LIBNAMES = netsnmp netsnmpagent netsnmpmibs netsnmphelpers
NETSNMP_LINK = -L$(NETSNMP_LIBPATH) $(addprefix -l, $(NETSNMP_LIBNAMES))
ifneq ($(ARCH), WINNT)
  ifeq ($(ARCH), HPUX)
    NETSNMP_SOLIBS = $(addsuffix .$(DLL_SUFFIX).7, $(addprefix $(LIB_PREFIX), $(NETSNMP_LIBNAMES)))
  else
    NETSNMP_SOLIBS = $(addsuffix .$(DLL_SUFFIX).5, $(addprefix $(LIB_PREFIX), $(NETSNMP_LIBNAMES)))
  endif
  LIBS_TO_PKG += $(addprefix $(NETSNMP_LIBPATH)/,$(NETSNMP_SOLIBS))
endif
###########################################################

### ICU package ##########################################

ICU_LIB_VERSION = 24
ifdef ICU_SOURCE_ROOT
  ICU_LIBPATH = $(ICU_SOURCE_ROOT)/built/lib
  ICU_BINPATH = $(ICU_SOURCE_ROOT)/built/bin
  ICU_INCPATH = $(ICU_SOURCE_ROOT)/built/include
else
  ICU_LIBPATH = $(ICU_BUILD_DIR)/lib
  ICU_BINPATH = $(ICU_BUILD_DIR)/bin
  ICU_INCPATH = $(ICU_BUILD_DIR)/include
endif
ICU_INCLUDE = -I$(ICU_INCPATH)
ifeq ($(ARCH), WINNT)
  ifeq ($(BUILD_DEBUG), optimize)
    ICU_LIB_SUF=
  else
    ICU_LIB_SUF=d
  endif
  ICU_LIBNAMES = icuin$(ICU_LIB_SUF) icuuc$(ICU_LIB_SUF) icudata
  ICU_DLLNAMES = icuin$(ICU_LIB_VERSION)$(ICU_LIB_SUF) icuuc$(ICU_LIB_VERSION)$(ICU_LIB_SUF) icudt$(ICU_LIB_VERSION)l
  ICULINK = /LIBPATH:$(ICU_LIBPATH) $(addsuffix .$(LIB_SUFFIX),$(ICU_LIBNAMES))
  LIBS_TO_PKG += $(addsuffix .$(DLL_SUFFIX),$(addprefix $(ICU_BINPATH)/,$(ICU_DLLNAMES)))
  LIBS_TO_PKG_SHARED += $(addsuffix .$(DLL_SUFFIX),$(addprefix $(ICU_BINPATH)/,$(ICU_DLLNAMES)))
  ifeq ($(USE_DSGW), 1)
    LIBS_TO_PKG_CLIENTS += $(addsuffix .$(DLL_SUFFIX),$(addprefix $(ICU_BINPATH)/,$(ICU_DLLNAMES)))
  endif
else
  ICU_LIBNAMES = icui18n icuuc icudata
  ICULINK = -L$(ICU_LIBPATH) $(addprefix -l, $(ICU_LIBNAMES))
  LIBS_TO_PKG += $(addsuffix .$(ICU_LIB_VERSION),$(addsuffix .$(DLL_SUFFIX),$(addprefix $(ICU_LIBPATH)/,$(addprefix lib,$(ICU_LIBNAMES)))))
  LIBS_TO_PKG_SHARED += $(addsuffix .$(ICU_LIB_VERSION),$(addsuffix .$(DLL_SUFFIX),$(addprefix $(ICU_LIBPATH)/,$(addprefix lib,$(ICU_LIBNAMES)))))
  ifeq ($(USE_DSGW), 1)
    LIBS_TO_PKG_CLIENTS += $(addsuffix .$(ICU_LIB_VERSION),$(addsuffix .$(DLL_SUFFIX),$(addprefix $(ICU_LIBPATH)/,$(addprefix lib,$(ICU_LIBNAMES)))))
  endif
#LIBS_TO_PKG = $(addsuffix $(addprefix lib,$(ICU_LIBNAMES))
endif

BINS_TO_PKG_SHARED += $(ICU_BINPATH)/uconv$(EXE_SUFFIX)

###########################################################

### DB component (Berkeley DB) ############################
DB_LIBNAME=lib$(DB_MAJOR_MINOR)
ifdef DB_SOURCE_ROOT
  DB_INCLUDE =$(DB_SOURCE_ROOT)/built
  DB_LIBPATH =$(DB_SOURCE_ROOT)/built/.libs
  DB_BINPATH =$(DB_SOURCE_ROOT)/built
else
  DB_INCLUDE =$(db_path_config)/include
  DB_LIBPATH =$(db_path_config)/lib
  DB_BINPATH =$(db_path_config)/bin
endif
ifeq ($(ARCH), WINNT)
  db_import_lib_suffix =$(LIB_SUFFIX)
  DB_LIB =$(DB_LIBPATH)/$(DB_LIBNAME).$(db_import_lib_suffix)
  DB_STATIC_LIB =$(DB_LIBPATH)/$(DB_LIBNAME).$(LIB_SUFFIX)
else	# not WINNT
  db_import_lib_suffix =$(DLL_SUFFIX)
  DB_LIB =-L$(DB_LIBPATH) -l$(DB_MAJOR_MINOR)
# XXXsspitzer: we need the spinlock symbols staticly linked in to libdb
  DB_STATIC_LIB =-L$(DB_LIBPATH) -ldbs
endif	# not WINNT

# libdb only needs to be in the server directory since only the server uses it
PACKAGE_SRC_DEST += $(wildcard $(DB_LIBPATH)/*.$(DLL_SUFFIX)) bin/slapd/server

### DB component (Berkeley DB) ############################

# must define dependencies last because they depend on the definitions above
ifeq ($(INTERNAL_BUILD), 1)
include $(BUILD_ROOT)/internal_comp_deps.mk
endif

#################################################
# User Sync Components
#################################################

# WIX MSI Tool kit #####################
WIX = wix-$(WIX_VERSION).zip
WIX_DEST = $(NSCP_DISTDIR_FULL_RTL)/wix
WIX_FILE = $(WIX_DEST)/$(WIX)
WIX_FILES = $(WIX)
WIX_RELEASE = $(COMPONENTS_DIR)/wix
WIX_DIR = $(WIX_RELEASE)/$(WIX_VERSION)
WIX_DEP = $(WIX_FILE)
WIX_REL_DIR=$(subst -bin,,$(subst .zip,,$(WIX)))

ifndef WIX_PULL_METHOD
WIX_PULL_METHOD = $(COMPONENT_PULL_METHOD)
endif

$(WIX_DEP): $(NSCP_DISTDIR_FULL_RTL) 
ifeq ($(ARCH), WINNT)
ifdef COMPONENT_DEPS
	echo "Inside ftppull"
	$(FTP_PULL) -method $(COMPONENT_PULL_METHOD) \
		-objdir $(WIX_DEST) -componentdir $(WIX_DIR) \
		-files $(WIX_FILES) -unzip $(WIX_DEST)
endif
	-@if [ ! -f $@ ] ; \
	then echo "Error: could not get component WIX files $@" ; \
	fi
else
	-@echo "WIX is not required except on Windows."
endif #WINNT

# java service wrapper for Password Sync #####################
WRAPPER = wrapper_win32_$(WRAPPER_VERSION).zip
WRAPPER_DEST = $(NSCP_DISTDIR_FULL_RTL)/wrapper
WRAPPER_FILE = $(WRAPPER_DEST)/$(WRAPPER)
WRAPPER_FILES = $(WRAPPER)
WRAPPER_RELEASE = $(COMPONENTS_DIR)/wrapper
WRAPPER_DIR = $(WRAPPER_RELEASE)/$(WRAPPER_VERSION)
WRAPPER_DEP = $(WRAPPER_FILE)
WRAPPER_REL_DIR=$(subst -bin,,$(subst .zip,,$(WRAPPER)))

ifndef WRAPPER_PULL_METHOD
WRAPPER_PULL_METHOD = $(COMPONENT_PULL_METHOD)
endif

$(WRAPPER_DEP): $(NSCP_DISTDIR_FULL_RTL) 
ifeq ($(ARCH), WINNT)
ifdef COMPONENT_DEPS
	echo "Inside ftppull"
	$(FTP_PULL) -method $(COMPONENT_PULL_METHOD) \
		-objdir $(WRAPPER_DEST) -componentdir $(WRAPPER_DIR) \
		-files $(WRAPPER_FILES) -unzip $(WRAPPER_DEST)
endif
	-@if [ ! -f $@ ] ; \
	then echo "Error: could not get component WRAPPER files $@" ; \
	fi
else
	-@echo "WRAPPER is not required except on Windows."
endif #WINNT


# swig for Password Sync #####################
SWIG = swigwin-$(SWIG_VERSION).zip
SWIG_DEST = $(NSCP_DISTDIR_FULL_RTL)/swig
SWIG_FILE = $(SWIG_DEST)/$(SWIG)
SWIG_FILES = $(SWIG)
SWIG_RELEASE = $(COMPONENTS_DIR)/swig
SWIG_DIR = $(SWIG_RELEASE)/$(SWIG_VERSION)
SWIG_DEP = $(SWIG_FILE)
SWIG_REL_DIR=$(subst -bin,,$(subst .zip,,$(SWIG)))
SWIG_EXE = $(SWIG_DEST)/SWIG-$(SWIG_VERSION)/swig.exe

ifndef SWIG_PULL_METHOD
SWIG_PULL_METHOD = $(COMPONENT_PULL_METHOD)
endif

$(SWIG_DEP): $(NSCP_DISTDIR_FULL_RTL) 
ifeq ($(ARCH), WINNT)
ifdef COMPONENT_DEPS
	echo "Inside ftppull"
	$(FTP_PULL) -method $(COMPONENT_PULL_METHOD) \
		-objdir $(SWIG_DEST) -componentdir $(SWIG_DIR) \
		-files $(SWIG_FILES) -unzip $(SWIG_DEST)

endif
	-@if [ ! -f $@ ] ; \
	then echo "Error: could not get component SWIG files $@" ; \
	fi
else
	-@echo "SWIG is not required except on Windows."
endif #WINNT

# apache ds for Password Sync #####################
APACHEDS = apacheds-main-$(APACHEDS_VERSION).jar
APACHEDSSRC = apacheds-$(APACHEDS_VERSION)-src.zip
APACHEDS_DEST = $(NSCP_DISTDIR_FULL_RTL)/apacheds
APACHEDS_FILE = $(APACHEDS_DEST)/$(APACHEDS)
APACHEDS_FILES = $(APACHEDS)
APACHEDSSRC_FILES = $(APACHEDSSRC)
APACHEDS_RELEASE = $(COMPONENTS_DIR)/apacheds
APACHEDS_DIR = $(APACHEDS_RELEASE)/$(APACHEDS_VERSION)
APACHEDS_DEP = $(APACHEDS_FILE)
APACHEDS_REL_DIR=$(subst -bin,,$(subst .jar,,$(APACHEDS)))
APACHEDSSOURCE = $(NSCP_DISTDIR_FULL_RTL)/apacheds/apacheds-$(APACHEDS_VERSION)


ifndef APACHEDS_PULL_METHOD
APACHEDS_PULL_METHOD = $(COMPONENT_PULL_METHOD)
endif

$(APACHEDS_DEP) : $(NSCP_DISTDIR_FULL_RTL) 
ifeq ($(ARCH), WINNT)
ifdef COMPONENT_DEPS
	echo "Inside ftppull"
	$(FTP_PULL) -method $(COMPONENT_PULL_METHOD) \
		-objdir $(APACHEDS_DEST) -componentdir $(APACHEDS_DIR) \
		-files $(APACHEDS_FILES)
	$(FTP_PULL) -method $(COMPONENT_PULL_METHOD) \
		-objdir $(APACHEDS_DEST) -componentdir $(APACHEDS_DIR) \
		-files $(APACHEDSSRC_FILES) -unzip $(APACHEDS_DEST)
endif
	-@if [ ! -f $@ ] ; \
	then echo "Error: could not get component APACHEDS files $@" ; \
	fi


else
	-@echo "APACHEDS is not required except on Windows."
endif #WINNT


# MAVEN for Password Sync #####################
MAVEN = maven-$(MAVEN_VERSION).zip
MAVEN_DEST = $(NSCP_DISTDIR_FULL_RTL)/maven
MAVEN_FILE = $(MAVEN_DEST)/$(MAVEN)
MAVEN_FILES = $(MAVEN)
MAVEN_RELEASE = $(COMPONENTS_DIR)/maven
MAVEN_DIR = $(MAVEN_RELEASE)/$(MAVEN_VERSION)
MAVEN_DEP = $(MAVEN_FILE)
MAVEN_REL_DIR=$(subst -bin,,$(subst .zip,,$(MAVEN)))

# CMD does not like the '/' in NSCP_DISTDIR_FULL_RTL, therefore the
# slashes need swapped to '\\'
MAVEN_EXE=cmd /c `echo $(NSCP_DISTDIR_FULL_RTL) | sed 's/\//\\\\/g'`\\maven\\$(MAVEN_REL_DIR)\\bin\\maven.bat
MAVEN_HOME=$(NSCP_DISTDIR_FULL_RTL)/maven/$(MAVEN_REL_DIR)

ifndef MAVEN_PULL_METHOD
MAVEN_PULL_METHOD = $(COMPONENT_PULL_METHOD)
endif

$(MAVEN_DEP): $(NSCP_DISTDIR_FULL_RTL) 
ifeq ($(ARCH), WINNT)
ifdef COMPONENT_DEPS
	echo "Inside ftppull"
	$(FTP_PULL) -method $(COMPONENT_PULL_METHOD) \
		-objdir $(MAVEN_DEST) -componentdir $(MAVEN_DIR) \
		-files $(MAVEN_FILES) -unzip $(MAVEN_DEST)
endif
	-@if [ ! -f $@ ] ; \
	then echo "Error: could not get component MAVEN files $@" ; \
	fi
else
	-@echo "MAVEN is not required except on Windows."
endif #WINNT