#!/bin/sh
# Creating a Java archive (.jar).
-# Copyright (C) 2024 Free Software Foundation, Inc.
+# Copyright (C) 2024-2026 Free Software Foundation, Inc.
#
# This file is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
func_version ()
{
echo "jar-cf (GNU gettext)"
- echo "Copyright (C) 2024 Free Software Foundation, Inc.
+ echo "Copyright (C) 2026 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://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."
shift
shift
+# Unset CDPATH. Otherwise, output from 'cd dir' can surprise callers.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
if $jar_program --help 2>&1 | grep '\--date=' >/dev/null; then
# The JAR_PROGRAM supports the --date option. Its effect is to set the given
# date as time stamp on all the ELEMENTs and also the META-INF/MANIFEST.MF.
# Use it, for reproducibility (cf. <https://reproducible-builds.org/>).
if test -d "$top_srcdir/.git"; then
# We are in a git checkout. Use the date of the latest commit.
- date=`git log -n 1 --date=iso --format=fuller | sed -n -e 's/^CommitDate: //p' | sed -e 's/ /T/' -e 's/ \(...\)\(..\)$/\1:\2/'`
+ date=`cd "$top_srcdir" && git log -n 1 --date=iso --format=fuller | sed -n -e 's/^CommitDate: //p' | sed -e 's/ /T/' -e 's/ \(...\)\(..\)$/\1:\2/'`
else
# We are building from a tarball.
# Use the date of the first entry of the ChangeLog file.