httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@gmail.com>
Subject Re: Compiling httpd module for Windows
Date Fri, 22 May 2015 19:39:01 GMT
On Fri, May 22, 2015 at 3:15 PM, Paul Klinkenberg <paul@ongevraagdadvies.nl>
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:
> https://github.com/paulklinkenberg/mod_cfml/blob/develop/C/mod_cfml.c <
> https://github.com/paulklinkenberg/mod_cfml/blob/develop/C/mod_cfml.c>
>
> 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,
>
> Paul Klinkenberg
>
>
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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message