diff --git a/mswin32/Makefile b/mswin32/Makefile index 5c78d512f..9b5257e31 100644 --- a/mswin32/Makefile +++ b/mswin32/Makefile @@ -2,12 +2,20 @@ MAKENSIS="/c/apps/NSIS/makensis.exe" VCEXPRESS="/c/Program Files/Microsoft Visual Studio 8/Common7/IDE/VCExpress.exe" export NMAP_VERSION := $(shell grep '^\#[ \t]*define[ \t]\+NMAP_VERSION' ../nmap.h | sed -e 's/.*"\(.*\)".*/\1/' -e 'q') export NMAP_NUM_VERSION := $(shell grep '^\#[ \t]*define[ \t]\+NMAP_NUM_VERSION' ../nmap.h | sed -e 's/.*"\(.*\)".*/\1/' -e 'q') +COMMA_VERSION=$(shell echo $(NMAP_NUM_VERSION) | tr '.' ',') LOGLOC=c:nmapbuild.log NSE_FILES = scripts/script.db scripts/*.nse winbuild: # VCExpress.exe is devenv.com with the commercial Visual Studio suite instead of VC++ Express - @./version-update.sh $(NMAP_VERSION) $(NMAP_NUM_VERSION) + + @echo "Setting version: $(NMAP_VERSION) ($(NMAP_NUM_VERSION))" + @cat ./nmap.rc | sed 's/VALUE "FileVersion", .*"/VALUE "FileVersion", "$(NMAP_VERSION)\\0"/' > ./nmap.rc.tmp + @cat ./nmap.rc.tmp | sed 's/FILEVERSION .*,.*,.*,.*/FILEVERSION $(COMMA_VERSION)/' > ./nmap.rc + @cat ./nsis/Nmap.nsi | sed 's/VIProductVersion ".*"/VIProductVersion "$(NMAP_NUM_VERSION)"/' > ./nmap.nsi.tmp + @cat ./nmap.nsi.tmp | sed 's/!define VERSION ".*"/!define VERSION "$(NMAP_VERSION)"/' > ./nsis/Nmap.nsi + @rm ./nmap.nsi.tmp ./nmap.rc.tmp + $(VCEXPRESS) nmap.sln /build release /log $(LOGLOC) $(MAKENSIS) winpcap/winpcap-nmap.nsi rm -rf nmap-$(NMAP_VERSION) diff --git a/mswin32/nsis/Nmap.nsi b/mswin32/nsis/Nmap.nsi index e027489f4..6e13e9a32 100644 --- a/mswin32/nsis/Nmap.nsi +++ b/mswin32/nsis/Nmap.nsi @@ -19,9 +19,10 @@ ;Get installation folder from registry if available InstallDirRegKey HKCU "Software\Nmap" "" - + + !define VERSION "4.21ALPHA5" VIProductVersion "4.21.0.5" - VIAddVersionKey /LANG=1033 "FileVersion" "4.21ALPHA5" + VIAddVersionKey /LANG=1033 "FileVersion" "${VERSION}" VIAddVersionKey /LANG=1033 "ProductName" "Nmap" VIAddVersionKey /LANG=1033 "CompanyName" "Insecure.org" VIAddVersionKey /LANG=1033 "InternalName" "NmapInstaller.exe" @@ -83,7 +84,7 @@ Section "Nmap Core Files" SecCore WriteUninstaller "$INSTDIR\Uninstall.exe" ; Register Nmap with add/remove programs - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Nmap" "DisplayName" "Nmap 4.20ALPHA7" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Nmap" "DisplayName" "Nmap ${VERSION}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Nmap" "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Nmap" "DisplayIcon" '"$INSTDIR\icon1.ico"' WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Nmap" "NoModify" 1 diff --git a/mswin32/version-update.sh b/mswin32/version-update.sh deleted file mode 100755 index 8cdb36f4f..000000000 --- a/mswin32/version-update.sh +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/sh - -#-------------------------------------------# -# Nmap windows build version update script # -# # -# From the version in nmap.h this script # -# updates both nmap.rc and nmap.nsi which # -# in turn updates nmap.exe and # -# nmapinstall.exe # -# # -#-------------------------------------------# - -# Eddie Bell 2007 - -NMAP_RC="./nmap.rc" -NMAP_NSIS="./nsis/Nmap.nsi" -NMAP_TMP="./.nmap-version.tmp" - -# make sure all the files we need -# are available - -if [ -z $1 ] || [ -z $2 ] - then - echo "$0 <#-version>" - exit 1 -fi - -NMAP_VERSION=$1 -NMAP_NUM_VERSION=$2 - -if [ ! -f $NMAP_RC ] - then - echo "Cannot access $NMAP_RC" - exit 1 -fi - -if [ ! -f $NMAP_NSIS ] - then - echo "Cannot access $NMAP_NSIS" - exit 1 -fi - -: > $NMAP_TMP - -# make the substitutions for nmap.rc -# Note we have to do it this strange way using head and tail because -# bash's 'read' automatically removes whitespace which messes up the -# files indentation - -i=1 -max=`wc -l $NMAP_RC | awk '{print $1}'` -echo "$0: updating $NMAP_RC ($max)" - -while : - do - line=`head -n $i $NMAP_RC | tail -n 1` - i=`expr $i + 1` - - if [ -n "`echo $line | grep 'VALUE "FileVersion"'`" ] - then - echo " VALUE \"FileVersion\", \"$NMAP_VERSION\\0\"" >> $NMAP_TMP - elif [ -n "`echo $line | grep 'FILEVERSION'`" ] - then - echo "FILEVERSION `echo $NMAP_NUM_VERSION | tr '.' ','`" >> $NMAP_TMP - else - echo "$line" >> $NMAP_TMP - fi - - if [ $i -gt $max ] - then - break - fi -done - -mv $NMAP_TMP $NMAP_RC -touch $NMAP_TMP - - -# make the substitutions for Nmap.nsi - -i=1 -max=`wc -l $NMAP_NSIS | awk '{print $1}'` -echo "$0: updating $NMAP_NSIS ($max)" - -while : - do - line=`head -n $i $NMAP_NSIS | tail -n 1` - i=`expr $i + 1` - - if [ -n "`echo $line | grep 'VIProductVersion'`" ] - then - echo " VIProductVersion \"$NMAP_NUM_VERSION\"" >> $NMAP_TMP - elif [ -n "`echo $line | grep 'VIAddVersionKey /LANG=1033 "FileVersion"'`" ] - then - echo " VIAddVersionKey /LANG=1033 \"FileVersion\" \"$NMAP_VERSION\"" >> $NMAP_TMP - else - echo "$line" >> $NMAP_TMP - fi - - if [ $i -gt $max ] - then - break - fi -done - -mv $NMAP_TMP $NMAP_NSIS -echo "$0: set nmap.rc and nmap.nsi to $NMAP_VERSION ($NMAP_NUM_VERSION)" -exit 0 diff --git a/nmap.h b/nmap.h index f2d3f9f25..13a85b2cb 100644 --- a/nmap.h +++ b/nmap.h @@ -254,6 +254,7 @@ void *realloc(); /* Edit this definition only within the quotes, because it is read from this file by the makefiles. */ #define NMAP_VERSION "4.21ALPHA5" +#define NMAP_NUM_VERSION "4.21.0.5" #endif /* User configurable #defines: */