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