Hi all,

I managed to build both the LDAP C SDK 5.1.6 and
PerLDAP 1.5b4 on windows... Yet I had some trouble
along the way.

First the environment :
- Windows XP Pro SP2
- Visual C++ 6 + SP5 + Processor Pack
- ActiveState Perl v5.8.6
- Cygwin

I tried to follow the guidelines at :
http://www.mozilla.org/directory/csdk.html

- First the checkout :
set CVSROOT=:pserver:[EMAIL PROTECTED]:/cvsroot
cvs login
(password anonymous)

cvs co -r NSPR_4_4_1_RTM mozilla/nsprpub
cvs co -r NSS_3_9_3_RTM mozilla/security/coreconf mozilla/security/nss
cvs co -r DBM_1_61_RTM mozilla/dbm mozilla/security/dbm
cvs co -r SVRCORE_4_0_RTM mozilla/security/svrcore
cvs co -r LDAPCSDK_5_1_6_RTM DirectorySDKSourceC

- then some more build tools :
Download
http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/wintools.zip

set MOZ_TOOLS=D:\moztools
set PATH=%PATH%;%MOZ_TOOLS%\bin
... and launch install.bat

- setup VC++ environment
"C:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT"

- switch to cygwin bash

- I wanted to build an optimized version, so I added
BUILD_OPT=1 in mozilla/security/coreconf/config.mk
(don't know if this is the right way, but at least this works)

- build NSS
cd mozilla/security/nss
make nss_build_all

- build SVRCORE
cd mozilla/security/svrcore
make

- NSS dist directory is dist/WINNT5.1_OPT.OBJ, the LDAP SDK expects
dist directly, so I moved everything from WINNT5.1_OPT.OBJ to dist

- then the LDAP SDK stuff, again optimized build
cd mozilla/directory/c-sdk
./configure --with-nss --enable-optimize --disable-debug
make


- the libutil library is needed by client tools but *not*
built automatically, sounds like a bug to me :

cd ldap/libraries/libutil
BUILD_OPT=1 in Makefile.client
make -f Makefile.client install

- again the target directory is dist/WINNT5.1_OPT.OBJ,
move everything to dist

- build client tools
cd mozilla/directory/c-sdk
make BUILDCLU=1 HAVE_SVRCORE=1

- the include files directories are not those expected
by PerLDAP, as a quick fix I moved public/ldap/*.h to include

- Now the PerLDAP part :
- the Makefile.PL does not work on windows, I patched
the library names :
diff PerLDAP-1.5.orig/Makefile.PL PerLDAP-1.5/Makefile.PL
42c42
< $libexts = "so|sl|a|lib";
---
 > $libexts = "so|sl|a|lib|dll";
100,102c100,102
<    @ldaplib = grep{/^ldap.*$/} @libs;
<    @prldaplib = grep{/^prldap.*$/} @libs;
<    @lberlib = grep{/^lber.*$/} @libs;
---
 >    @ldaplib = grep{/^(ns)?ldap.*$/} @libs;
 >    @prldaplib = grep{/^(prldap|nsldappr).*$/} @libs;
 >    @lberlib = grep{/^(ns)?lber.*$/} @libs;
104c104
<    @ldapslib = grep{/^ssldap.*$/} @libs if $ssl_def;
---
 >    @ldapslib = grep{/^(ssldap|nsldapssl).*$/} @libs if $ssl_def;
191,192c191,192
<    $my_extlib = "$lib_ldap\\$ldaplib[0]";
<    $my_extlib .= " $lib_ldap\\$lberlib[0]" if $#lberlib >= 0;
---
 >    $my_extlib = "$lib_ldap\\$ldaplib[0].lib";
 >    $my_extlib .= " $lib_ldap\\$lberlib[0].lib" if $#lberlib >= 0;


- internal_sortcmp_proc LDAPCALL marker and StrCaseCmp signature do
not suit VC++ compiler, patched API.xs :
diff PerLDAP-1.5.orig/API.xs PerLDAP-1.5/API.xs
585d584
< LDAP_CALL
1252,1253c1251
<        int        (*func)() = &StrCaseCmp;
<
---
 >        int        (*func)(const char *s, const char *t) = &StrCaseCmp;
1627c1625
<        int        (*func)() = &StrCaseCmp;
---
 >        int        (*func)(const char *s, const char *t) = &StrCaseCmp;

- And another little bug in Conn.pm :
diff PerLDAP-1.5.orig/Conn.pm PerLDAP-1.5/Conn.pm
81a82
 >       $self->{"entryclass"} = 'Mozilla::LDAP::Entry';
(the non hash constructor did not set the default entryclass)

- set VC++ env (if not already done)
"C:\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT"
- check that the perl in PATH is Activestate and not cygwin :
which perl
- set PerLDAP environment
set LDAPSDKDIR=D:\cvs\mozilla\ldapcsdk5.1.6-WINNT5.1_OPT.OBJ
set LDAPSDKSSL=Y
set LDAPPR=Y
- build (use nmake)
perl Makefile.PL
nmake

- add ldapcsdk libraries (quick but not clean ;-) )
copy %LDAPSDKDIR%\lib\*.dll blib\arch\auto\Mozilla\LDAP\API
- build ppm
tar cvf package.tar blib
gzip --best package.tar
nmake ppd
- install ppm
ppm install PerLDAP.ppd
- enjoy ;-)

Is there any commiter out there to look at the issues I faced and
the fixes I suggest for some of them ?


--
Mickael Guessant
Technical Architect
http://mguessan.free.fr
mailto:[EMAIL PROTECTED]
_______________________________________________
mozilla-directory mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-directory

Reply via email to