Commit d632ab68 authored by William A. Rowe Jr's avatar William A. Rowe Jr
Browse files

  Eliminate awk autogeneration of the ApacheMonitor's .rc resource
  source file.

  By adding several macros to ap_release.h:

    - the stringize magic, in leiu of including a ton of cruft,
    - split subversion and "-dev" tokens (with a binary flag)
    - a _CSV token in the form of m,n,p (not a string)

  we are able to have use a static ApacheMonitor.rc file, which picks
  up all of the necessary values right from ap_release.h.

  If the group likes this approach, I will percolate it throughout
  the project, and we will lose the requirement of awk for everything
  -except- rewriting the installed httpd.conf script (developer builds
  always get an installed httpd.conf script - it's only 'fixed up' 
  with the correct @@ substitutions if they have awk.)

  This project was chosen because ApacheMonitor.rc already exists in svn.

  Comment please.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@106313 13f79535-47bb-0310-9956-ffa450edef68
parent d36f1192
Loading
Loading
Loading
Loading
+21 −7
Original line number Diff line number Diff line
@@ -16,7 +16,10 @@
#ifndef AP_RELEASE_H
#define AP_RELEASE_H

#include "apr_general.h" /* stringify */
/** Properly quote a value as a string in the C preprocessor */
#define AP_STRINGIFY(n) AP_STRINGIFY_HELPER(n)
/** Helper macro for AP_STRINGIFY */
#define AP_STRINGIFY_HELPER(n) #n

/*
 * The below defines the base string of the Server: header. Additional
@@ -36,12 +39,18 @@
#define AP_SERVER_MAJORVERSION_NUMBER 2
#define AP_SERVER_MINORVERSION_NUMBER 1
#define AP_SERVER_PATCHLEVEL_NUMBER   2
#define AP_SERVER_DEVBUILD_BOOLEAN    1

#if AP_SERVER_DEVBUILD_BOOLEAN
#define AP_SERVER_ADD_STRING          "-dev"
#else
#define AP_SERVER_ADD_STRING          ""
#endif

/* keep old macros as well */
#define AP_SERVER_MAJORVERSION APR_STRINGIFY(AP_SERVER_MAJORVERSION_NUMBER)
#define AP_SERVER_MINORVERSION APR_STRINGIFY(AP_SERVER_MINORVERSION_NUMBER)
#define AP_SERVER_PATCHLEVEL APR_STRINGIFY(AP_SERVER_PATCHLEVEL_NUMBER) \
#define AP_SERVER_MAJORVERSION  AP_STRINGIFY(AP_SERVER_MAJORVERSION_NUMBER)
#define AP_SERVER_MINORVERSION  AP_STRINGIFY(AP_SERVER_MINORVERSION_NUMBER)
#define AP_SERVER_PATCHLEVEL    AP_STRINGIFY(AP_SERVER_PATCHLEVEL_NUMBER) \
                                AP_SERVER_ADD_STRING

#define AP_SERVER_MINORREVISION AP_SERVER_MAJORVERSION "." AP_SERVER_MINORVERSION
@@ -49,4 +58,9 @@
#define AP_SERVER_BASEVERSION   AP_SERVER_BASEPRODUCT "/" AP_SERVER_BASEREVISION
#define AP_SERVER_VERSION       AP_SERVER_BASEVERSION

/* macro for Win32 .rc files using numeric csv representation */
#define AP_SERVER_PATCHLEVEL_CSV AP_SERVER_MAJORVERSION_NUMBER ##, \
                               ##AP_SERVER_MINORVERSION_NUMBER ##, \
                               ##AP_SERVER_PATCHLEVEL_NUMBER

#endif
+4 −48
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ RSC=rc.exe
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /i ".\\" /d "NDEBUG"
# ADD RSC /l 0x409 /i "./" /i "../include" /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
@@ -73,7 +73,7 @@ LINK32=link.exe
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /i ".\\" /d "_DEBUG"
# ADD RSC /l 0x409 /i "./" /i "../../include" /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
@@ -96,19 +96,10 @@ SOURCE=.\apache_header.bmp
# End Source File
# Begin Source File

SOURCE=.\ApacheMonitor.h
# End Source File
# Begin Source File

SOURCE=.\ApacheMonitor.ico
# End Source File
# Begin Source File

SOURCE=.\ApacheMonitor.rc
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File

