[{"id":1497,"web_url":"https://patchwork.libcamera.org/comment/1497/","msgid":"<cf7a7883-afef-919c-32fd-4f5300231f35@ideasonboard.com>","date":"2019-04-26T06:56:58","subject":"Re: [libcamera-devel] [PATCH 1/2] meson: check if secure_getenv()\n\tis present","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Giulio,\n\nThank you for the patch,\n\nOn 24/04/2019 13:00, Giulio Benetti wrote:\n> Not all libc make secure_getenv() available, this could lead to build\n> failure on certain build systems.\n> \n> Check if secure_getenv() and emit #define HAVE_SECURE_GETENV to config.h\n> Include config.h to every c/c++ file during building by adding `-include\n> config.h` to project arguments for both c and c++.\n\nThank you, I think this is a better approach to resolving the issue.\n\n> Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>\n> ---\n>  meson.build | 12 ++++++++++++\n>  1 file changed, 12 insertions(+)\n> \n> diff --git a/meson.build b/meson.build\n> index 6e68c3e..ee9f5bf 100644\n> --- a/meson.build\n> +++ b/meson.build\n> @@ -25,6 +25,18 @@ add_project_arguments(cpp_arguments, language: 'cpp')\n>  \n>  libcamera_includes = include_directories('include')\n>  \n> +cc = meson.get_compiler('c')\n> +config_h = configuration_data()\n> +\n> +if cc.has_header_symbol('stdlib.h', 'secure_getenv', prefix: '#define _GNU_SOURCE')\n> +    config_h.set('HAVE_SECURE_GETENV', 1)\n> +else\n> +    message('C library does not support secure_getenv, using getenv instead')\n> +endif\n> +configure_file(output: 'config.h', configuration: config_h)\n> +add_project_arguments('-include', 'config.h', language: 'c')\n> +add_project_arguments('-include', 'config.h', language: 'cpp')\n\nI wonder if we should put this earlier in the file, and/or simply add\n'-include', 'config.h' to the common_arguments variable which already\ngets added to both 'c' and 'cpp' languages....\n\nIt's not critical though.\n\nDoes anyone else have an opinion here?\n\n> +\n>  subdir('include')\n>  subdir('src')\n>  subdir('utils')\n>","headers":{"Return-Path":"<kieran.bingham@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1E96B60E99\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Apr 2019 08:57:04 +0200 (CEST)","from [192.168.1.6] (net-37-182-44-227.cust.vodafonedsl.it\n\t[37.182.44.227])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6FE915F;\n\tFri, 26 Apr 2019 08:57:03 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1556261823;\n\tbh=Pf5V6VZopxn33BT9e5rjLc3ZW4BD/jr57wevmmcb9Ow=;\n\th=Reply-To:Subject:To:References:From:Date:In-Reply-To:From;\n\tb=kl2efGxI+aDuKknzwcbotz9UqMT/y7jZ6Z4sG2etEaiUsCDyPDaBqEjeXqGzIKIO+\n\t7xQtpkUj84onY/Ysz9GvSBMsx7D1i7lBmrARSLQ1XI2Hj/qRadicJnmYVYw3/i6UQh\n\toPV+wTfm9xFUHYdQ05Y4VGgP2lEBu4Edp1fPU49A=","Reply-To":"kieran.bingham@ideasonboard.com","To":"Giulio Benetti <giulio.benetti@micronovasrl.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<364aa322-85ca-2c17-984e-1e807bd832ca@micronovasrl.com>\n\t<20190424110044.12608-1-giulio.benetti@micronovasrl.com>\n\t<20190424110044.12608-2-giulio.benetti@micronovasrl.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Openpgp":"preference=signencrypt","Autocrypt":"addr=kieran.bingham@ideasonboard.com; keydata=\n\tmQINBFYE/WYBEACs1PwjMD9rgCu1hlIiUA1AXR4rv2v+BCLUq//vrX5S5bjzxKAryRf0uHat\n\tV/zwz6hiDrZuHUACDB7X8OaQcwhLaVlq6byfoBr25+hbZG7G3+5EUl9cQ7dQEdvNj6V6y/SC\n\trR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WYem6pLwaw6IAL7oX+tEqIMPph/G/jwZcdS6Hkyt/esHPuHNwX4guqTbVEuRqbDzDI\n\t2DJO5FbxABEBAAGJAiUEGAEKAA8CGwwFAlnDlGsFCQeA/gIACgkQoR5GchCkYf1yYRAAq+Yo\n\tnbf9DGdK1kTAm2RTFg+w9oOp2Xjqfhds2PAhFFvrHQg1XfQR/UF/SjeUmaOmLSczM0s6XMeO\n\tVcE77UFtJ/+hLo4PRFKm5X1Pcar6g5m4xGqa+Xfzi9tRkwC29KMCoQOag1BhHChgqYaUH3yo\n\tUzaPwT/fY75iVI+yD0ih/e6j8qYvP8pvGwMQfrmN9YB0zB39YzCSdaUaNrWGD3iCBxg6lwSO\n\tLKeRhxxfiXCIYEf3vwOsP3YMx2JkD5doseXmWBGW1U0T/oJF+DVfKB6mv5UfsTzpVhJRgee7\n\t4jkjqFq4qsUGxcvF2xtRkfHFpZDbRgRlVmiWkqDkT4qMA+4q1y/dWwshSKi/uwVZNycuLsz+\n\t+OD8xPNCsMTqeUkAKfbD8xW4LCay3r/dD2ckoxRxtMD9eOAyu5wYzo/ydIPTh1QEj9SYyvp8\n\tO0g6CpxEwyHUQtF5oh15O018z3ZLztFJKR3RD42VKVsrnNDKnoY0f4U0z7eJv2NeF8xHMuiU\n\tRCIzqxX1GVYaNkKTnb/Qja8hnYnkUzY1Lc+OtwiGmXTwYsPZjjAaDX35J/RSKAoy5wGo/YFA\n\tJxB1gWThL4kOTbsqqXj9GLcyOImkW0lJGGR3o/fV91Zh63S5TKnf2YGGGzxki+ADdxVQAm+Q\n\tsbsRB8KNNvVXBOVNwko86rQqF9drZuw=","Organization":"Ideas on Board","Message-ID":"<cf7a7883-afef-919c-32fd-4f5300231f35@ideasonboard.com>","Date":"Fri, 26 Apr 2019 08:56:58 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101\n\tThunderbird/60.6.1","MIME-Version":"1.0","In-Reply-To":"<20190424110044.12608-2-giulio.benetti@micronovasrl.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH 1/2] meson: check if secure_getenv()\n\tis present","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 26 Apr 2019 06:57:04 -0000"}},{"id":1499,"web_url":"https://patchwork.libcamera.org/comment/1499/","msgid":"<9df0a06d-a1d2-e8b5-9180-5be855b955c6@micronovasrl.com>","date":"2019-04-26T07:41:15","subject":"Re: [libcamera-devel] [PATCH 1/2] meson: check if secure_getenv()\n\tis present","submitter":{"id":16,"url":"https://patchwork.libcamera.org/api/people/16/","name":"Giulio Benetti","email":"giulio.benetti@micronovasrl.com"},"content":"Hi Kieran, All,\n\nIl 26/04/2019 08:56, Kieran Bingham ha scritto:\n> Hi Giulio,\n> \n> Thank you for the patch,\n> \n> On 24/04/2019 13:00, Giulio Benetti wrote:\n>> Not all libc make secure_getenv() available, this could lead to build\n>> failure on certain build systems.\n>>\n>> Check if secure_getenv() and emit #define HAVE_SECURE_GETENV to config.h\n>> Include config.h to every c/c++ file during building by adding `-include\n>> config.h` to project arguments for both c and c++.\n> \n> Thank you, I think this is a better approach to resolving the issue.\n> \n>> Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>\n>> ---\n>>   meson.build | 12 ++++++++++++\n>>   1 file changed, 12 insertions(+)\n>>\n>> diff --git a/meson.build b/meson.build\n>> index 6e68c3e..ee9f5bf 100644\n>> --- a/meson.build\n>> +++ b/meson.build\n>> @@ -25,6 +25,18 @@ add_project_arguments(cpp_arguments, language: 'cpp')\n>>   \n>>   libcamera_includes = include_directories('include')\n>>   \n>> +cc = meson.get_compiler('c')\n>> +config_h = configuration_data()\n>> +\n>> +if cc.has_header_symbol('stdlib.h', 'secure_getenv', prefix: '#define _GNU_SOURCE')\n>> +    config_h.set('HAVE_SECURE_GETENV', 1)\n>> +else\n>> +    message('C library does not support secure_getenv, using getenv instead')\n>> +endif\n>> +configure_file(output: 'config.h', configuration: config_h)\n>> +add_project_arguments('-include', 'config.h', language: 'c')\n>> +add_project_arguments('-include', 'config.h', language: 'cpp')\n> \n> I wonder if we should put this earlier in the file, and/or simply add\n> '-include', 'config.h' to the common_arguments variable which already\n> gets added to both 'c' and 'cpp' languages....\n\nYes, you're totally right, it's cleaner. I didn't notice \ncommon_arguments at all.\n\n> It's not critical though.\n> \n> Does anyone else have an opinion here?\n> \n>> +\n>>   subdir('include')\n>>   subdir('src')\n>>   subdir('utils')\n>>\n>","headers":{"Return-Path":"<giulio.benetti@micronovasrl.com>","Received":["from mail.micronovasrl.com (mail.micronovasrl.com [212.103.203.10])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 59CA360004\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Apr 2019 09:41:16 +0200 (CEST)","from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1])\n\tby mail.micronovasrl.com (Postfix) with ESMTP id C3674B0148A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 26 Apr 2019 09:41:15 +0200 (CEST)","from mail.micronovasrl.com ([127.0.0.1])\n\tby mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1])\n\t(amavisd-new, port 10026)\n\twith ESMTP id ynsqgIEh8sOX for <libcamera-devel@lists.libcamera.org>; \n\tFri, 26 Apr 2019 09:41:15 +0200 (CEST)","from [192.168.2.109] (88-149-228-83.v4.ngi.it [88.149.228.83])\n\tby mail.micronovasrl.com (Postfix) with ESMTPSA id 04768B00C10;\n\tFri, 26 Apr 2019 09:41:14 +0200 (CEST)"],"Authentication-Results":"mail.micronovasrl.com (amavisd-new); dkim=pass\n\treason=\"pass (just generated, assumed good)\" header.d=micronovasrl.com","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=micronovasrl.com;\n\th=content-transfer-encoding:content-language:content-type\n\t:content-type:in-reply-to:mime-version:user-agent:date:date\n\t:message-id:from:from:references:to:subject:subject; s=dkim; t=\n\t1556264475; x=1557128476; bh=tzVXGmQezGt1FFdbdop6B+rqEIcc2Sy3ZI5\n\tqXf2NCe0=; b=iwvl38E/1d20nY91l/27j8/bDK40GOtCD1XpG1qbLVZnuF1ZnQV\n\tmcm+hsFzlZbBE/Gy1IAmdznHw7Qt9WvrJl7mQVTNEeMOEwS3rz8ffaCFrWXsOveG\n\tM8VT+Mi1wktEYi3evH9GzZRGxm2Pvep9U/Fewb/6Qz4rb5MaICSom3zw=","X-Virus-Scanned":"Debian amavisd-new at mail.micronovasrl.com","X-Spam-Flag":"NO","X-Spam-Score":"-2.9","X-Spam-Level":"","X-Spam-Status":"No, score=-2.9 tagged_above=-10 required=4.5\n\ttests=[ALL_TRUSTED=-1, BAYES_00=-1.9]\n\tautolearn=unavailable autolearn_force=no","To":"kieran.bingham@ideasonboard.com, libcamera-devel@lists.libcamera.org","References":"<364aa322-85ca-2c17-984e-1e807bd832ca@micronovasrl.com>\n\t<20190424110044.12608-1-giulio.benetti@micronovasrl.com>\n\t<20190424110044.12608-2-giulio.benetti@micronovasrl.com>\n\t<cf7a7883-afef-919c-32fd-4f5300231f35@ideasonboard.com>","From":"Giulio Benetti <giulio.benetti@micronovasrl.com>","Message-ID":"<9df0a06d-a1d2-e8b5-9180-5be855b955c6@micronovasrl.com>","Date":"Fri, 26 Apr 2019 09:41:15 +0200","User-Agent":"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101\n\tThunderbird/60.6.1","MIME-Version":"1.0","In-Reply-To":"<cf7a7883-afef-919c-32fd-4f5300231f35@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Language":"it","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH 1/2] meson: check if secure_getenv()\n\tis present","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 26 Apr 2019 07:41:16 -0000"}}]