changeset 4590:5b5c47cd2111

Add file with hg id of MXE-Octave to dist package (bug #52794). * tools/mk-hg-id.sh: New file copied (mostly) from Octave sources. * Makefile.in: Call shell script, copy HG-ID in make dist * binary-dist-rules.mk: Copy HG-ID to dist directory. * dist-files.mk: add mk-hg-id.sh to dist files
author Markus Mützel <markus.muetzel@gmx.de>
date Wed, 03 Jan 2018 14:18:12 +0100
parents 7d8660f7bb61
children 50aebe534e42
files Makefile.in binary-dist-rules.mk dist-files.mk tools/mk-hg-id.sh
diffstat 4 files changed, 51 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.in	Wed Jan 03 10:09:19 2018 -0500
+++ b/Makefile.in	Wed Jan 03 14:18:12 2018 +0100
@@ -149,6 +149,10 @@
 $(shell mkdir -p $(BUILD_TOOLS_PREFIX))
 $(shell mkdir -p $(HOST_PREFIX))
 
+## The mk-hg-id.sh script will be executed each time Make runs.  It will
+## update the HG-ID file in the build tree.
+$(shell $(TOP_DIR)/tools/mk-hg-id.sh "$(TOP_DIR)")
+
 # At least one package uses --with instead of --enable.  
 ifeq ($(BUILD_SHARED),yes)
   ifeq ($(BUILD_STATIC),yes)
--- a/binary-dist-rules.mk	Wed Jan 03 10:09:19 2018 -0500
+++ b/binary-dist-rules.mk	Wed Jan 03 14:18:12 2018 +0100
@@ -81,6 +81,7 @@
       cp $(TOP_DIR)/installer-files/octave.bat $(OCTAVE_DIST_DIR)/
       cp $(TOP_DIR)/installer-files/octave.vbs $(OCTAVE_DIST_DIR)/
       cp $(TOP_DIR)/installer-files/octave-firsttime.vbs $(OCTAVE_DIST_DIR)/
+      cp $(TOP_BUILD_DIR)/HG-ID $(OCTAVE_DIST_DIR)/
       echo "  updating libtool references..."
       find '$(OCTAVE_DIST_DIR)/' -type f -name "*.la" \
         -exec $(SED) -i 's|$(HOST_PREFIX)|/usr|g;s|$(BUILD_TOOLS_PREFIX)|/usr|g' {} \; ;
--- a/dist-files.mk	Wed Jan 03 10:09:19 2018 -0500
+++ b/dist-files.mk	Wed Jan 03 14:18:12 2018 +0100
@@ -869,6 +869,7 @@
   install-sh \
   make-shared-from-static \
   makeinst-script.sh.in \
+  mk-hg-id.sh \
   patch-tool-mxe \
   pkg-install.py \
   s3-fetch-and-sync \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/mk-hg-id.sh	Wed Jan 03 14:18:12 2018 +0100
@@ -0,0 +1,45 @@
+#! /bin/sh
+#
+# Copyright (C) 2016-2018 John W. Eaton
+#
+# This file is part of Octave.
+#
+# Octave 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.
+#
+# Octave 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 Octave; see the file COPYING.  If not, see
+# <http://www.gnu.org/licenses/>.
+
+# Generate a file that holds the hg id of the mxe-octave source tree.
+
+# set -e
+
+if [ $# -ne 1 ]; then
+  echo "usage: mk-hg-id.sh SRCDIR" 1>&2
+  exit 1
+fi
+
+srcdir="$1"
+
+hg_id=HG-ID
+
+if [ -d $srcdir/.hg ]; then
+  ( cd $srcdir && hg identify --id || echo "unknown" ) > ${hg_id}-t && mv ${hg_id}-t ${hg_id}
+elif [ ! -f $srcdir/${hg_id} ]; then
+  echo "WARNING: $srcdir/${hg_id} is missing!" 1>&2
+  echo "unknown" > ${hg_id}-t && mv ${hg_id}-t ${hg_id}
+else
+  echo "preserving existing ${hg_id} file" 1>&2
+  if [ "x$srcdir" != "x." ] && [ -f $srcdir/${hg_id} ] && [ ! -f ${hg_id} ]; then
+    cp ${srcdir}/${hg_id} ${hg_id}
+  fi
+fi
+