# httpd-modules-dev mailing list archives

##### Site index · List index
Message view
Top
Subject Re: Compiling httpd module for Windows
Date Wed, 27 May 2015 11:51:44 GMT
Hi Jeff,

I finally had some time to follow the instructions you gave me.
And... it compiled! Great!

Did take me another 4.5 hours btw.
Half of that time got into rewriting the source code for MSVC; the other half into finding
out why my 32-bit compilation didn't link correctly against my 64-bit Apache httpd. sigh.

I learned a lot, and couldn't have done it without your assistance. Thanks!

Kind regards,

Op 22 mei 2015, om 21:39 heeft Jeff Trawick <trawick@gmail.com> het volgende geschreven:

wrote:

> Hi list members,
>
> I created a simple httpd module in C, called mod_cfml. It is a port of a
> Perl-based one, which was written by Jordan Michaels. I teamed up with him
> to do some updates and do the port.
> - original mod_cfml.PM:
> https://github.com/utdream/mod_cfml/blob/master/perl/mod_cfml.pm <
> https://github.com/utdream/mod_cfml/blob/master/perl/mod_cfml.pm>
> - new mod_cfml.SO:
>
> Reason I am writing to the list, is my inability to compile this module
> for Windows.  I am not a much experienced C coder, hope the code doesn't
> show that though. I tried multiple options, and spent over 16 hours in
> trying to get the module compiled on Windows. But to no avail.  On other
> platforms, I just use apxs, and it works like a charm.
>
> Bluntly asked: would somebody on this list be willing to compile this code
> for me/the project, for Apache 2.4 on Windows 32/64 bit? Or show me a
> working way how to do it myself?
> The project is 100% free opensource software, meant to help people, not to
> make money :)
>
> Thanks in advance, kind regards,
>
>
>
apxs for Windows: http://svn.apache.org/viewvc/perl/apxs/trunk/

I prefer cmake.  This should work reasonably if your httpd install looks
like the one installed with the cmake build:  (probably stuff is in the
right place)

If you try this and it works, let me know; I could put the generic one
(i.e., not "cfml") on Github with a license and readme with a pointer in
the script.  I don't know if this is really enough code to have a license
for; my only concern is that I wouldn't want anyone to see this with some
other code and think that it is not free to use more widely than the code
they found it with.

------------- CMakeLists.txt --------------
PROJECT(MODS C)

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

SET(modnames cfml)

INCLUDE_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/include) FOREACH(shortname${modnames})
SET(modbase "mod_${shortname}") SET(modbasename "${modbase}.c")
ADD_LIBRARY(${modbase} SHARED${modbasename})
SET_TARGET_PROPERTIES(${modbase} PROPERTIES SUFFIX .so) TARGET_LINK_LIBRARIES(${modbase}
"${CMAKE_INSTALL_PREFIX}/lib/libhttpd.lib" "${CMAKE_INSTALL_PREFIX}/lib/libapr-1.lib"
"${CMAKE_INSTALL_PREFIX}/lib/libaprutil-1.lib") INSTALL(TARGETS${modbase} RUNTIME DESTINATION modules)
ENDFOREACH()
----------------- end ---------------------------------

Put this CMakeLists.txt file in the directory with your source.

In MS Visual Studio command prompt:

mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=\path\to\httpd\install -G "NMake Makefiles"
-DCMAKE_BUILD_TYPE=RelWithDebInfo \path\to\your\source
nmake && nmake install

--/--
--
Born in Roswell... married an alien...
http://emptyhammock.com/


Mime
View raw message