This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Added file properties to windows gdb executable for all mingw32 builds.


2013-08-14  Bernd Bunk  <bernd.bunk@intel.com>

	* Makefile.in (win_exe_properties.h): Add rule to create
	win_exe_properties.h header file with file property information.
	(win_exe_properties.o): Added rule to build the resource file.
	* configure: Add win_exe_properties.o to mingw32 specific
	objects.
	* common/create-win_exe_properties.sh: Shell script to
	create a win_exe_properties.h header file containing all
	information/defines for the gdb executable file properties.
	New file.
	* win_exe_properties.rc: Resource file implementing
	gdb executable file properties for windows/mingw32 builds.
	It includes auto-generated win_exe_properties.h file with
	property information. New file.

Signed-off-by: Bernd Bunk <bernd.bunk@intel.com>
---
 gdb/Makefile.in                         |    7 ++
 gdb/common/create-win_exe_properties.sh |  115 +++++++++++++++++++++++++++++++
 gdb/configure                           |    9 +++
 gdb/win_exe_properties.rc               |   61 ++++++++++++++++
 4 files changed, 192 insertions(+), 0 deletions(-)
 create mode 100644 gdb/common/create-win_exe_properties.sh
 create mode 100644 gdb/win_exe_properties.rc

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 45cddaf..425793f 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1426,6 +1426,13 @@ $(srcdir)/copying.c: @MAINTAINER_MODE_TRUE@ $(srcdir)/../COPYING3 $(srcdir)/copy
 		< $(srcdir)/../COPYING3 > $(srcdir)/copying.tmp
 	mv $(srcdir)/copying.tmp $(srcdir)/copying.c
 
+win_exe_properties.h: Makefile version.in common/create-win_exe_properties.sh
+	$(SHELL) $(srcdir)/common/create-win_exe_properties.sh $(srcdir) \
+		"$(host_alias)" "$(target_alias)" win_exe_properties.h
+
+win_exe_properties.o: win_exe_properties.h win_exe_properties.rc
+	$(WINDRES) $(srcdir)/win_exe_properties.rc win_exe_properties.o
+
 version.c: Makefile version.in $(srcdir)/../bfd/version.h $(srcdir)/common/create-version.sh
 	$(SHELL) $(srcdir)/common/create-version.sh $(srcdir) \
 	    $(host_alias) $(target_alias) version.c
