cmake: Windows codesigning refactor.
Quote variables containing the HOME or USERPROFILE, as they may have spaces. Check for both osslsigncode and signtool regardless of platform, and prefer osslsigncode. The reason for this being that osslsigncode is more reliable and does not depend on system configuration in any way, while signtool can fail under more conditions. The other reason being that you can use either program on both windows and linux. E.g. the mingw version of osslsigncode or the signtool from mono distributions on linux. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
parent
7a4a7d148c
commit
6c64db0794
|
@ -1007,32 +1007,20 @@ endif()
|
||||||
option(UPSTREAM_RELEASE "do some release automation tasks" OFF)
|
option(UPSTREAM_RELEASE "do some release automation tasks" OFF)
|
||||||
|
|
||||||
if(UPSTREAM_RELEASE AND WIN32)
|
if(UPSTREAM_RELEASE AND WIN32)
|
||||||
set(home $ENV{HOME})
|
set(home "$ENV{HOME}")
|
||||||
|
|
||||||
if(NOT CMAKE_CROSSCOMPILING AND NOT DEFINED ENV{MSYSTEM_PREFIX})
|
if(NOT CMAKE_CROSSCOMPILING AND NOT DEFINED ENV{MSYSTEM_PREFIX})
|
||||||
set(home $ENV{USERPROFILE})
|
set(home "$ENV{USERPROFILE}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# rewrite backslashes to slashes, needed for msys osslsigncode
|
# rewrite backslashes to slashes, needed for msys osslsigncode
|
||||||
string(REGEX REPLACE "\\\\" "/" home ${home})
|
string(REGEX REPLACE "\\\\" "/" home "${home}")
|
||||||
|
|
||||||
set(cert ${home}/.codesign/windows_comodo.pkcs12)
|
set(cert "${home}/.codesign/windows_comodo.pkcs12")
|
||||||
|
|
||||||
if(EXISTS ${cert})
|
if(EXISTS "${cert}")
|
||||||
if(MSVC)
|
|
||||||
find_program(SIGNTOOL_PROGRAM signtool)
|
|
||||||
|
|
||||||
if(SIGNTOOL_PROGRAM)
|
|
||||||
add_custom_command(
|
|
||||||
TARGET visualboyadvance-m
|
|
||||||
POST_BUILD
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy visualboyadvance-m.exe visualboyadvance-m-unsigned.exe
|
|
||||||
COMMAND ${SIGNTOOL_PROGRAM} sign /f ${cert} /p "vbam3!13" /tr http://timestamp.digicert.com /du https://github.com/visualboyadvance-m/visualboyadvance-m /a visualboyadvance-m.exe
|
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
find_program(OSSLSIGNCODE_PROGRAM osslsigncode)
|
find_program(OSSLSIGNCODE_PROGRAM osslsigncode)
|
||||||
|
find_program(SIGNTOOL_PROGRAM signtool)
|
||||||
|
|
||||||
if(OSSLSIGNCODE_PROGRAM)
|
if(OSSLSIGNCODE_PROGRAM)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
|
@ -1042,7 +1030,14 @@ if(UPSTREAM_RELEASE AND WIN32)
|
||||||
COMMAND ${OSSLSIGNCODE_PROGRAM} sign -pkcs12 ${cert} -pass "vbam3!13" -t http://timestamp.digicert.com -n visualboyadvance-m -i https://github.com/visualboyadvance-m/visualboyadvance-m -in visualboyadvance-m-unsigned.exe -out visualboyadvance-m.exe
|
COMMAND ${OSSLSIGNCODE_PROGRAM} sign -pkcs12 ${cert} -pass "vbam3!13" -t http://timestamp.digicert.com -n visualboyadvance-m -i https://github.com/visualboyadvance-m/visualboyadvance-m -in visualboyadvance-m-unsigned.exe -out visualboyadvance-m.exe
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
)
|
)
|
||||||
endif()
|
elseif(SIGNTOOL_PROGRAM)
|
||||||
|
add_custom_command(
|
||||||
|
TARGET visualboyadvance-m
|
||||||
|
POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy visualboyadvance-m.exe visualboyadvance-m-unsigned.exe
|
||||||
|
COMMAND ${SIGNTOOL_PROGRAM} sign /f ${cert} /p "vbam3!13" /tr http://timestamp.digicert.com /du https://github.com/visualboyadvance-m/visualboyadvance-m /a visualboyadvance-m.exe
|
||||||
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue