openMSX / wxcatapult

23 stars 4 forks source link

[Bug] wxCatapult: extract main.mk REVISION variable using pyton code [sf#484] #17

Closed openMSX-import closed 9 years ago

openMSX-import commented 9 years ago

Reported by joxy on 2013-07-30 05:47 UTC As I don't currently know Python (and have no plans to study it), someone please fix this.

Actually since git has neither build ids nor the notion of revisions, and since openMSX has no "t" in "x.y.x.t" version notation, we could simply get safe with REVISION always as 0.

Someone please comment on this.

openMSX-import commented 9 years ago

Commented by joxy on 2013-07-30 05:48 UTC See the following block of code in build/main.mk:

# egp_: This REVISION fix is needed since version.extractRevisionString() doesn't do its job correctly for an int-typed variable "REVISION"
# egp_: We really need version.extractRevisionAsInt() function; not a function returning a String.
#
# Normative documentation:
# This variable REVISION must have a type int for src/catapult.rc where it includes 
# a derived resource-info.h, to form a valid define "CATAPULT_VERSION_INT" there, 
# to specify the following for mingw and MSVC:
#VS_VERSION_INFO VERSIONINFO
# FILEVERSION CATAPULT_VERSION_INT
# PRODUCTVERSION CATAPULT_VERSION_INT
#
#REVISION:=$(shell PYTHONPATH=build $(PYTHON) -c \
#     "import version; print version.extractRevisionString()" \
#     )
#The following is a temporary fix until the python code above gets repaired:
REVISION:=0
openMSX-import commented 9 years ago

Commented by joxy on 2013-07-30 05:49 UTC I propose to deal with this as follows:

we could always specify REVISION:=0 and not try to compute this "t" in "x.y.z.t" of version info, since "t" is not applicable for our project, and has neither sense nor meaning.

openMSX-import commented 9 years ago

Commented by manuelbi on 2013-07-30 18:25 UTC I think the best solution is to use the python script win_resource.py to generate the header file.

I can't test this, but you can... try to replace this in main.mk:

WIN32_FILEVERSION:=$(shell echo $(PACKAGE_VERSION) $(REVISION) | sed -ne 's/\([0
-9]\)*\.\([0-9]\)*\.\([0-9]\)*[^ ]* \([0-9]*\)/\1, \2, \3, \4/p' -)
$(RESOURCE_HEADER): $(VERSION_MAKE) forceversionextraction
        @echo "#define CATAPULT_VERSION_INT $(WIN32_FILEVERSION)" > $@
        @echo "#define CATAPULT_VERSION_STR \"$(PACKAGE_VERSION)\0\"" >> $@

with something like this (UNTESTED, please fix):

$(RESOURCE_HEADER): $(VERSION_MAKE) forceversionextraction
    $(PYTHON) $(BUILD_PATH)/win_resource.py $@

Then this code isn't duplicated between main.mk and win_resource.py anymore.

Or is this a different issue?

openMSX-import commented 9 years ago

Commented by manuelbi on 2013-07-30 18:27 UTC Note that there is also a extractRevisionNumber() method in version.py.

openMSX-import commented 9 years ago

Commented by joxy on 2013-08-11 21:00 UTC Manuel: Pending. I currently paused the development, as I also have other projects.

openMSX-import commented 9 years ago

Commented by manuelbi on 2014-01-06 12:53 UTC As the revision extraction was completely disabled for all platforms (not only for MinGW32), I simply implemented the solution I gave above. However, I couldn't test it. So, please test it and tell me about the results.

This was done in commit a26a2553b3235f80d294f2843e3898feb81a282b

openMSX-import commented 9 years ago

Updated by manuelbi on 2014-02-22 10:14 UTC

openMSX-import commented 9 years ago

Commented by manuelbi on 2014-02-22 10:14 UTC No repsonse received. I guess no one uses MinGW at the moment to build Catapult. Closing for now as fixed.