diff --git a/gdb/common/create-win_exe_properties.sh b/gdb/common/create-win_exe_properties.sh
new file mode 100644
index 0000000..4942024
--- /dev/null
+++ b/gdb/common/create-win_exe_properties.sh
@@ -0,0 +1,115 @@
+#!/bin/sh
+
+# Create windows executable file properties for GDB on Windows.
+# These are visible in context menu Properties / Details on the GDB
+# executable on Windows.
+#
+# Copyright (C) 2013 Free Software Foundation, Inc.
+#
+# Contributed by Intel Corporation
+#
+# This file is part of GDB.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Create win_exe_properties.h from given parameters
+# Usage:
+#    create-win_exe_properties.sh PATH-TO-GDB-SRCDIR HOST_ALIAS \
+#        TARGET_ALIAS OUTPUT-FILE-NAME OPTIONS
+#
+#    see also environment variable below to customize some of the
+#    description fields.
+#
+
+# shell parameters
+srcdir="$1"
+host_alias="$2"
+target_alias="$3"
+output="$4"
+
+if [ $# -ne 4 ] ; then
+  echo "usage: $0 PATH-TO-GDB-SRCDIR HOST_ALIAS TARGET_ALIAS OUTPUT-FILE-NAME" >&2
+  exit 1
+fi
+
+# default option values
+# keep these defaults in sync with gdb/top.c print_gdb_version()
+version=`cat $srcdir/version.in`
+company_name="Free Software Foundation, Inc."
+file_description="gdb"
+product_name="gdb"
+configured=""
+if [ -n "$host_alias" ] ; then
+  file_description="gdb for $host_alias"
+  product_name="gdb for $host_alias"
+  configured="This GDB was configured as \"\"$host_alias\"\"."
+fi
+internal_name="gdb.exe"
+original_filename="gdb.exe"
+copyright="Copyright (C) 2013 Free Software Foundation, Inc."
+  license=\
+"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+Type \"\"show copying\"\" and \"\"show warranty\"\" for details."
+support="For bug reporting instructions, please see:
+<http://www.gnu.org/software/gdb/bugs/>."
+
+# check for environment variables to replace certain file properties
+[ -n "$WIN_EXE_VERSION" ] && version=$WIN_EXE_VERSION
+[ -n "$WIN_EXE_COMPANY_NAME" ] && company_name=$WIN_EXE_COMPANY_NAME
+[ -n "$WIN_EXE_FILE_DESCRIPTION" ] && file_description=$WIN_EXE_FILE_DESCRIPTION
+[ -n "$WIN_EXE_PRODUCT_NAME" ] && product_name=$WIN_EXE_PRODUCT_NAME
+[ -n "$WIN_EXE_INTERNAL_NAME" ] && internal_name=$WIN_EXE_INTERNAL_NAME
+[ -n "$WIN_EXE_ORIGINAL_FILENAME" ] && original_filename=$WIN_EXE_ORIGINAL_FILENAME
+[ -n "$WIN_EXE_COPYRIGHT" ] && copyright=$WIN_EXE_COPYRIGHT
+[ -n "$WIN_EXE_LICENSE" ] && license=$WIN_EXE_LICENSE
+[ -n "$WIN_EXE_CONFIGURED" ] && configured=$WIN_EXE_CONFIGURED
+[ -n "$WIN_EXE_SUPPORT" ] && support=$WIN_EXE_SUPPORT
+
+# combine complete copyright message
+# Windows file property dialog only shows ONE line (with scrollbar)
+# so do not separate with newlines but use spaces instead!
+copyright_all=`echo $copyright $license $configured $support`
+
+# remove "#" at the beginning and internal version at the end
+version=`echo ${version%-*} | sed -e "s/#//"`
+
+# split version
+IFS_BAK="$IFS"
+IFS='.'
+array=($version)
+version_major=${array[0]}
+version_minor=${array[1]}
+version_build=${array[2]}
+IFS="$IFS_BAK"
+[ -z "$version_major" ] && version_major=0
+[ -z "$version_minor" ] && version_minor=0
+[ -z "$version_build" ] && version_build=0
+
+# write version into output file
+echo "#define FP_VERSION_MAJOR $version_major"  > $srcdir/$output
+echo "#define FP_VERSION_MINOR $version_minor" >> $srcdir/$output
+echo "#define FP_VERSION_BUILD $version_build" >> $srcdir/$output
+echo "#define FP_VERSION_ALL   \"$version_major.$version_minor.$version_build\"" >> $srcdir/$output
+
+echo "" >> $srcdir/$output
+
+# write other file properties into output file
+echo "#define FP_COMPANY_NAME      \"$company_name\""      >> $srcdir/$output
+echo "#define FP_FILE_DESCRIPTION  \"$file_description\""  >> $srcdir/$output
+echo "#define FP_INTERNAL_NAME     \"$internal_name\""     >> $srcdir/$output
+echo "#define FP_COPYRIGHT         \"$copyright_all\""     >> $srcdir/$output
+echo "#define FP_ORIGINAL_FILENAME \"$original_filename\"" >> $srcdir/$output
+echo "#define FP_PRODUCT_NAME      \"$product_name\""      >> $srcdir/$output
diff --git a/gdb/configure b/gdb/configure
index 8067825..5afea6a 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -6988,6 +6988,15 @@ case $host_os in
     ;;
 esac
 
+# If we build for mingw32/Windows, then also build file properties
+# for GDB executable.
+case $host_os in
+  *mingw32*)
+    CONFIG_OBS="$CONFIG_OBS win_exe_properties.o"
+    ;;
+esac
+
+
 # These are the libraries checked by Readline.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5
 $as_echo_n "checking for library containing tgetent... " >&6; }
diff --git a/gdb/win_exe_properties.rc b/gdb/win_exe_properties.rc
new file mode 100644
index 0000000..270c04c
--- /dev/null
+++ b/gdb/win_exe_properties.rc
@@ -0,0 +1,61 @@
+/* Windows executable properties for GDB on Windows.
+   These are visible in context menu Properties / Details on the GDB
+   executable on Windows.
+
+   Copyright (C) 2013 Free Software Foundation, Inc.
+
+   Contributed by Intel Corporation.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Value defines for windows executable file properties of GDB on Windows.
+   Patch this header file using create-win_exe_properties.sh during gdb build
+   to customize the file properties. */
+#include "win_exe_properties.h"
+
+#include "afxres.h"
+VS_VERSION_INFO VERSIONINFO
+  FILEVERSION FP_VERSION_MAJOR,FP_VERSION_MINOR,FP_VERSION_BUILD,0
+  PRODUCTVERSION FP_VERSION_MAJOR,FP_VERSION_MINOR,FP_VERSION_BUILD,0
+  FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+  FILEFLAGS 0x1L
+#else
+  FILEFLAGS 0x0L
+#endif
+  FILEOS 0x40004L
+  FILETYPE 0x1L
+  FILESUBTYPE 0x0L
+BEGIN
+  BLOCK "StringFileInfo"
+  BEGIN
+    BLOCK "040904b0"
+    BEGIN
+      VALUE "CompanyName", FP_COMPANY_NAME
+      VALUE "FileDescription", FP_FILE_DESCRIPTION
+      VALUE "FileVersion", FP_VERSION_ALL
+      VALUE "InternalName", FP_INTERNAL_NAME
+      VALUE "LegalCopyright", FP_COPYRIGHT
+      VALUE "OriginalFilename", FP_ORIGINAL_FILENAME
+      VALUE "ProductName", FP_PRODUCT_NAME
+      VALUE "ProductVersion", FP_VERSION_ALL
+    END
+  END
+  BLOCK "VarFileInfo"
+  BEGIN
+    VALUE "Translation", 0x409, 1200
+  END
+END
-- 
1.7.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]