From ffdf9681ab4a5fbb09655238f2aea8c7434fe0e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Tue, 21 Dec 2021 14:36:14 +0100 Subject: [PATCH] makeBinaryWrapper: create destination directory --- .../setup-hooks/make-binary-wrapper.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/setup-hooks/make-binary-wrapper.sh b/pkgs/build-support/setup-hooks/make-binary-wrapper.sh index abc929cb89db..986be5b9e113 100644 --- a/pkgs/build-support/setup-hooks/make-binary-wrapper.sh +++ b/pkgs/build-support/setup-hooks/make-binary-wrapper.sh @@ -33,13 +33,20 @@ assertExecutable() { # To troubleshoot a binary wrapper after you compiled it, # use the `strings` command or open the binary file in a text editor. makeWrapper() { - assertExecutable "$1" - makeDocumentedCWrapper "$1" "${@:3}" | \ + local original="$1" + local wrapper="$2" + shift 2 + + assertExecutable "$original" + + mkdir -p "$(dirname "$wrapper")" + + makeDocumentedCWrapper "$original" "$@" | \ @CC@ \ -Wall -Werror -Wpedantic \ -Os \ -x c \ - -o "$2" - + -o "$wrapper" - } # Syntax: wrapProgram