From patchwork Fri Oct 29 08:54:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 1547896 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=wu5p9t4w; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Z96mNdhp; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hgbsp32mXz9sRN for ; Fri, 29 Oct 2021 19:57:34 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=3/4/LQnL1ila4LmE4ADoktEUFbg6dqvhLcU+xaIOTFM=; b=wu5p9t4wfHfLli KOZPLyoI81fJpFP4n2y6/WqhagBHlWIYG0UmFulcWxNnE8+cOB+SA9KVheLZijjJczqY+HanGlq1d 6l/3/7ee7E/urigqu4I8aclX93jQ9m0Z/MMnh+lSG45gTWtMwacV3yXhaczSCoBcjQE37a3/6luqJ 71G+8KIHPEEKl/P94GYrQAJ8S+8CodCwPl5vSJxqFQu81fi05htQwvPOl3PSEZIppNALh74u005cR qAlzV5DdPT3OY0WeJJtWpnZG9iCDNt3k8ROs/rAPB1lBNsVrtLIvLpEwaLMf7d0NUZRN9yNEkqXqq 5Jcy9F5CSRgwv7k+1H6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgNfc-00AOwq-V9; Fri, 29 Oct 2021 08:55:29 +0000 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mgNfB-00AOod-MG for openwrt-devel@lists.openwrt.org; Fri, 29 Oct 2021 08:55:03 +0000 Received: by mail-ed1-x531.google.com with SMTP id w15so36341452edc.9 for ; Fri, 29 Oct 2021 01:55:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qwT5Sga1YrRPP4uw5qBOy91Jc6uoRwSBisauXml2QzA=; b=Z96mNdhpuK+uN9dIWFW4wxykRuBtbBOFXT5CDTyGAUghwu/nHJ834ETMIYbfBf10sB TW1tzRNCf/O1F/df/AGGoRh7jDlB8rDMGX5/g6otvmrtnfTSqvUYrRLyPakhhucq0D/g 7tFnsCF/ujYEQfjSSJrIH7mI38hs/1q+MYZzQ7pX5vvXGBBWFCYmF1M2udS7FeEyzZzf Fucg0oV8O1/a1u5+4p1Z1LNRG87emMUltVlcWXGeHyXtpQ/cHQTaWDRjgwpK7LpTXREm RRlaaDOES9QRp7G3m/IXeXLXGglTDqUqPMQ7bk4Z13wvqiMoKWz9yN/qhFQ3ZF2F7fVM W03g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qwT5Sga1YrRPP4uw5qBOy91Jc6uoRwSBisauXml2QzA=; b=DvdkyALPirdDXpgXP6P+/IkBcWKFKoktNH2tVFfZrBDf1lpBx09hh06o6b6iQhwPFD P63U/1QEkdqRKo68RGCtoY79te2T+CDadPdbu2iIIAHlWTfT+y1VmZQ1saky7a1/fpfG cUxO2+Int5RsORCOKRO+z04KyqGs43cPzpx1ECEpAwwzKU9za8hHjHxdiUdGAUlhFfjP pRSazAK+PxHhmeHWV2oaw2goCJKSWE+jGOlNtPcL5iNMDKT9zW/wocgSq74L4W9r+xZe lgItIz0U39U4/e1tCf28wzRKp1vjdkaxGoeQ532/x9grLRiMEiNEwwUiPkgiWP1xOnA3 uqrw== X-Gm-Message-State: AOAM532uUYRra6lsJxZuVllpQMk9haJY4tnNOZFduBP7Q/vBMrxxjiye IjiFVogAoDH4lrDvr+1yFur9kEk1UtY= X-Google-Smtp-Source: ABdhPJw2teRMurObPfk2IORP2Qox7827ZRcPw9UhidKcpNvudBgJysovqVmDTqvZtUYgzJXwcTC8HQ== X-Received: by 2002:a05:6402:1d49:: with SMTP id dz9mr13182807edb.55.1635497699208; Fri, 29 Oct 2021 01:54:59 -0700 (PDT) Received: from neptune.. ([5.2.193.191]) by smtp.gmail.com with ESMTPSA id go16sm2548545ejc.23.2021.10.29.01.54.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Oct 2021 01:54:58 -0700 (PDT) From: Alexandru Ardelean To: openwrt-devel@lists.openwrt.org Cc: ynezz@true.cz, Alexandru Ardelean Subject: [firmware-utils][PATCH 1/2] build, cmake: add quotes for FW_UTIL variable arguments Date: Fri, 29 Oct 2021 11:54:43 +0300 Message-Id: <20211029085444.687583-1-ardeleanalex@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211029_015501_769408_39CD4A41 X-CRM114-Status: UNSURE ( 8.65 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: CMake macro arguments are special, so when passing ${ZLIB_LIBRARIES} as an argument, this can actually be a list of strings. In this case, the first library (for zlib) will be added to TARGET_LINK_LIB [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:531 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [ardeleanalex[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org CMake macro arguments are special, so when passing ${ZLIB_LIBRARIES} as an argument, this can actually be a list of strings. In this case, the first library (for zlib) will be added to TARGET_LINK_LIBRARIES() and the others will be discarded. This is likely due to some expansion from the FW_UTIL macro. So, if FindZLIB returns more libraries for linking, they will not be considered. This is the case when trying to change OPENSSL_CRYPTO_LIBRARY -> OPENSSL_CRYPTO_LIBRARIES. OPENSSL_CRYPTO_LIBRARY is just libcrypto.a OPENSSL_CRYPTO_LIBRARIES can also include -ldl There's a few points made here about macros: https://cmake.org/cmake/help/latest/command/macro.html#argument-caveats Signed-off-by: Alexandru Ardelean --- CMakeLists.txt | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 556ec72..3e206a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,10 +18,10 @@ ADD_DEFINITIONS(-Wall -Wno-unused-parameter) MACRO(FW_UTIL util deps extra_cflags libs) ADD_EXECUTABLE(${util} src/${util}.c ${deps}) INSTALL(TARGETS ${util} RUNTIME) - IF(NOT ${ARGV2} STREQUAL "") + IF(NOT "${extra_cflags}" STREQUAL "") SET_TARGET_PROPERTIES(${util} PROPERTIES COMPILE_FLAGS ${extra_cflags}) ENDIF() - IF(NOT ${ARGV3} STREQUAL "") + IF(NOT "${libs}" STREQUAL "") TARGET_LINK_LIBRARIES(${util} ${libs}) ENDIF() ENDMACRO(FW_UTIL) @@ -42,9 +42,9 @@ FW_UTIL(encode_crc "" "" "") FW_UTIL(fix-u-media-header src/cyg_crc32.c "" "") FW_UTIL(hcsmakeimage src/bcmalgo.c "" "") FW_UTIL(imagetag "src/imagetag_cmdline.c;src/cyg_crc32.c" "" "") -FW_UTIL(jcgimage "" "" ${ZLIB_LIBRARIES}) +FW_UTIL(jcgimage "" "" "${ZLIB_LIBRARIES}") FW_UTIL(lxlfw "" "" "") -FW_UTIL(lzma2eva "" "" ${ZLIB_LIBRARIES}) +FW_UTIL(lzma2eva "" "" "${ZLIB_LIBRARIES}") FW_UTIL(makeamitbin "" "" "") FW_UTIL(mkbrncmdline "" "" "") FW_UTIL(mkbrnimg "" "" "") @@ -56,20 +56,20 @@ FW_UTIL(mkcsysimg "" "" "") FW_UTIL(mkdapimg "" "" "") FW_UTIL(mkdapimg2 "" "" "") FW_UTIL(mkdhpimg src/buffalo-lib.c "" "") -FW_UTIL(mkdlinkfw src/mkdlinkfw-lib.c --std=c99 ${ZLIB_LIBRARIES}) +FW_UTIL(mkdlinkfw src/mkdlinkfw-lib.c --std=c99 "${ZLIB_LIBRARIES}") FW_UTIL(mkdniimg "" "" "") FW_UTIL(mkedimaximg "" "" "") -FW_UTIL(mkfwimage "" "-Wextra -D_FILE_OFFSET_BITS=64" ${ZLIB_LIBRARIES}) -FW_UTIL(mkfwimage2 "" "" ${ZLIB_LIBRARIES}) -FW_UTIL(mkheader_gemtek "" "" ${ZLIB_LIBRARIES}) -FW_UTIL(mkhilinkfw "" "" ${OPENSSL_CRYPTO_LIBRARY}) +FW_UTIL(mkfwimage "" "-Wextra -D_FILE_OFFSET_BITS=64" "${ZLIB_LIBRARIES}") +FW_UTIL(mkfwimage2 "" "" "${ZLIB_LIBRARIES}") +FW_UTIL(mkheader_gemtek "" "" "${ZLIB_LIBRARIES}") +FW_UTIL(mkhilinkfw "" "" "${OPENSSL_CRYPTO_LIBRARY}") FW_UTIL(mkmerakifw src/sha1.c "" "") FW_UTIL(mkmerakifw-old "" "" "") FW_UTIL(mkmylofw "" "" "") FW_UTIL(mkplanexfw src/sha1.c "" "") FW_UTIL(mkporayfw "" "" "") FW_UTIL(mkrasimage "" --std=gnu99 "") -FW_UTIL(mkrtn56uimg "" "" ${ZLIB_LIBRARIES}) +FW_UTIL(mkrtn56uimg "" "" "${ZLIB_LIBRARIES}") FW_UTIL(mksenaofw src/md5.c --std=gnu99 "") FW_UTIL(mksercommfw "" "" "") FW_UTIL(mktitanimg "" "" "") @@ -96,8 +96,8 @@ FW_UTIL(tplink-safeloader src/md5.c --std=gnu99 "") FW_UTIL(trx "" "" "") FW_UTIL(trx2edips "" "" "") FW_UTIL(trx2usr "" "" "") -FW_UTIL(uimage_padhdr "" "" ${ZLIB_LIBRARIES}) -FW_UTIL(uimage_sgehdr "" "" ${ZLIB_LIBRARIES}) +FW_UTIL(uimage_padhdr "" "" "${ZLIB_LIBRARIES}") +FW_UTIL(uimage_sgehdr "" "" "${ZLIB_LIBRARIES}") FW_UTIL(wrt400n src/cyg_crc32.c "" "") FW_UTIL(xiaomifw "" "" "") FW_UTIL(xorimage "" "" "")