2012-06-23 21:23, Stephen Montgomery-Smith skrev:
> On 06/23/2012 02:38 AM, Rafael Laboissiere wrote:
>> * Stephen Montgomery-Smith<step...@missouri.edu>  [2012-06-21 19:59]:
>>
>>> I was looking at the Makefile, and it had some comments asking for
>>> suggestions for how to extract the version numbers of octave.
>>>
>>> How about:
>>>
>>> majorversion := $(shell mkoctfile --version 2>&1 \
>>> | awk -F '[. ]' '{print $$3}')
>>> minorversion := $(shell mkoctfile --version 2>&1 \
>>> | awk -F '[. ]' '{print $$4}')
>>> microversion := $(shell mkoctfile --version 2>&1 \
>>> | awk -F '[. ]' '{print $$5}')
>>>
>>> The backslashes are there only because I can't fit it all on one line
>>> with my email client.
>>>
>>> Or:
>>>
>>> majorversion := $(word 3,$(shell mkoctfile --version 2>&1 \
>>> | sed 's/\./ /g'))
>>> minorversion := $(word 4,$(shell mkoctfile --version 2>&1 \
>>> | sed 's/\./ /g'))
>>> microversion := $(word 5,$(shell mkoctfile --version 2>&1 \
>>> | sed 's/\./ /g'))
>>
>> Your proposed code is cleaner than the original one, even though there is
>> no need to fix things that are not broken.  At any rate, please, avoid
>> the solution that use awk, since this would introduce an extra
>> build-dependency in systems like Debian.
> 
> OK, let me then encourage the maintainer of sockets to use the second 
> suggestion.  The current way it is done creates an extra build 
> dependency for FreeBSD.  The sed that comes with FreeBSD does not 
> support "\n" inside its patterns.  So I had to create a build dependency 
> on "gsed" which is the gnu version of sed, and which is not included in 
> FreeBSD by default.
> 

Hi, what I meant with the comment in the Makefile is that I did not want
to query mkoctfile in the first place, I would rather get the version
from octave/oct.h but there is only the VERSION macro which is a string
and difficult to handle.
A good example on how to handle version comparisons is how boost does
it, see the BOOST_VERSION macro description on
http://www.boost.org/doc/libs/1_46_0/libs/config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.boost_informational_macros
This is something for the octave developers to decide.

However, I am glad to simplify the existing solution while at the same
time avoiding dependencies on awk or gsed. Is "word" GNU make specific?
I did not see any note about it in the manual, but I did not check
thoroughly.
In the meanwhile, I have changed to the  $(word 5... solution. It should
handle version strings like 3.7.11+ properly, as someone had problem
with earlier.
Paul

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to