Index: /trunk/essentials/dev-lang/perl/Makefile.kmk
===================================================================
--- /trunk/essentials/dev-lang/perl/Makefile.kmk	(revision 3222)
+++ /trunk/essentials/dev-lang/perl/Makefile.kmk	(revision 3223)
@@ -5,5 +5,5 @@
 GMAKE ?= $(PATH_KBUILD_BIN)/kmk_gmake$(HOSTSUFF_EXE)
 
-				
+
 EXTRAS :=
 ifndef NOT_BOOTSTRAPPING_KNIX
@@ -19,4 +19,10 @@
 endif
 
+#
+# The usual targets.
+#
+
+# configuring
+.PHONY: config
 config:
 	$(RM) -f config.sh Policy.sh
@@ -36,8 +42,42 @@
 		-Dcf_by='kNIX'
 		
+# building
+.PHONY: build
 build:
 	+$(GMAKE) MAKE=$(GMAKE)
 
+# testing
+.PHONY: check test
 check test:
 	+$(GMAKE) MAKE=$(GMAKE) test
 
+# installation
+.PHONY: install
+install:
+	+$(GMAKE) MAKE=$(GMAKE) \
+		INSTALLPREFIXEXP=$(PATH_INS)/usr \
+		bin=$(PATH_INS)/usr/bin \
+		scriptdir=$(PATH_INS)/usr/bin \
+		shrpdir=$(PATH_INS)/usr/lib/perl5/5.8.8/os2/CORE \
+		privlib=$(PATH_INS)/usr/lib/perl5/5.8.8 \
+		man1dir=$(PATH_INS)/usr/share/man/man1 \
+		man3dir=$(PATH_INS)/usr/share/man/man3 \
+		\
+		DESTDIR=$(PATH_INS) \
+		INSTALLFLAGS="-V" \
+		\
+		install
+# packing
+.PHONY: pass_packing
+pass_packing: defaultpacking
+
+
+#
+# perl specific.
+#
+
+.PHONY: depend
+depend:
+	$(RMDIR)  $(wildcard .depending ./*/.depending ./*/*/.depending ./*/*/*/.depending)
+	+$(GMAKE) MAKE=$(GMAKE) depend
+
Index: /trunk/essentials/dev-lang/perl/installman
===================================================================
--- /trunk/essentials/dev-lang/perl/installman	(revision 3222)
+++ /trunk/essentials/dev-lang/perl/installman	(revision 3223)
@@ -46,9 +46,36 @@
 die $usage if $opts{help};
 
-$opts{man1dir} = "$opts{destdir}$Config{'installman1dir'}"
+my %MyConfig;
+$MyConfig{'installbin'}      = $Config{'installbin'};
+$MyConfig{'installscript'}   = $Config{'installscript'};
+$MyConfig{'installarchlib'}  = $Config{'installarchlib'};
+$MyConfig{'installsitelib'}  = $Config{'installsitelib'};
+$MyConfig{'installsitearch'} = $Config{'installsitearch'};
+$MyConfig{'installprivlib'}  = $Config{'installprivlib'};
+$MyConfig{'installman1dir'}  = $Config{'installman1dir'};
+$MyConfig{'installman3dir'}  = $Config{'installman3dir'};
+if ($^O eq 'os2' && "$opts{destdir}" ne '') {
+    # Drop the /@unixroot bit if not installing to the unixroot.
+    my $unixroot = '/@unixroot';
+    $MyConfig{'installbin'}      =~ s/^$unixroot//;
+    $MyConfig{'installscript'}   =~ s/^$unixroot//;
+    $MyConfig{'installarchlib'}  =~ s/^$unixroot//;
+    $MyConfig{'installsitelib'}  =~ s/^$unixroot//;
+    $MyConfig{'installsitearch'} =~ s/^$unixroot//;
+    $MyConfig{'installprivlib'}  =~ s/^$unixroot//;
+    $MyConfig{'installman1dir'}  =~ s/^$unixroot//;
+    $MyConfig{'installman3dir'}  =~ s/^$unixroot//;
+    #$Config{'archlibexp'}      =~ s/^$unixroot//;
+    #$Config{'privlibexp'}      =~ s/^$unixroot//;
+    #$Config{'scriptdir'}       =~ s/^$unixroot//;
+    #$Config{'sitearchexp'}     =~ s/^$unixroot//;
+    #$Config{'sitelibexp'}      =~ s/^$unixroot//;
+}
+
+$opts{man1dir} = "$opts{destdir}$MyConfig{'installman1dir'}"
     unless defined($opts{man1dir}); 
 $opts{man1ext} = $Config{'man1ext'}
     unless defined($opts{man1ext}); 
-$opts{man3dir} = "$opts{destdir}$Config{'installman3dir'}"
+$opts{man3dir} = "$opts{destdir}$MyConfig{'installman3dir'}"
     unless defined($opts{man3dir}); 
 $opts{man3ext} = $Config{'man3ext'}
