From patchwork Tue May 26 17:42:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: rcombs X-Patchwork-Id: 19881 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 7639844A5BC for ; Tue, 26 May 2020 20:42:36 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4F83D688341; Tue, 26 May 2020 20:42:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from so254-54.mailgun.net (so254-54.mailgun.net [198.61.254.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1CC3B6880DA for ; Tue, 26 May 2020 20:42:28 +0300 (EEST) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=rcombs.me; q=dns/txt; s=mx; t=1590514949; h=Content-Transfer-Encoding: MIME-Version: Message-Id: Date: Subject: To: From: Sender; bh=m/GP2L0j8iXPGp9pNhj+yG2dWBcyNIe6+2IiJACGn8E=; b=dstjDxX5+lQpa6eA8/b5kx6rYhwaNAAGJnrb6OMJGNE3p3KpOINuE1TGMMm9qtb7JKUHh8/N PDWM8CoBNE5JBqlJbIBLuQwQE0hF/KMupiaOeD8MzcStKHct+67xabXxy9m2jWaeLMjqbfyo kH720xBNO/+4EgcZpT6XkZinnRU= X-Mailgun-Sending-Ip: 198.61.254.54 X-Mailgun-Sid: WyJiZDU1MSIsICJmZm1wZWctZGV2ZWxAZmZtcGVnLm9yZyIsICJiMGJhIl0= Received: from rcombs-mbp.localdomain ( [24.14.135.13]) by smtp-out-n02.prod.us-east-1.postgun.com with SMTP id 5ecd5501c0031c71c26247a4 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 26 May 2020 17:42:25 GMT From: rcombs To: ffmpeg-devel@ffmpeg.org Date: Tue, 26 May 2020 12:42:23 -0500 Message-Id: <20200526174223.71733-1-rcombs@rcombs.me> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] compat/cuda/ptx2c: remove shell loop; fix BSD sed compat X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This improves build times dramatically, and fixes building on macOS --- 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..c41875a2d4 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 $'s/\r//g' -e 's/["\\]/\\&/g' -e $'s/^[[:space:]]*/\t"/' -e 's/$/\\n"/' < "$IN" >> "$OUT" +echo ";" >> "$OUT" exit 0