Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH v2 1/2] configure,etc: unify shebang usage
@ 2024-04-08 13:15 J. Dekker
  2024-04-08 13:16 ` [FFmpeg-devel] [PATCH v2 2/2] configure: simplify bigendian check J. Dekker
  2024-04-09  8:58 ` [FFmpeg-devel] [PATCH v2 1/2] configure, etc: unify shebang usage Martin Storsjö
  0 siblings, 2 replies; 4+ messages in thread
From: J. Dekker @ 2024-04-08 13:15 UTC (permalink / raw)
  To: ffmpeg-devel

In some cases, these scripts can be called directly by packagers, and
some systems require the interpreter to be explicit.

Signed-off-by: J. Dekker <jdek@itanimul.li>
---
 configure             | 3 ++-
 doc/texidep.pl        | 2 +-
 ffbuild/libversion.sh | 1 +
 tests/fate-run.sh     | 2 +-
 tests/fate.sh         | 2 +-
 5 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index f511fbae49..7b6f48e631 100755
--- a/configure
+++ b/configure
@@ -4737,7 +4737,7 @@ chmod +x $TMPE
 
 # make sure we can execute files in $TMPDIR
 cat > $TMPSH 2>> $logfile <<EOF
-#! /bin/sh
+#!/bin/sh
 EOF
 chmod +x $TMPSH >> $logfile 2>&1
 if ! $TMPSH >> $logfile 2>&1; then
@@ -8283,6 +8283,7 @@ print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $
 # Settings for pkg-config files
 
 cat > $TMPH <<EOF
+#!/bin/sh
 # Automatically generated by configure - do not modify!
 shared=$shared
 build_suffix=$build_suffix
diff --git a/doc/texidep.pl b/doc/texidep.pl
index 099690378e..33e6c7c53e 100644
--- a/doc/texidep.pl
+++ b/doc/texidep.pl
@@ -1,4 +1,4 @@
-#! /usr/bin/env perl
+#!/usr/bin/env perl
 
 # This script will print the dependency of a Texinfo file to stdout.
 # texidep.pl <src-path> <input.texi> <output.ext>
diff --git a/ffbuild/libversion.sh b/ffbuild/libversion.sh
index a94ab58057..ecaa90cde6 100755
--- a/ffbuild/libversion.sh
+++ b/ffbuild/libversion.sh
@@ -1,3 +1,4 @@
+#!/bin/sh
 toupper(){
     echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
 }
diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index 9863e4f2d9..6ae0320c60 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 export LC_ALL=C
 
diff --git a/tests/fate.sh b/tests/fate.sh
index 07908be3a5..c5ee18de80 100755
--- a/tests/fate.sh
+++ b/tests/fate.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 config=$1
 
-- 
2.44.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [FFmpeg-devel] [PATCH v2 2/2] configure: simplify bigendian check
  2024-04-08 13:15 [FFmpeg-devel] [PATCH v2 1/2] configure,etc: unify shebang usage J. Dekker
@ 2024-04-08 13:16 ` J. Dekker
  2024-04-09  9:03   ` Martin Storsjö
  2024-04-09  8:58 ` [FFmpeg-devel] [PATCH v2 1/2] configure, etc: unify shebang usage Martin Storsjö
  1 sibling, 1 reply; 4+ messages in thread
From: J. Dekker @ 2024-04-08 13:16 UTC (permalink / raw)
  To: ffmpeg-devel

The preferred way to use LTO is --enable-lto but often times packagers
still end up with -flto in cflags for various reasons. Using grep
on binary object files is brittle and relies on specific object
representation, which in the case of LLVM bitcode, debug-info or other
intermediary formats can fail silently.

This patch changes the check to a more commonly used define for
big-endian systems. More checks may need to be added in the future to
cover legacy machines.

Signed-off-by: J. Dekker <jdek@itanimul.li>
---
 configure | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/configure b/configure
index 7b6f48e631..e787f13e0b 100755
--- a/configure
+++ b/configure
@@ -6120,11 +6120,7 @@ extern_prefix=${sym%%ff_extern*}
 
 check_cc pragma_deprecated "" '_Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")'
 
-# The global variable ensures the bits appear unchanged in the object file.
-test_cc <<EOF || die "endian test failed"
-unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
-EOF
-od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
+test_cpp_condition stdlib.h "defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)" && enable bigendian
 
 check_cc const_nan math.h "struct { double d; } static const bar[] = { { NAN } }"
 
-- 
2.44.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 1/2] configure, etc: unify shebang usage
  2024-04-08 13:15 [FFmpeg-devel] [PATCH v2 1/2] configure,etc: unify shebang usage J. Dekker
  2024-04-08 13:16 ` [FFmpeg-devel] [PATCH v2 2/2] configure: simplify bigendian check J. Dekker
