You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "William A. Rowe, Jr." <wr...@lnd.com> on 2000/04/20 04:15:20 UTC

[PATCH 2.0] WinBuild - The End of the long and winding discussion (I hope!)

Ok... here is my final patch to the overall project structure,
let's put this thing to bed so I and others can move on with
our coding (there seems to be many bad Win32 CGI things going on!)

Please commit it... other's are welcome to build on this.
I do have one patch once this is committed... I will fix
the htdigest/logresolve modules to build on Win32, and
the htpasswd to build on apr (if it doesn't already).
That should make us ready for a -good- Win32 alpha!

1) Implement new src/os/win32/BaseAddr.ref for all offsets.
   Addresses concerns that binaries should be consistent from
   build to build, base addresses are centralized in a single
   file, and relocations won't be an issue.

2) aprlib.dsp becomes a static library in src/lib/apr/Lib[D|R].
   All apr source remains in this project, to minimize confusion.
   aprlib.def must move to the actual dll project. Standalone
   executables (p/w support and install files) and other binaries
   using a -minimal- set of functions may link here.

3) Move gen_test_char.exe and gen_uri_delim.exe pipes into the
   ApacheCore project, as custom actions, not post build steps.
   See success in apr.hw->apr.h custom actions.  This eliminates
   extra cleanup from makefile.win.

4) Implement new src/lib/apr/aprlibdll.dsp to build the actual
   aprlib.dll.  The location remains src/lib/apr/[Debug|Release],
   and the aprlib.def file moves into this project.  Only the
   empty src/lib/apr/misc/win32/aprlib.c source file is included
   to eliminate compiler warning of no objects to link.

5) Implement new src/InstallBin.dsp to wrap the makefile.win for
   the copy functions.  Default INSTDIR folder is set to ../ to
   simplify building and installing multiple versions or deveopment
   iterations, but this may be changed by the user to simplify
   their life.

6) Create the src/Apache.dsw workspace.  The top target is
   InstallBin.dsp, which carries dependencies on all projects.
   Each project is dependent on the libraries and modules it
   links to.  There must be no dependencies on broken sources
   (htdigest, logresolve, ApacheModuleProxy and ApacheModuleInfo).

------------------

The two patches for htdigest and logresolve will drop in tommorow.

The advantage to aprlib/aprlibdll is that the library is always
called aprlib.lib, just link to the correct folder for your
desired result (LibD/LibR/Debug/Release).

BTW - don't overthink this... if you would rather see apr.lib/apr.dll
wait for this patch to be applied, then propose it as it's own patch.
I didn't change the name of this project since I felt that was it's
own issue.  I also didn't add, but support, Greg's build directory
tree overhaul.  That too should be a seperate patch.

I KNOW this patch will be harder to review.  This is the diff between
the aprlib.dsp and aprlibdll.dsp, since aprlibdsp was cloned from the
aprlib settings, and you won't waste as much time reviewing the new
aprlibdll.dsp file...

--- d:aprlib.dsp	Mon Apr 17 13:20:43 2000
+++ aprlibdll.dsp	Wed Apr 19 17:39:38 2000
@@ -1,24 +1,26 @@
-# Microsoft Developer Studio Project File - Name="aprlib" - Package Owner=<4>
+# Microsoft Developer Studio Project File - Name="aprlibdll" - Package Owner=<4>
 # Microsoft Developer Studio Generated Build File, Format Version 5.00
 # ** DO NOT EDIT **

 # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102

-CFG=aprlib - Win32 Debug
+CFG=aprlibdll - Win32 Debug
 !MESSAGE This is not a valid makefile. To build this project using NMAKE,
 !MESSAGE use the Export Makefile command and run
 !MESSAGE
-!MESSAGE NMAKE /f "aprlib.mak".
+!MESSAGE NMAKE /f "aprlibdll.mak".
 !MESSAGE
 !MESSAGE You can specify a configuration when running NMAKE
 !MESSAGE by defining the macro CFG on the command line. For example:
 !MESSAGE
-!MESSAGE NMAKE /f "aprlib.mak" CFG="aprlib - Win32 Debug"
+!MESSAGE NMAKE /f "aprlibdll.mak" CFG="aprlibdll - Win32 Debug"
 !MESSAGE
 !MESSAGE Possible choices for configuration are:
 !MESSAGE
