Warning, /pim/kdepim-addons/cmake/modules/kdepim_generate_crypto_test_wrapper.cmake is written in an unsupported language. File is not indexed.

0001 # SPDX-FileCopyrightText: 2006 Alexander Neundorf <neundorf@kde.org>
0002 # SPDX-FileCopyrightText: 2013 Sandro Knauß <mail@sandroknauss.de>
0003 #
0004 # SPDX-License-Identifier: BSD-3-Clause
0005 
0006 if (UNIX)
0007 
0008 file(WRITE "${_filename}"
0009 "#!/bin/sh
0010 # created by cmake, don't edit, changes will be lost
0011 
0012 # don't mess with a gpg-agent already running on the system
0013 unset GPG_AGENT_INFO
0014 
0015 # _gnupghome will contain a socket, and the path to that has a length limit of 108 chars
0016 # which that is easily reached. Therefore shorten this by copying this to a temporary dir.
0017 # This has the convenient side-effect that modifications to the content are not propagated
0018 # to other tests.
0019 tmp_dir=`mktemp -d -t messagelib-test-gnupg-home.XXXXXXXX` || exit 1
0020 cp -rf ${_gnupghome}/* $tmp_dir
0021 
0022 ${_library_path_variable}=${_ld_library_path}\${${_library_path_variable}:+:\$${_library_path_variable}} GNUPGHOME=$tmp_dir gpg-agent --daemon \"${_executable}\" \"$@\"
0023 _result=$?
0024 _pid=`echo GETINFO pid | GNUPGHOME=$tmp_dir gpg-connect-agent | grep 'D' | cut -d' ' -f2`
0025 if [ ! -z \"\$_pid\" ]; then
0026     echo \"Waiting for gpg-agent to terminate (PID: $_pid)...\"
0027     while kill -0 \"\$_pid\"; do
0028         sleep 1
0029     done
0030 fi
0031 rm -rf $tmp_dir
0032 exit \$_result
0033 ")
0034 
0035 # make it executable
0036 # since this is only executed on UNIX, it is safe to call chmod
0037 exec_program(chmod ARGS ug+x \"${_filename}\" OUTPUT_VARIABLE _dummy )
0038 
0039 else (UNIX)
0040 
0041 file(TO_NATIVE_PATH "${_ld_library_path}" win_path)
0042 file(TO_NATIVE_PATH "${_gnupghome}" win_gnupghome)
0043 
0044 file(WRITE "${_filename}"
0045 "
0046 set PATH=${win_path};$ENV{PATH}
0047 set GNUPGHOME=${win_gnupghome};$ENV{GNUPGHOME}
0048 gpg-agent --daemon \"${_executable}\" %*
0049 ")
0050 
0051 endif (UNIX)