diff mbox

[FFmpeg-devel] compat/cuda/ptx2c: strip CR from each line

Message ID 20170829004613.1832-1-wiiaboo@gmail.com
State New
Headers show

Commit Message

Ricardo Constantino Aug. 29, 2017, 12:46 a.m. UTC
Windows nvcc + cl.exe produce a .ctx file with CR+LF newlines which
need to be stripped to work with gcc.
---
 compat/cuda/ptx2c.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Timo Rothenpieler Aug. 29, 2017, 8:49 a.m. UTC | #1
Am 29.08.2017 um 02:46 schrieb Ricardo Constantino:
> Windows nvcc + cl.exe produce a .ctx file with CR+LF newlines which
> need to be stripped to work with gcc.
> ---
>   compat/cuda/ptx2c.sh | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/compat/cuda/ptx2c.sh b/compat/cuda/ptx2c.sh
> index 1f37023290..44b08b6ea2 100755
> --- a/compat/cuda/ptx2c.sh
> +++ b/compat/cuda/ptx2c.sh
> @@ -29,7 +29,7 @@ NAME="$(basename "$IN" | sed 's/\..*//')"
>   printf "const char %s_ptx[] = \\" "$NAME" > "$OUT"
>   while read LINE
>   do
> -    printf "\n\t\"%s\\\n\"" "$(printf "%s" "$LINE" | sed 's/["\\]/\\&/g')" >> "$OUT"
> +    printf "\n\t\"%s\\\n\"" "$(printf "%s" "$LINE"  | sed -e 's/\r//g' -e 's/["\\]/\\&/g')" >> "$OUT"
>   done < "$IN"
>   printf ";\n" >> "$OUT"
>   
> 

seems fine to me.
Timo Rothenpieler Aug. 30, 2017, 9:27 a.m. UTC | #2
applied
diff mbox

Patch

diff --git a/compat/cuda/ptx2c.sh b/compat/cuda/ptx2c.sh
index 1f37023290..44b08b6ea2 100755
--- a/compat/cuda/ptx2c.sh
+++ b/compat/cuda/ptx2c.sh
@@ -29,7 +29,7 @@  NAME="$(basename "$IN" | sed 's/\..*//')"
 printf "const char %s_ptx[] = \\" "$NAME" > "$OUT"
 while read LINE
 do
-    printf "\n\t\"%s\\\n\"" "$(printf "%s" "$LINE" | sed 's/["\\]/\\&/g')" >> "$OUT"
+    printf "\n\t\"%s\\\n\"" "$(printf "%s" "$LINE"  | sed -e 's/\r//g' -e 's/["\\]/\\&/g')" >> "$OUT"
 done < "$IN"
 printf ";\n" >> "$OUT"