-!MESSAGE "aprlib - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "aprlib - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "aprlibdll - Win32 Release" (based on\
+ "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "aprlibdll - Win32 Debug" (based on\
+ "Win32 (x86) Dynamic-Link Library")
 !MESSAGE

 # Begin Project
@@ -28,7 +30,7 @@
 MTL=midl.exe
 RSC=rc.exe

-!IF  "$(CFG)" == "aprlib - Win32 Release"
+!IF  "$(CFG)" == "aprlibdll - Win32 Release"

 # PROP BASE Use_MFC 0
 # PROP BASE Use_Debug_Libraries 0
@@ -52,10 +54,10 @@
 # ADD BASE BSC32 /nologo
 # ADD BSC32 /nologo
 LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo /base:"0x278A0000" /subsystem:windows /dll /map
/machine:I386
-# ADD LINK32 kernel32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo /base:"0x278A0000" /subsystem:windows /dll /map /machine:I386
+# ADD BASE LINK32 aprlib.lib kernel32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo /base:@"..\..\os\win32\BaseAddr.ref",aprlib
/subsystem:windows /dll /map /machine:I386 /out:"Release/aprlib.dll" /libpath:"LibR"
+# ADD LINK32 aprlib.lib kernel32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo /base:@"..\..\os\win32\BaseAddr.ref",aprlib
/subsystem:windows /dll /map /machine:I386 /out:"Release/aprlib.dll" /libpath:"LibR"

-!ELSEIF  "$(CFG)" == "aprlib - Win32 Debug"
+!ELSEIF  "$(CFG)" == "aprlibdll - Win32 Debug"

 # PROP BASE Use_MFC 0
 # PROP BASE Use_Debug_Libraries 1
@@ -79,320 +82,24 @@
 # ADD BASE BSC32 /nologo
 # ADD BSC32 /nologo
 LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo /base:"0x278A0000" /subsystem:windows /dll /map /debug
/machine:I386
-# ADD LINK32 kernel32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo /base:"0x278A0000" /subsystem:windows /dll /map /debug
/machine:I386
+# ADD BASE LINK32 aprlib.lib kernel32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo /base:@"..\..\os\win32\BaseAddr.ref",aprlib
/subsystem:windows /dll /map /debug /machine:I386 /out:"Debug/aprlib.dll" /libpath:"LibD"
+# ADD LINK32 aprlib.lib kernel32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo /base:@"..\..\os\win32\BaseAddr.ref",aprlib
/subsystem:windows /dll /map /debug /machine:I386 /out:"Debug/aprlib.dll" /libpath:"LibD"
 !ENDIF

 # Begin Target

 # Name "aprlibdll - Win32 Release"
 # Name "aprlibdll - Win32 Debug"
===
===[ALL SOURCES STRIPPED AND REPLACED WITH]
===
 # Begin Source File

+SOURCE=.\misc\win32\aprlib.c
 # End Source File
 # Begin Source File

 SOURCE=.\aprlib.def
 # End Source File
 # End Target
 # End Project


Re: [PATCH 2.0] WinBuild - The End of the long and winding discussion (I hope!)

Posted by Bill Stoddard <st...@raleigh.ibm.com>.
> > > our coding (there seems to be many bad Win32 CGI things going on!)
> >
> > What are you seeing? I am pretty familier with the code so
> > maybe it is a
> > quick fix. At one time is was working reasonable well but I
> > may have broken
> > it with the non-blocking pipes.
>
> Specifically, .bat files (without a shebang, which they shouldn't
> require), won't work.  I've created a little echoline to toss
> newlines at the console, and tried to launch the following:
>

Ahh, okay. Yes, there is a lot that could be done better when it comes to supporting Win32
isms.

Bill


RE: [PATCH 2.0] WinBuild - The End of the long and winding discussion (I hope!)

Posted by "William A. Rowe, Jr." <wr...@lnd.com>.
> > our coding (there seems to be many bad Win32 CGI things going on!)
> 
> What are you seeing? I am pretty familier with the code so 
> maybe it is a
> quick fix. At one time is was working reasonable well but I 
> may have broken
> it with the non-blocking pipes.

Specifically, .bat files (without a shebang, which they shouldn't
require), won't work.  I've created a little echoline to toss 
newlines at the console, and tried to launch the following:

@ECHO OFF
echo Content-type: text/plain
echoline
echo CGI/1.0 test script report:
echoline
echo argc is $#. argv is "$*".
echoline
echo SERVER_SOFTWARE = %SERVER_SOFTWARE%
echo SERVER_NAME = %SERVER_NAME%
echo GATEWAY_INTERFACE = %GATEWAY_INTERFACE%
echo SERVER_PROTOCOL = %SERVER_PROTOCOL%
echo SERVER_PORT = %SERVER_PORT%
echo REQUEST_METHOD = %REQUEST_METHOD%
echo HTTP_ACCEPT = %HTTP_ACCEPT%
echo PATH_INFO = %PATH_INFO%
echo PATH_TRANSLATED = %PATH_TRANSLATED%
echo SCRIPT_NAME = %SCRIPT_NAME%
echo QUERY_STRING = %QUERY_STRING%
echo REMOTE_HOST = %REMOTE_HOST%
echo REMOTE_ADDR = %REMOTE_ADDR%
echo REMOTE_USER = %REMOTE_USER%
echo AUTH_TYPE = %AUTH_TYPE%
echo CONTENT_TYPE = %CONTENT_TYPE%
echo CONTENT_LENGTH = %CONTENT_LENGTH%

It fails horribly.

I've walked the code path and am 80% sure what's left to be done.
BTW - it's mapped with AddHandler cgi-script .bat

This should have been a no brainer.  But of course we can't directly
launch it.

This is what I have so far... but it's far from complete...


Index: apache-2.0/src/main/http_core.c
===================================================================
RCS file: /cvs/apache/apache-2.0/src/main/http_core.c,v
retrieving revision 1.48
diff -u -r1.48 http_core.c
--- http_core.c	2000/04/14 15:58:55	1.48
+++ http_core.c	2000/04/19 23:01:18
@@ -853,8 +853,11 @@
     }
     ext = strrchr(exename, '.');
 
