[Xapian-discuss] Windows build files for 1.0

Daniel Ménard Daniel.Menard at bdsp.tm.fr
Mon Jun 11 18:00:55 BST 2007


Olly Betts a écrit :
>> By the way, perhaps including a version resource to the generated dll 
>> would be a nice addition ?
> I've no idea how to do that - can you post the command to run?
>   
So, I tried to create a version resource for php_xapian.dll...
As stated before, I'm really not used to this stuff, and I'm sure 
Charlie or someone else will easily come up with a better solution.
However, here is what I did:

1. I created a very simple "version.rc" file. I started with the 
template file included in php source distributions which is used for all 
php extensions (template.rc in /win32/build folder), removing things 
which were not needed in my opinion and quickly changing some lines:
http://www.bdsp.tm.fr/aed/xapian/version.rc.txt
(copyright and things like that will have to be checked)

2. In this resource file, we need to have access to the xapian version. 
The simplest way would be to include "version.win32.h", but RC, the 
resource compiler, dislike the namespace it contains (perhaps this file 
could be split?) So I duplicated the file, keeping only the defines:
http://www.bdsp.tm.fr/aed/xapian/version_for_rc.h.txt
Another option would be to pass the version numbers as command lines 
arguments from the makefile, but I don't think we have the information 
inside the makefile?

3. I then modified the php bindings make file:
In order to add the resource file to the dll, we must compile the .rc 
file to a .res file and then link the .res file with the rest.

To compile the .rc file, I added this to the makefile:

version.res: version.rc
    $(RSC) /fo version.res /d 
PHP_MAJOR_VERSION="\"$(PHP_MAJOR_VERSION)\"" version.rc

(I pass as as argument PHP_MAJOR_VERSION which is defined in config.mak 
so I can use it in version.rc)

I then added version.res as a dependency for php_xapian.dll and changed 
the call to link so it includes version.res :

"$(OUTDIR)\php_xapian.dll" : "$(OUTDIR)" $(DEF_FILE) $(LIB_XAPIAN_OBJS) 
version.res
    $(LINK32) $(ALL_LINK32_FLAGS) /DLL /out:"$(OUTDIR)\php_xapian.dll" 
$(DEF_FLAGS) $(LIB_XAPIAN_OBJS) version.res

It's very basic and probably not "good practice", but it works. Here is 
a screenshot of what the dll looks like in windows explorer :
http://www.bdsp.tm.fr/aed/xapian/tmp1.jpg

It's a bit complicated for something which is only "cosmetic", but I 
find it convenient to get a file version by just looking at it...

Cheers, 

-- 

Daniel Ménard




More information about the Xapian-discuss mailing list