@@ -62,11 +89,11 @@
 -x  "./perl$Config{exe_ext}" 
   or warn "./perl$Config{exe_ext} not found!  Have you run make?\n";
--d  "$opts{destdir}$Config{'installprivlib'}"
-	|| warn "Perl library directory $Config{'installprivlib'} not found.
+-d  "$opts{destdir}$MyConfig{'installprivlib'}"
+	|| warn "Perl library directory $MyConfig{'installprivlib'} not found.
 		Have you run make install?.  (Installing anyway.)\n";
 -x "t/perl$Config{exe_ext}"		|| warn "WARNING: You've never run 'make test'!!!",
 	"  (Installing anyway.)\n";
 
-$packlist = ExtUtils::Packlist->new("$opts{destdir}$Config{installarchlib}/.packlist");
+$packlist = ExtUtils::Packlist->new("$opts{destdir}$MyConfig{installarchlib}/.packlist");
 
 
Index: /trunk/essentials/dev-lang/perl/installperl
===================================================================
--- /trunk/essentials/dev-lang/perl/installperl	(revision 3222)
+++ /trunk/essentials/dev-lang/perl/installperl	(revision 3223)
@@ -183,12 +183,39 @@
 	if $patchlevel != $Config{'PERL_VERSION'};
 
+my %MyConfig;
+$MyConfig{'installbin'}      = $Config{'installbin'};
+$MyConfig{'installscript'}   = $Config{'installscript'};
+$MyConfig{'installarchlib'}  = $Config{'installarchlib'};
+$MyConfig{'installsitelib'}  = $Config{'installsitelib'};
+$MyConfig{'installsitearch'} = $Config{'installsitearch'};
+$MyConfig{'installprivlib'}  = $Config{'installprivlib'};
+$MyConfig{'installman1dir'}  = $Config{'installman1dir'};
+$MyConfig{'installman3dir'}  = $Config{'installman3dir'};
+if ($^O eq 'os2' && "$destdir" ne '') {
+    # Drop the /@unixroot bit if not installing to the unixroot.
+    my $unixroot = '/@unixroot';
+    $MyConfig{'installbin'}      =~ s/^$unixroot//;
+    $MyConfig{'installscript'}   =~ s/^$unixroot//;
+    $MyConfig{'installarchlib'}  =~ s/^$unixroot//;
+    $MyConfig{'installsitelib'}  =~ s/^$unixroot//;
+    $MyConfig{'installsitearch'} =~ s/^$unixroot//;
+    $MyConfig{'installprivlib'}  =~ s/^$unixroot//;
+    $MyConfig{'installman1dir'}  =~ s/^$unixroot//;
+    $MyConfig{'installman3dir'}  =~ s/^$unixroot//;
+    #$Config{'archlibexp'}      =~ s/^$unixroot//;
+    #$Config{'privlibexp'}      =~ s/^$unixroot//;
+    #$Config{'scriptdir'}       =~ s/^$unixroot//;
+    #$Config{'sitearchexp'}     =~ s/^$unixroot//;
+    #$Config{'sitelibexp'}      =~ s/^$unixroot//;
+}
+
 # Fetch some frequently-used items from %Config
-my $installbin = "$destdir$Config{installbin}";
-my $installscript = "$destdir$Config{installscript}";
-my $installprivlib = "$destdir$Config{installprivlib}";
-my $installarchlib = "$destdir$Config{installarchlib}";
-my $installsitelib = "$destdir$Config{installsitelib}";
-my $installsitearch = "$destdir$Config{installsitearch}";
-my $installman1dir = "$destdir$Config{installman1dir}";
+my $installbin = "$destdir$MyConfig{installbin}";
+my $installscript = "$destdir$MyConfig{installscript}";
+my $installprivlib = "$destdir$MyConfig{installprivlib}";
+my $installarchlib = "$destdir$MyConfig{installarchlib}";
+my $installsitelib = "$destdir$MyConfig{installsitelib}";
+my $installsitearch = "$destdir$MyConfig{installsitearch}";
+my $installman1dir = "$destdir$MyConfig{installman1dir}";
 my $man1ext = $Config{man1ext};
 my $libperl = $Config{libperl};
@@ -309,4 +336,22 @@
     $packlist->{"$installbin/$perldll"} = { type => 'file' };
 } # if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin)
+elsif ($^O eq 'os2') {
+    # Install the DLL
+    my $perldll = `cat imp_version | tr -d '\r\n'`;
+    if ($perldll ne '') {
+        $perldll .= ".dll";
+    } else {
+        print "warning: imp_version is missing...";
+        my @perldllfiles;
+        @perldllfiles = <perl*.dll>;
+        $perldll = pop @perldllfiles;
+        die 'error: cannot find the perl dll!' if $perldll eq '';
+    }
+
+    safe_unlink("$installbin/../lib/$perldll");
+    copy("$perldll", "$installbin/../lib/$perldll");
+    chmod(0644, "$installbin/../lib/$perldll");
+    $packlist->{"$installbin/../lib/$perldll"} = { type => 'file' };
+}
 
 # First we install the version-numbered executables.
