Hey folks. I also need Apache::Upload for a mod_perl script, and upgrading seemed like the only way to go about it. I downloaded the patch that Blair provided, but unfortunately, things did not go as easily as I might have hoped.
What follows is an explanation of what I went through to get this thing to package. You can skip down a bit if you just want a recipe of what I did. I unpacked libapreq2-2.04_03-dev.tar.gz (as obtained from Apache) and Blair's patch applied cleanly (with -p1). However, attempting to dpkg-buildpackage it resulted in lots of errors having to do with modperl_ types. I tried for a while to figure out what was wrong and pretty much gave up, deciding instead to see if I could just compile the apache supplied tar.gz. It didn't take me long to realize that, due to Debian's Apache 2 being named, well, apache2 (and not httpd), the configure script was somewhat confused. No problem; changing a line in acinclude.m4 and rerunning the buildconf script fixed this. Manually inspecting Blair's patch showed that he did this too. I then went ahead and perl Makefile.PL'd the sucker and watched the compilation messages shoot by. Until I was greeted with an error regarding a missing modperl_ include file. I had expected this, because of what Blair said, so following his lead I went ahead and built debian's supplied modperl2 locally on my machine (no problems there) and then copied over the requisite files. I then restarted the make and all was well: complilation completed, and make test passed all tests. Whew! Having done that, I figured that I should be able to simply take the debian/ related files out of Blair's patch and copy them into the source archive, dpkg-buildpackage, and all would be well. I was very wrong about this. It turns out that while the source archive will compile once, make distclean (after having copied in the modperl_ include files) will *not* clean the tree sufficiently to allow compilation again. In fact, the errors I got using Blair's patch were exactly the ones I got trying to make distclean && make -- and sure enough, inspection of his patch noted that he had included the various modperl_ include files. Blair, if you're reading this, explaining in more detail how exactly you went about getting this son of a bitch to compile would greatly sate my curiosity. At any rate, once I figured this out, I realized I could automate the entire build process by simply altering the debian/rules file to allow make to fail once, and then copy all the modperl_ headers in, and then restart the build. But because (for reasons I don't fully understand) copying in the header files in totally mucks up the build if you try to make distclean && make, the rules file can build only once. Since dpkg-buildpackage will first debian/rules build and then debian/rules binary, this meant that while it would build correctly the first time, binary would actually go ahead and rebuild it, for whatever reason. So I nuked the "build" predep on the binary-arch: rule, and switched my invoking command to dpkg-buildpackage -rfakeroot -B -us -uc. It then built correctly, but failed during installation. It turns out that the Makefile in the env/ subdirectory of the package uses apxs to install the module. This command completely ignores the DESTDIR variable passed to make, meaning that apxs2 doesn't play nice and it actually tries to install the module directly into /usr/lib/apache2 instead of into $(TMP)/usr/lib/apache2 as it ought to. My solution to this was to create a bin directory, and use perl to write wrappers around cp, chmod, ranlib, and grep to ensure that any absolute paths passed as arguments to these functions would be relocated to the $(TMP) directory. Make install then completed successfully, and doing it with dpkg-buildpackage worked as well. Ok, here it is, in steps. 1. Make a temp directory. Mine was /home/atp/pkgs/temp, if you see that anywhere, replace it with your temp directory. 2. Download Blair's patch and put it in that directory. 3. Download libapreq2-2.04_03-dev.tar.gz from Apache's website. 4. apt-get source libapache2-mod-perl2 5. Build mod perl2 (cd into the directory and type: dpkg-buildpackage -rfakeroot -us -uc You may need to install some of the build-depends packages to do this.) 6. In your temp directory, make a directory called incs, and then do cp -p /path/to/libapache2-mod-perl2-1.999.20/src/modules/perl/*.h \ /path/to/your/temp/dir/incs 7. You can delete the modperl source and related files now if you'd like to. 8. Extract the debian/ control files from Blair's patch. There are lots of ways to do this. I did it with an ed script (assuming your pwd is the temp dir): mkdir debian && for i in \ $(grep '^diff.*debian' 2.04-patch.txt | cut -f 3 -d ' '); do \ f=$(basename $i); echo "$f"; \ (echo "/$(echo "$i" | sed 's@/@\\/@g')/d"; echo "ka"; \ echo ".,/^diff/s/^+//"; echo "'a+3,.-1p"; echo "q") | \ ed -s 2.04-patch.txt > debian/$f; \ done All that does it take out the patches in the debian subdirectory. You could do it by hand, but I'm much too lazy to do that. 9. Make the debian/rules script executable: chmod 755 rules 10. Now, in your temp dir, mkdir bin, and create a perl script called fix_arguments.pl. Because it's a rather long script, I've placed it at the end of this e-mail. Make the script executable: chmod 755 fix_arguments.pl 11. In the bin directory, do for i in cp chmod grep ranlib; do ln -s fix_arguments.pl $i; done You should now have 4 symlinks in this dir, all linked to fix_arguments.pl. 12. Now, in the debian subdirectory of your temp dir, patch the rules file. I did this with an ed script again: (echo '[EMAIL PROTECTED]([EMAIL PROTECTED]"`pwd`/../bin:\$\$PATH" &@'; \ echo '45s/ build//'; echo '32a'; \ echo -e '\011-$(MAKE) OPTIMIZE="$(OPTIMIZE)" LD_RUN_PATH=""'; \ echo -e '\011$(CP) -p ../incs/*.h src/'; echo '.'; echo '17a'; \ echo 'ifndef CP'; echo 'CP = /bin/cp'; echo 'endif'; echo; \ echo '.'; echo 'w') | ed -s rules 13. Ok, now create the build-clean script (which I've attached below) in your temp directory. Make it executable (chmod 755 build-clean). At this point, your temp directory should look like this: /path/to/your/temp/directory/ 2.04-patch bin/ chmod -> fix_arguments.pl cp -> fix_arguments.pl fix_arguments.pl <- executable! grep -> fix_arguments.pl ranlib -> fix_arguments.pl build-clean <- executable! debian/ apreq.load changelog compat control copyright dirs rules <- executable! shlibs incs/ lots of modperl_ include files libapreq2-2.04_03-dev.tar.gz Ok, if you copied everything in correctly, type ./build-clean at the prompt. It should build and package the sucker. Note: after doing this whole process, I ar -x'ed the produced deb file and greped for my home directory, to make sure that none of the binaries have any references to my home dir. One did; /usr/lib/apache2/modules/mod_apreq.a. Note that this file is not even present in 2.03, for whatever reason. Messing around with objdump, I discovered that this string is present in in the .debug_str section. I'm not sure what this is for (though I presume it's for debugging, heh). The command to dump this data is objdump -j .debug_str -s mod_apreq.a Probably should pipe it through less. My home directory was stored around line 0760. I suppose I'll find out if this is a problem soon enough. Ok, the files. Remember to edit the $DIR variable in fix_arguments.pl to point to the actual location of your home dir. ----BEGIN build-clean ---- #!/bin/bash if [ -d libapreq2-2.04-dev ]; then echo "Removing existing directory..." rm -rf libapreq2-2.04-dev fi for i in libapreq2-perl*; do rm $i; done echo "Unpacking..." gzip -dc libapreq2-2.04_03-dev.tar.gz | tar -xf - cd libapreq2-2.04-dev echo "Patching acinclude.m4" (echo "38s/httpd/apache2"; echo "w"; echo "q") | ed -s acinclude.m4 echo "Patching env/Makefile.am ..." (echo "/-i -a -n apreq mod_apreq.la/s/-a -n/-n/p"; echo "w"; echo "q") | ed -s "env/Makefile.am" ./buildconf cp -R ../debian . cp -Rp ../incs modperl_incs echo "Now building the package..." dpkg-buildpackage -rfakeroot -B -uc -us ---- END build-clean ---- ---- BEGIN fix_arguments.pl ---- #!/usr/bin/perl -w use strict; use warnings; my $HOME = "/home/atp"; my $DIR = "$HOME/pkgs/temp/libapreq2-2.04-dev/debian/libapache2-request-perl"; my %cmds = ( "cp" => [ "/bin", 0, -1 ], "chmod" => [ "/bin", 1, -1 ], "ranlib" => [ "/usr/bin", 0, 0 ], "grep" => [ "/bin", 1, -1 ], ); sub fix_argument { my ($arg, $r) = @_; if ($arg =~ [EMAIL PROTECTED]/@ && $arg !~ [EMAIL PROTECTED]@) { $$r = 1; return "$DIR$arg"; } else { return "$arg"; } } sub get_program_name { my ($base); ($base = $0) =~ [EMAIL PROTECTED]/([^/]+)[EMAIL PROTECTED]@; return $base; } BEGIN: { my ($prog, $end, $i, $r); my (@newargs); $prog = &get_program_name(); exists $cmds{$prog} || die "No command information for $prog!\n"; print "This is fake $prog!\n"; $end = $cmds{$prog}->[2] < 0 ? $#ARGV : $cmds{$prog}->[2]; $r = 0; for ($i = 0; $i <= $#ARGV; $i++) { if ($i >= $cmds{$prog}->[1] && $i <= $end) { push @newargs, &fix_argument($ARGV[$i], \$r); } else { push @newargs, $ARGV[$i]; } } print "Rerouting to: $prog ", join(' ', @newargs), "\n" if $r; exec "$cmds{$prog}->[0]/$prog", @newargs; die "Unable to execute $cmds{$prog}->[0]/$prog!\n"; } 1; ---- END fix_arguments.pl ---- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]