cmake: Release automation followup.

Followup on e98d8931.

Set the BITS variable in Architecture.cmake even if
CMAKE_SYSTEM_PROCESSOR is not set, and it often isn't. This allows for
generating the right release zip for 32 bit MinGW builds.

When invoking zip to make the translations.zip, use `.` instead of `*`
as the argument, with the correct WORKING_DIRECTORY, so as not to rely
on shell globbing of any sort. This broke for the 32 bit MinGW cross
build.

Fix the keychain unlock command on mac, the keychain must be unlocked to
use the codesigning certificate.

Fix the translations.zip.asc signature overwrite prompt on Windows.

For the mac builder, automatically use Xcode 9 for 32 bit builds if
installed, this is necessary on 10.14 (Mojave) and later.

Add interactive-pause.cmake script to wait for the user to press enter
before continuing, invoke it before gpg commands so that waiting for the
passphrase does not time out. It will not run if ENV{CI} is set or
ENV{VBAM_NO_PAUSE} is set, this is so that later we can set up automated
builds.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2019-12-25 23:14:45 +00:00
parent f7f424ea1b
commit d3397e6a1a
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
5 changed files with 45 additions and 8 deletions

View File

@ -10,20 +10,24 @@ if(NOT CMAKE_SYSTEM_PROCESSOR)
endif() endif()
endif() endif()
# turn asm on by default on 32bit x86 # The processor may not be set, but set BITS regardless.
# and set WINARCH for windows stuff if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 4)
set(BITS 32)
elseif(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
set(BITS 64)
endif()
# Turn asm on by default on 32bit x86 and set WINARCH for windows stuff.
if(CMAKE_SYSTEM_PROCESSOR MATCHES "[xX]86|i[3-9]86|[aA][mM][dD]64") if(CMAKE_SYSTEM_PROCESSOR MATCHES "[xX]86|i[3-9]86|[aA][mM][dD]64")
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 4) # 32 bit if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 4) # 32 bit
set(ASM_DEFAULT ON) set(ASM_DEFAULT ON)
set(X86_32 ON) set(X86_32 ON)
set(X86 ON) set(X86 ON)
set(WINARCH x86) set(WINARCH x86)
set(BITS 32) elseif(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
else()
set(AMD64 ON) set(AMD64 ON)
set(X64 ON) set(X64 ON)
set(WINARCH x64) set(WINARCH x64)
set(BITS 64)
endif() endif()
if(DEFINED VCPKG_TARGET_TRIPLET) if(DEFINED VCPKG_TARGET_TRIPLET)

View File

@ -967,7 +967,7 @@ 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 "$ENV{MSYSTEM_PREFIX}" STREQUAL "") if(NOT CMAKE_CROSSCOMPILING AND NOT DEFINED ENV{MSYSTEM_PREFIX})
set(home $ENV{USERPROFILE}) set(home $ENV{USERPROFILE})
endif() endif()
@ -1018,6 +1018,8 @@ if(UPSTREAM_RELEASE AND WIN32)
if(GPG_PROGRAM) if(GPG_PROGRAM)
add_custom_command( add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/translations.zip.asc OUTPUT ${CMAKE_BINARY_DIR}/translations.zip.asc
COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/translations.zip.asc
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/interactive-pause.cmake
COMMAND ${GPG_PROGRAM} --detach-sign -a ${CMAKE_BINARY_DIR}/translations.zip COMMAND ${GPG_PROGRAM} --detach-sign -a ${CMAKE_BINARY_DIR}/translations.zip
DEPENDS translations-zip DEPENDS translations-zip
) )
@ -1030,6 +1032,7 @@ if(UPSTREAM_RELEASE AND WIN32)
TARGET visualboyadvance-m TARGET visualboyadvance-m
POST_BUILD POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove ${exezip}.asc COMMAND ${CMAKE_COMMAND} -E remove ${exezip}.asc
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/interactive-pause.cmake
COMMAND ${GPG_PROGRAM} --detach-sign -a ${exezip} COMMAND ${GPG_PROGRAM} --detach-sign -a ${exezip}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
) )
@ -1091,7 +1094,7 @@ if(UPSTREAM_RELEASE AND APPLE)
add_custom_command( add_custom_command(
TARGET visualboyadvance-m TARGET visualboyadvance-m
POST_BUILD POST_BUILD
COMMAND /bin/sh -c "security unlock-keychain -p \"\$LOGIN_KEYCHAIN_PASSWORD\" ~/Library/Keychains/login.keychain*" COMMAND /bin/sh -c "security unlock-keychain -p \"$$LOGIN_KEYCHAIN_PASSWORD\" ~/Library/Keychains/login.keychain*"
) )
add_custom_command( add_custom_command(
@ -1121,6 +1124,7 @@ if(UPSTREAM_RELEASE AND APPLE)
TARGET visualboyadvance-m TARGET visualboyadvance-m
POST_BUILD POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove ${appzip}.asc COMMAND ${CMAKE_COMMAND} -E remove ${appzip}.asc
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/interactive-pause.cmake
COMMAND ${GPG_PROGRAM} --detach-sign -a ${appzip} COMMAND ${GPG_PROGRAM} --detach-sign -a ${appzip}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
) )

View File

@ -0,0 +1,16 @@
# Do not pause in automated jobs.
if(DEFINED ENV{CI} OR DEFINED ENV{VBAM_NO_PAUSE})
return()
endif()
# I have no idea how to do this reliably on Windows yet.
if(NOT WIN32 OR DEFINED ENV{MSYSTEM_PREFIX})
execute_process(
COMMAND sh -c [=[
echo >&2 "********** PRESS ENTER TO CONTINUE **********"
read -r dummy
]=]
)
endif()

View File

@ -11,6 +11,6 @@ foreach(catalog ${catalogs})
endforeach() endforeach()
execute_process( execute_process(
COMMAND ${ZIP_PROGRAM} -9r ../translations.zip * COMMAND ${ZIP_PROGRAM} -9r ../translations.zip .
WORKING_DIRECTORY translations WORKING_DIRECTORY translations
) )

View File

@ -27,6 +27,14 @@ case "$1" in
;; ;;
esac esac
# Need to use Xcode 9 for 32 bit builds on Mojave and newer.
# Place it in /Applications/Xcode9.app .
if [ "$target_bits" -eq 32 ] && [ -d /Applications/Xcode9.app ]; then
PREV_XCODE=$(xcode-select -p)
printf "\nSetting Xcode9 as the default Xcode for 32 bit build...\n\n"
sudo xcode-select -s /Applications/Xcode9.app/Contents/Developer
fi
export BUILD_ROOT="$HOME/vbam-build-mac-${target_bits}bit" export BUILD_ROOT="$HOME/vbam-build-mac-${target_bits}bit"
BUILD_ENV=$(cat <<EOF BUILD_ENV=$(cat <<EOF
@ -117,3 +125,8 @@ table_line_append DIST_ARGS libmodplug "CC=clang++ CXX=clang++"
table_line_append DIST_CONFIGURE_OVERRIDES ffmpeg "--disable-videotoolbox --extra-ldflags='-framework CoreText'" table_line_append DIST_CONFIGURE_OVERRIDES ffmpeg "--disable-videotoolbox --extra-ldflags='-framework CoreText'"
builder "$@" builder "$@"
if [ -n "$PREV_XCODE" ]; then
printf "\nRe-setting '$PREV_XCODE' as the default Xcode...\n\n"
sudo xcode-select -s "$PREV_XCODE"
fi