[FFmpeg-cvslog] compat/cuda/ptx2c: remove shell loop; fix BSD sed compat

rcombs git at videolan.org
Tue Jun 2 06:12:45 EEST 2020


ffmpeg | branch: master | rcombs <rcombs at rcombs.me> | Thu Aug 22 00:40:47 2019 -0500| [fb17ba86a871b858069472d4afd8509732d58e49] | committer: rcombs

compat/cuda/ptx2c: remove shell loop; fix BSD sed compat

This fixes building on macOS, and improves build times dramatically there

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fb17ba86a871b858069472d4afd8509732d58e49
---

 compat/cuda/ptx2c.sh | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/compat/cuda/ptx2c.sh b/compat/cuda/ptx2c.sh
index 0750e7a3b7..48452379c2 100755
--- a/compat/cuda/ptx2c.sh
+++ b/compat/cuda/ptx2c.sh
@@ -27,10 +27,8 @@ IN="$2"
 NAME="$(basename "$IN" | sed 's/\..*//')"
 
 printf "const char %s_ptx[] = \\" "$NAME" > "$OUT"
-while IFS= read -r LINE
-do
-    printf "\n\t\"%s\\\n\"" "$(printf "%s" "$LINE" | sed -e 's/\r//g' -e 's/["\\]/\\&/g')" >> "$OUT"
-done < "$IN"
-printf ";\n" >> "$OUT"
+echo >> "$OUT"
+sed -e "$(printf 's/\r//g')" -e 's/["\\]/\\&/g' -e "$(printf 's/^/\t"/')" -e 's/$/\\n"/' < "$IN" >> "$OUT"
+echo ";" >> "$OUT"
 
 exit 0



More information about the ffmpeg-cvslog mailing list