view · edit · sidebar · attach · print · history

mswin32 support for mod_ruby

 http://lists.modruby.net/ml/archive/modruby-ja/200501.month/429.html
 http://mattn.kaoriya.net/software/lang/ruby/20081010193230.htm

The Makefile for nmake is

APACHE_ROOT=C:\Apache2.2
RUBY_ROOT=C:\Ruby
SRCS = \
      apache_cookie.c \
      apache_multipart_buffer.c \
      apache_request.c \
      apachelib.c \
      array_header.c \
      bucket.c \
      connection.c \
      cookie.c \
      error.c \
      mod_ruby.c \
      multival.c \
      paramtable.c \
      request.c \
      ruby_config.c \
      ruby_shared_stub.c \
      server.c \
      table.c \
      upload.c \
      uri.c

OBJS = $(SRCS:.c=.obj)
CFLAGS=/I"$(APACHE_ROOT)\include" /I"$(RUBY_ROOT)\lib\ruby\1.8\i386-mswin32_100" /DWIN32 /nologo
LDFLAGS=/LIBPATH:"$(APACHE_ROOT)\lib" /LIBPATH:"$(RUBY_ROOT)\lib"
LIBS= libapr-1.lib libaprutil-1.lib libhttpd.lib msvcr-ruby18.lib

.SUFFIXES: .c .obj

all : mod_ruby.so

.c.obj:
        cl /c $(CFLAGS) /Fo$@ $<

mod_ruby.so : $(OBJS)
        link /nologo /DLL /OUT:$@ /EXPORT:ruby_module $(OBJS) $(LDFLAGS) $(LIBS)

clean :
        -@del /Q *.obj *.so

The Makefile for MinGW is

APACHE_ROOT=C:\Program Files\Apache Software Foundation\Apache2.2
RUBY_ROOT=C:\Ruby
SRCS = \
    apache_cookie.c \
    apache_multipart_buffer.c \
    apache_request.c \
    apachelib.c \
    array_header.c \
    bucket.c \
    connection.c \
    cookie.c \
    error.c \
    mod_ruby.c \
    multival.c \
    paramtable.c \
    request.c \
    ruby_config.c \
    ruby_shared_stub.c \
    server.c \
    table.c \
    upload.c \
    uri.c

OBJS = $(SRCS:.c=.o)
CFLAGS=-I"$(APACHE_ROOT)\include" -I"$(RUBY_ROOT)\lib\ruby\1.8\i386-mswin32" -DWIN32
LDFLAGS=-L"$(APACHE_ROOT)\lib" -L"$(RUBY_ROOT)\lib"
LIBS= -llibapr-1 -llibaprutil-1 -llibhttpd -lmsvcrt-ruby18

.SUFFIXES: .c .o

all : mod_ruby.so

.c.o:
    gcc -c $(CFLAGS) -o $@ $<

mod_ruby.so : $(OBJS)
    gcc -shared -o $@ $(OBJS) $(LDFLAGS) $(LIBS)

clean :
    -@rm -f *.o *.so

the MinGW version almost works. Still the mode_t error.

 https://gist.github.com/804475

Some Info on DLL linking

 http://sig9.com/node/35

this may help for understanding the _imp__ errors you get from make with mingw

 http://sourceware.org/binutils/docs/ld/WIN32.html

figuring out the links

 http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs/existingDLL.html

edll has some nice diagrams

 http://edll.sourceforge.net/#latest_news
view · edit · sidebar · attach · print · history
Page last modified on February 02, 2011, at 04:09 PM