SOURCE=.\aprun.ico
# End Source File
# Begin Source File
@@ -130,46 +121,11 @@ SOURCE=.\ApacheMonitor.c
# End Source File
# Begin Source File

SOURCE=.\ApacheMonitorVer.rc
SOURCE=.\ApacheMonitor.h
# End Source File
# Begin Source File

SOURCE=..\..\build\win32\win32ver.awk

!IF  "$(CFG)" == "ApacheMonitor - Win32 Release"

# PROP Ignore_Default_Tool 1
USERDEP__WIN32="..\..\include\ap_release.h"	".\ApacheMonitor.rc"	
# Begin Custom Build - Creating versioned resources
InputPath=..\..\build\win32\win32ver.awk

".\ApacheMonitorVer.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
	echo /* This file is autogenerated from ApacheMonitor.rc > ApacheMonitorVer.rc 
	echo  * DO NOT EDIT! >> ApacheMonitorVer.rc 
	echo  */ >> ApacheMonitorVer.rc 
	type ApacheMonitor.rc >> ApacheMonitorVer.rc 
	awk -f ../../build/win32/win32ver.awk ApacheMonitor.exe "Apache HTTP Server Monitor" ../../include/ap_release.h >> ApacheMonitorVer.rc 
	
# End Custom Build

!ELSEIF  "$(CFG)" == "ApacheMonitor - Win32 Debug"

# PROP Ignore_Default_Tool 1
USERDEP__WIN32="..\..\include\ap_release.h"	".\ApacheMonitor.rc"	
# Begin Custom Build - Creating versioned resources
InputPath=..\..\build\win32\win32ver.awk

".\ApacheMonitorVer.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
	echo /* This file is autogenerated from ApacheMonitor.rc > ApacheMonitorVer.rc 
	echo  * DO NOT EDIT! >> ApacheMonitorVer.rc 
	echo  */ >> ApacheMonitorVer.rc 
	type ApacheMonitor.rc >> ApacheMonitorVer.rc 
	awk -f ../../build/win32/win32ver.awk ApacheMonitor.exe "Apache HTTP Server Monitor" ../../include/ap_release.h >> ApacheMonitorVer.rc 
	
# End Custom Build

!ENDIF 

SOURCE=.\ApacheMonitor.rc
# End Source File
# End Target
# End Project
+40 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@

#include "ApacheMonitor.h"

#include "ap_release.h"

IDI_APSRVMON            ICON    DISCARDABLE     "ApacheMonitor.ico"
IDI_ICOSTOP             ICON    DISCARDABLE     "apstop.ico"
IDI_ICORUN              ICON    DISCARDABLE     "aprun.ico"
@@ -94,3 +96,41 @@ BEGIN
    IDS_MSG_CONNECT         "&Connect"
    IDS_MSG_ECONNECT        "Unable to connect to the remote registry on %s"
END

1 VERSIONINFO
 FILEVERSION AP_SERVER_PATCHLEVEL_CSV,0
 PRODUCTVERSION AP_SERVER_PATCHLEVEL_CSV,0
 FILEFLAGSMASK 0x3fL
#if defined(_DEBUG)
 FILEFLAGS 0x03L
#else
#if AP_SERVER_DEVBUILD_BOOLEAN
 FILEFLAGS 0x02L
#else
 FILEFLAGS 0x0L
#endif
#endif
 FILEOS 0x40004L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
  BLOCK "StringFileInfo"
  BEGIN
    BLOCK "040904b0"
    BEGIN
      VALUE "Comments", "Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this file except in compliance with the License.  You may obtain a copy of the License at\r\n\r\nhttp://www.apache.org/licenses/LICENSE-2.0\r\n\r\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an ""AS IS"" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the specific language governing permissions and limitations under the License.\0"
      VALUE "CompanyName", AP_SERVER_BASEVENDOR "\0"
      VALUE "FileDescription", "Apache HTTP Server Monitor\0"
      VALUE "FileVersion", AP_SERVER_BASEREVISION "\0"
      VALUE "InternalName", "ApacheMonitor.exe\0"
      VALUE "LegalCopyright", "Copyright 2001-2004 The Apache Software Foundation\0"
      VALUE "OriginalFilename", "ApacheMonitor.exe\0"
      VALUE "ProductName", "Apache HTTP Server\0"
      VALUE "ProductVersion", AP_SERVER_BASEREVISION "\0"
    END
  END
  BLOCK "VarFileInfo"
  BEGIN
    VALUE "Translation", 0x409, 1200
  END
END