DRC | 11ca3b4 | 2011-10-05 07:53:29 +0000 | [diff] [blame] | 1 | if(NOT Java_PATH) |
| 2 | message(FATAL_ERROR "Java_PATH must be defined") |
| 3 | endif() |
| 4 | |
| 5 | if(NOT JAR_FILE) |
| 6 | message(FATAL_ERROR "JAR_FILE must be defined") |
| 7 | endif() |
| 8 | |
DRC | d000252 | 2011-10-05 09:18:55 +0000 | [diff] [blame] | 9 | message(STATUS "Signing ${JAR_FILE}") |
| 10 | |
DRC | 11ca3b4 | 2011-10-05 07:53:29 +0000 | [diff] [blame] | 11 | set(KEYTOOL "${Java_PATH}/keytool") |
| 12 | set(JARSIGNER "${Java_PATH}/jarsigner") |
| 13 | |
| 14 | file(REMOVE tigervnc.keystore) |
| 15 | execute_process(COMMAND |
| 16 | ${KEYTOOL} -genkey -alias TigerVNC -keystore tigervnc.keystore -keyalg RSA |
| 17 | -storepass tigervnc -keypass tigervnc -validity 7300 |
DRC | 5d8704b | 2011-10-05 08:51:05 +0000 | [diff] [blame] | 18 | -dname "CN=TigerVNC, OU=Software Development, O=The TigerVNC Project, L=Austin, S=Texas, C=US" |
| 19 | RESULT_VARIABLE RESULT OUTPUT_VARIABLE OUTPUT ERROR_VARIABLE ERROR) |
| 20 | if(NOT RESULT EQUAL 0) |
| 21 | message(FATAL_ERROR "${KEYTOOL} failed:\n${ERROR}") |
| 22 | endif() |
DRC | 11ca3b4 | 2011-10-05 07:53:29 +0000 | [diff] [blame] | 23 | execute_process(COMMAND |
| 24 | ${JARSIGNER} -keystore tigervnc.keystore |
DRC | 5d8704b | 2011-10-05 08:51:05 +0000 | [diff] [blame] | 25 | -storepass tigervnc -keypass tigervnc ${JAR_FILE} TigerVNC |
| 26 | RESULT_VARIABLE RESULT OUTPUT_VARIABLE OUTPUT ERROR_VARIABLE ERROR) |
DRC | 21b3eb9 | 2011-10-05 09:03:43 +0000 | [diff] [blame] | 27 | if(NOT RESULT EQUAL 0) |
DRC | 5d8704b | 2011-10-05 08:51:05 +0000 | [diff] [blame] | 28 | message(FATAL_ERROR "${JARSIGNER} failed:\n${ERROR}") |
| 29 | endif() |
DRC | 11ca3b4 | 2011-10-05 07:53:29 +0000 | [diff] [blame] | 30 | file(REMOVE tigervnc.keystore) |