On 24.01.2016 17:14, Henrik Gramner wrote:
> On Sun, Jan 24, 2016 at 5:02 PM, Hendrik Leppkes <h.lepp...@gmail.com> wrote:
>> Windows doesn't particularly care which slash direction you give it,
>> so no, that changes nothing. I'm not quite sure why it fails with the
>> include path this way, maybe some msys shenanigans.
>> For fun and giggles, I hard-coded the correct include path in the
>> common.mak file and that made config.h show up again of course, but
>> the good old compiler error came back just like before.
>>
>> Might be msys thats interfering here and translating something it
>> shouldn't, or double-translating something, I can't really tell just
>> from the commands it calls.
>> Like I said before, when initial MSVC support was build by Ronald and
>> Martin, there were lots of troubles with absolute paths, which in the
>> end were solved by not using them (sorry, no answers here).

I have a hard time believing that there are environments, where one
can't use absolute paths...

> Is there any reason why we're using absolute paths then?

It is what $(pwd) gives us.

> Can't we just stick to relative paths with forward slashes since
> they seem to work with all tools?

OK, let's try this.
Attached is a patch calculating dst_path as relative path.
That should hopefully work everywhere. Please test it.

Best regards,
Andreas
>From 162a64541cb149bc44987473962f48eaafb1d416 Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
Date: Sun, 24 Jan 2016 18:49:53 +0100
Subject: [PATCH] configure: use a relative path for DST_PATH

MSVC environments don't handle absolute paths well.

Now the current path has to be always included, since some commands
(yasm) are run in the destination path.

Linking is also done in the destination path, so don't use DST_PATH
there.

Signed-off-by: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
---
 common.mak |  4 ++--
 configure  | 41 +++++++++++++++++++++++++++++++++++------
 2 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/common.mak b/common.mak
index 3812149..58d6ab1 100644
--- a/common.mak
+++ b/common.mak
@@ -32,7 +32,7 @@ endif
 ALLFFLIBS = avcodec avdevice avfilter avformat avresample avutil postproc swscale swresample
 
 # NASM requires -I path terminated with /
-IFLAGS     := -I$(DST_PATH)/ -I$(SRC_PATH)/
+IFLAGS     := -I. -I$(DST_PATH)/ -I$(SRC_PATH)/
 CPPFLAGS   := $(IFLAGS) $(CPPFLAGS)
 CFLAGS     += $(ECFLAGS)
 CCFLAGS     = $(CPPFLAGS) $(CFLAGS)
@@ -43,7 +43,7 @@ CXXFLAGS   += $(CPPFLAGS) $(CFLAGS)
 YASMFLAGS  += $(IFLAGS:%=%/) -Pconfig.asm
 
 HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS)
-LDFLAGS    := $(ALLFFLIBS:%=$(LD_PATH)$(DST_PATH)/lib%) $(LDFLAGS)
+LDFLAGS    := $(ALLFFLIBS:%=$(LD_PATH)lib%) $(LDFLAGS)
 
 define COMPILE
        $(call $(1)DEP,$(1))
diff --git a/configure b/configure
index 6fdb5dd..aeb05fd 100755
--- a/configure
+++ b/configure
@@ -3092,6 +3092,7 @@ DEPFLAGS='-MM'
 # find source path
 if test -f configure; then
     source_path=.
+    dst_path=.
 else
     source_path=$(cd $(dirname "$0"); pwd)
     case "$source_path" in
@@ -3099,6 +3100,40 @@ else
     esac
     test -e "$source_path/config.h" &&
         die "Out of tree builds are impossible with config.h in source dir."
+
+    # calculate the relative path from source to destination
+    dst_path_full=$(pwd)
+    common=$source_path
+    dst_path=""
+
+    while [ "${dst_path_full#$common}" = "${dst_path_full}" ]; do
+        # no match, means that the candidate common part is not correct
+        # go up one level (reduce common part)
+        common="$(dirname $common)"
+        # and record that we went back, with correct / handling
+        if [ -z $dst_path ]; then
+            dst_path=".."
+        else
+            dst_path="../$dst_path"
+        fi
+    done
+
+    if [ $common = "/" ]; then
+        # special case for root (no common path)
+        dst_path="$dst_path/"
+    fi
+
+    # since we now have identified the common part,
+    # compute the non-common part
+    forward_part="${dst_path_full#$common}"
+
+    # and now stick all parts together
+    if [ -n "$dst_path" ] && [ -n "$forward_part" ]; then
+        dst_path="$dst_path$forward_part"
+    elif [ -n "$forward_part" ]; then
+        # extra slash removal
+        dst_path=$(echo "$forward_part" | sed 's_^/__')
+    fi
 fi
 
 for v in "$@"; do
@@ -6229,12 +6264,6 @@ enabled stripping || strip="echo skipping strip"
 
 config_files="$TMPH config.mak doc/config.texi"
 
-if enabled msvc; then
-    dst_path=$(pwd -W)
-else
-    dst_path=$(pwd)
-fi
-
 cat > config.mak <<EOF
 # Automatically generated by configure - do not modify!
 ifndef FFMPEG_CONFIG_MAK
-- 
2.7.0.rc3

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

Reply via email to