@ 2024-04-09  8:58 ` Martin Storsjö
  1 sibling, 0 replies; 4+ messages in thread
From: Martin Storsjö @ 2024-04-09  8:58 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Mon, 8 Apr 2024, J. Dekker wrote:

> In some cases, these scripts can be called directly by packagers, and
> some systems require the interpreter to be explicit.

It is unclear to me which of the changes are needed and for what reason, 
please elaborate much more in the commit message.

Is it possible to elaborate on "some systems require the interpreter to be 
explicit"? It'd be much nicer to reason about if there was a concrete 
example of such a case (even if it certainly is right to add the missing 
shebang line).

The changes I see fall into these categories:

- Change "#! <path>" into "#!<path>. Does this change have a functional 
effect for someone (where, and why?) or is it purely a cosmetic change?
- Add a shebang line in the generated ffbuild/config.sh. This script is 
highly unlikely to be useful to call on its own like that, so while this 
probably is good for consistency I don't see it ever making a difference.
- Add a shebang line in ffbuild/libversion.sh. I can see the value in 
calling this script directly, outside of our build system. I presume this 
is the actual change that makes a difference here?

I don't mind the changes, but I'd prefer to split them into two separate 
commits; add missing shebangs (with an example of the case where it really 
does make a difference), vs removing extra spaces in shebangs for 
consistency (with explicit clarification in the commit message whether 
this is only for stylistic consistency or whether it does make a 
difference somewhere, and if it does, where).

// Martin

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 2/2] configure: simplify bigendian check
  2024-04-08 13:16 ` [FFmpeg-devel] [PATCH v2 2/2] configure: simplify bigendian check J. Dekker
@ 2024-04-09  9:03   ` Martin Storsjö
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Storsjö @ 2024-04-09  9:03 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Mon, 8 Apr 2024, J. Dekker wrote:

> The preferred way to use LTO is --enable-lto but often times packagers
> still end up with -flto in cflags for various reasons. Using grep
> on binary object files is brittle and relies on specific object
> representation, which in the case of LLVM bitcode, debug-info or other
> intermediary formats can fail silently.
>
> This patch changes the check to a more commonly used define for
> big-endian systems.

It's not common only for big-endian systems, but for GCC-style compilers 
on all endians.

> More checks may need to be added in the future to cover legacy machines.

Don't use the word "legacy" here. This define is not standard, so it's 
perfectly plausible to have a modern, standards compliant compiler that 
just doesn't use this define.

With the commmit message you added here, the change is ok, but please do 
reword the last sentence above.

I'd suggest changing the last paragraph into this:

---
This patch changes the check to a more commonly used define for
GCC style compilers. More checks may be needed to cover other potential 
compilers that don't use the __BYTE_ORDER__ define.
---

// Martin

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-09  9:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-08 13:15 [FFmpeg-devel] [PATCH v2 1/2] configure,etc: unify shebang usage J. Dekker
2024-04-08 13:16 ` [FFmpeg-devel] [PATCH v2 2/2] configure: simplify bigendian check J. Dekker
2024-04-09  9:03   ` Martin Storsjö
2024-04-09  8:58 ` [FFmpeg-devel] [PATCH v2 1/2] configure, etc: unify shebang usage Martin Storsjö

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git