[FFmpeg-devel] Line endings in Makefiles

Andreas Weis der_ghulbus at ghulbus-inc.de
Thu Apr 21 08:11:47 CEST 2016

Hi there,

I noticed that the ffmpeg build system still can get broken if you `git
clone` on Windows with the wrong settings for the git config autocrlf

There has been a ticket about this (#1209) but it was closed without a
fix because of the existing workaround of changing the global git
option. This is arguably less than ideal, as it impacts the behavior for
all git commands on the machine.

Nowadays git allows enforcing a specific line ending convention for
files via the .gitattributes file. This has the advantage that it is a
local configuration: rather than having the user take care of
configuring the line endings correctly, the repo itself can specify
which line ending conventions it wants.

I read on your commit guidelines that you are very picky with patches
that impact the build system. I attached a small patch with the minimal
changes to .gitattributes to make ffmpeg compile on a fresh Windows
checkout with autocrlf=true. It might be desirable to enable the same
behavior for other build script files like configure.

Thanks & regards,
-------------- next part --------------
From 0d32c2105dc17be4de6aa1c76947d7baef62a5ba Mon Sep 17 00:00:00 2001
From: Andreas Weis <der_ghulbus at ghulbus-inc.de>
Date: Thu, 21 Apr 2016 07:48:22 +0200
Subject: [PATCH] Preserve correct line-endings for Makefiles

The build system scripts are sensitive to automatic line-ending
conversions by git (ticket #1209). This change ensures that git always
preserves the correct (Unix-style) line endings on checkout, regardless of
the system's native conventions and global git config settings.
 .gitattributes | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/.gitattributes b/.gitattributes
index a900528..c926d82 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1 +1,4 @@
 *.pnm -diff -text
+Makefile text eol=lf
+*.mak text eol=lf

More information about the ffmpeg-devel mailing list