+    /* Todo - WRONG - not eFileTypeEXE32 but eFileTypeSCRIPT */
     if (ext && (!strcasecmp(ext,".bat") || !strcasecmp(ext,".cmd"))) {
-        return eFileTypeEXE32;
+        *interpreter = ap_pstrcat(r->pool, getenv("COMSPEC"), " /c ", NULL);
+        if (*interpreter)
+            return eFileTypeSCRIPT;
     }
 
     /* If the file has an extension and it is not .com and not .exe and

Of course there is more too it than this... it's wigged.

I'll finish it later this week, if someone else (hint hint) will clean
up what I've already thrown up unopposed.  And yes, I noted the one
objection to having a static library at all, and almost capitulated,
until I remembered there is -no friggin way- we will run install.dll
against an apr.lib, and that's our own module.

I'm dead set against -ever again- calling the same source code into
multiple projects, as install.dll and the support tree has done in
the past.  Link to libraries, easy as that.

By the way, when you try this patch (not the cgi - the aprlib/aprlibdll)
and don't finally fix the string exports, you will see it crash and
burn.  I've harped that fix a few times :-)

RE: CGI workups (was WinBuild)

Posted by "William A. Rowe, Jr." <wr...@lnd.com>.
> From: Bill Stoddard [mailto:stoddard@raleigh.ibm.com]
> Sent: Thursday, April 20, 2000 9:53 AM
> 
> > our coding (there seems to be many bad Win32 CGI things going on!)
> 
> What are you seeing? I am pretty familier with the code so 
> maybe it is a
> quick fix. At one time is was working reasonable well but I 
> may have broken
> it with the non-blocking pipes.

My other biggie is to create a mapping table function to allow
administrators to quickly map, say, all /usr/bin/perl to 
/home/usr/bin/perl (or for windows folks, map /usr/bin/perl
to c:\program files\perl\bin\perl :-)

This is a big hangup I have provided all the websites I cross
test and code for... when silly things like that change alot
I'm always forgetting to trip it.

I'm also less than pleased with any of the registry handling
stuff, since everything after the %1 script name argument is
lopped off (and may be critical, such as a perl switch).  
I'd also like to see an override (or exclusive control) option 
within the registry, to override today's options:

HKEY_CLASSES_ROOT
    \perlfile
         \shell
              \open
                   \command  commandstring

with something like

HKEY_CLASSES_ROOT
    \perlfile
         \shell (possibly httpd or apache instead)
              \ExecCGI
                   \command  commandstring

which would allow web admins not to worry about people trying
to serve up .doc files with notepad :-)  The advantage to 
keeping shell is that they could edit these with the Windows
Explorer options dialog.

Just ideas I'm playing with.

Re: [PATCH 2.0] WinBuild - The End of the long and winding discussion (I hope!)

Posted by Bill Stoddard <st...@raleigh.ibm.com>.
> our coding (there seems to be many bad Win32 CGI things going on!)

What are you seeing? I am pretty familier with the code so maybe it is a
quick fix. At one time is was working reasonable well but I may have broken
it with the non-blocking pipes.

Bill


RE: [PATCH 2.0] WinBuild - The End of the long and winding discussion (I hope!)

Posted by "William A. Rowe, Jr." <wr...@lnd.com>.
> From: William A. Rowe, Jr. [mailto:wrowe@lnd.com]
> Sent: Wednesday, April 19, 2000 9:15 PM
> 
> Ok... here is my final patch to the overall project structure,
> let's put this thing to bed so I and others can move on with
> our coding (there seems to be many bad Win32 CGI things going on!)
> 
How could I forget :-)

7) Eliminate -ALL- makefiles from distribution.  Modify the
   win_compiling.html doc to that effect.

TODO: Change build notes to inform Win32 roller that the release
      requires all .mak files to be exported to the .zip package 
      from the Apache.dsw workspace, for those with less than
      sufficient skill to try this themselves.


RE: [PATCH 2.0] WinBuild - The End of the long and winding discussion (I hope!)

Posted by "William A. Rowe, Jr." <wr...@lnd.com>.
One minor ommission...  

-- New file src/lib/apr/misc/win32/aprlib.c --
/*
 * Placeholder to force aprlib.dll creation with no LNK4001 error
 *
 * However, this isn't a bad place to store dynamic-only functions 
 * that determine which version of apr the application has loaded.
 * These functions are of (less?) importance to static-bound apps.
 */
-- End of new src/lib/apr/misc/win32/aprlib.c --