Shuffle around and improve build number injection
This commit is contained in:
61
.ci/build.sh
61
.ci/build.sh
@@ -66,7 +66,6 @@ build() {
|
|||||||
# Set argument and environment variables.
|
# Set argument and environment variables.
|
||||||
local job_name=$JOB_BASE_NAME
|
local job_name=$JOB_BASE_NAME
|
||||||
local build_type=$BUILD_TYPE
|
local build_type=$BUILD_TYPE
|
||||||
local build_number=$BUILD_NUMBER
|
|
||||||
local git_hash=$(echo $GIT_COMMIT | cut -c1-8)
|
local git_hash=$(echo $GIT_COMMIT | cut -c1-8)
|
||||||
local arch=$1
|
local arch=$1
|
||||||
shift
|
shift
|
||||||
@@ -76,29 +75,11 @@ build() {
|
|||||||
# Check if at least the job name was received.
|
# Check if at least the job name was received.
|
||||||
if [ -z "$job_name" ]
|
if [ -z "$job_name" ]
|
||||||
then
|
then
|
||||||
echo [!] Missing environment variables: received JOB_BASE_NAME=[$job_name] BUILD_NUMBER=[$build_number] GIT_COMMIT=[$git_hash]
|
echo [!] Missing environment variables: received JOB_BASE_NAME=[$JOB_BASE_NAME] BUILD_TYPE=[$BUILD_TYPE] BUILD_NUMBER=[$BUILD_NUMBER] GIT_COMMIT=[$GIT_COMMIT]
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Generate the build qualifier and filename.
|
echo [-] Building [$job_name] [$build_type] [$build_qualifier] [$git_hash] for [$arch] with flags [$cmake_flags]
|
||||||
if echo $build_number | grep -q " "
|
|
||||||
then
|
|
||||||
# Full build qualifier.
|
|
||||||
build_qualifier="$build_number"
|
|
||||||
build_fn="-"$(echo "$build_number" | rev | cut -f1 -d" " | rev | tr '\\/:*?"<>|' '_')
|
|
||||||
elif [ ! -z "$build_number" ]
|
|
||||||
then
|
|
||||||
# Build number.
|
|
||||||
build_number=$(echo "$build_number" | sed "s/[^0-9]//g") # remove non-numeric characters
|
|
||||||
build_qualifier="build $build_number"
|
|
||||||
build_fn="-b$build_number"
|
|
||||||
else
|
|
||||||
# No build information.
|
|
||||||
build_qualifier=
|
|
||||||
build_fn=
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo [-] Building [$job_name] [$build_number] [$git_hash] for [$arch] with flags [$cmake_flags]
|
|
||||||
|
|
||||||
# Switch to the correct directory.
|
# Switch to the correct directory.
|
||||||
cd "$cwd"
|
cd "$cwd"
|
||||||
@@ -117,8 +98,8 @@ build() {
|
|||||||
# Call build with the correct MSYSTEM.
|
# Call build with the correct MSYSTEM.
|
||||||
echo [-] Switching to MSYSTEM [$msys]
|
echo [-] Switching to MSYSTEM [$msys]
|
||||||
cd "$cwd"
|
cd "$cwd"
|
||||||
CHERE_INVOKING=yes MSYSTEM=$msys JOB_BASE_NAME=$JOB_BASE_NAME BUILD_TYPE=$BUILD_TYPE BUILD_NUMBER=$BUILD_NUMBER GIT_COMMIT=$GIT_COMMIT \
|
CHERE_INVOKING=yes MSYSTEM="$msys" JOB_BASE_NAME="$JOB_BASE_NAME" BUILD_TYPE="$BUILD_TYPE" BUILD_NUMBER="$BUILD_NUMBER" GIT_COMMIT="$GIT_COMMIT" \
|
||||||
bash -lc 'exec "'$0'" -b "'$arch'" '$cmake_flags && job_exit=0 # make sure the main script exits cleanly on any success
|
bash -lc 'exec "'$0'" -b "'$arch'" '$cmake_flags && job_status=0 # make sure the main script exits cleanly on any success
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@@ -215,7 +196,9 @@ EOF
|
|||||||
# Determine additional CMake flags.
|
# Determine additional CMake flags.
|
||||||
[ ! -z "$build_type" ] && local cmake_flags_extra="$cmake_flags_extra -D BUILD_TYPE=\"$build_type\""
|
[ ! -z "$build_type" ] && local cmake_flags_extra="$cmake_flags_extra -D BUILD_TYPE=\"$build_type\""
|
||||||
[ ! -z "$build_qualifier" ] && local cmake_flags_extra="$cmake_flags_extra -D EMU_BUILD=\"$build_qualifier\""
|
[ ! -z "$build_qualifier" ] && local cmake_flags_extra="$cmake_flags_extra -D EMU_BUILD=\"$build_qualifier\""
|
||||||
|
[ ! -z "$build_number" ] && local cmake_flags_extra="$cmake_flags_extra -D EMU_BUILD_NUM=\"$build_number\""
|
||||||
[ ! -z "$git_hash" ] && local cmake_flags_extra="$cmake_flags_extra -D EMU_GIT_HASH=\"$git_hash\""
|
[ ! -z "$git_hash" ] && local cmake_flags_extra="$cmake_flags_extra -D EMU_GIT_HASH=\"$git_hash\""
|
||||||
|
local cmake_flags_extra="$cmake_flags_extra -D EMU_COPYRIGHT_YEAR=\"$(date +%Y)\""
|
||||||
|
|
||||||
# Run CMake.
|
# Run CMake.
|
||||||
echo [-] Running CMake with flags [$cmake_flags $cmake_flags_extra]
|
echo [-] Running CMake with flags [$cmake_flags $cmake_flags_extra]
|
||||||
@@ -338,15 +321,15 @@ EOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# All good.
|
# All good.
|
||||||
echo [-] Build of [$job_name] [$build_number] [$git_hash] for [$arch] with flags [$cmake_flags] successful
|
echo [-] Build of [$job_name] [$build_type] [$build_qualifier] [$git_hash] for [$arch] with flags [$cmake_flags] successful
|
||||||
job_exit=0
|
job_status=0
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set common variables.
|
# Set common variables.
|
||||||
project=86Box
|
project=86Box
|
||||||
cwd=$(pwd)
|
cwd=$(pwd)
|
||||||
first_build=1
|
first_build=1
|
||||||
job_exit=1
|
job_status=1
|
||||||
|
|
||||||
# Parse arguments.
|
# Parse arguments.
|
||||||
single_build=0
|
single_build=0
|
||||||
@@ -393,6 +376,27 @@ then
|
|||||||
exit 100
|
exit 100
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Generate build information. Note that variable names are case sensitive.
|
||||||
|
build_number=$BUILD_NUMBER
|
||||||
|
if echo $build_number | grep -q " "
|
||||||
|
then
|
||||||
|
# A full build qualifier was specified.
|
||||||
|
build_qualifier="$build_number"
|
||||||
|
build_fn="-"$(echo "$build_number" | rev | cut -f1 -d" " | rev | tr '\\/:*?"<>|' '_')
|
||||||
|
build_number= # no build number
|
||||||
|
elif [ ! -z "$build_number" ]
|
||||||
|
then
|
||||||
|
# A build number was specified.
|
||||||
|
build_qualifier="build $build_number"
|
||||||
|
build_fn="-b$build_number"
|
||||||
|
build_number=$(echo "$build_number" | sed "s/[^0-9]//g") # remove non-numeric characters from build number
|
||||||
|
else
|
||||||
|
# No build data was specified.
|
||||||
|
build_number=
|
||||||
|
build_qualifier=
|
||||||
|
build_fn=
|
||||||
|
fi
|
||||||
|
|
||||||
# Run single build if requested.
|
# Run single build if requested.
|
||||||
if [ $single_build -ne 0 ]
|
if [ $single_build -ne 0 ]
|
||||||
then
|
then
|
||||||
@@ -406,6 +410,7 @@ case $JOB_BASE_NAME in
|
|||||||
if is_windows
|
if is_windows
|
||||||
then
|
then
|
||||||
build 32 --preset=regular
|
build 32 --preset=regular
|
||||||
|
build 64 --preset=regular
|
||||||
elif is_mac
|
elif is_mac
|
||||||
then
|
then
|
||||||
build Universal --preset=regular
|
build Universal --preset=regular
|
||||||
@@ -456,5 +461,5 @@ case $JOB_BASE_NAME in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo [-] Exiting with code [$job_exit]
|
echo [-] Exiting with status [$job_status]
|
||||||
exit $job_exit
|
exit $job_status
|
||||||
|
@@ -93,6 +93,15 @@ find_package(PNG REQUIRED)
|
|||||||
include_directories(${PNG_INCLUDE_DIRS})
|
include_directories(${PNG_INCLUDE_DIRS})
|
||||||
target_link_libraries(86Box PNG::PNG)
|
target_link_libraries(86Box PNG::PNG)
|
||||||
|
|
||||||
|
if(NOT CMAKE_PROJECT_VERSION_PATCH)
|
||||||
|
set(CMAKE_PROJECT_VERSION_PATCH 0)
|
||||||
|
endif()
|
||||||
|
if(NOT EMU_BUILD_NUM)
|
||||||
|
set(EMU_BUILD_NUM 0)
|
||||||
|
endif()
|
||||||
|
if(NOT EMU_COPYRIGHT_YEAR)
|
||||||
|
set(EMU_COPYRIGHT_YEAR 2021)
|
||||||
|
endif()
|
||||||
configure_file(include/86box/version.h.in include/86box/version.h @ONLY)
|
configure_file(include/86box/version.h.in include/86box/version.h @ONLY)
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
|
||||||
|
|
||||||
|
@@ -22,11 +22,13 @@
|
|||||||
|
|
||||||
#define EMU_VERSION "@CMAKE_PROJECT_VERSION@"
|
#define EMU_VERSION "@CMAKE_PROJECT_VERSION@"
|
||||||
#define EMU_VERSION_W LSTR(EMU_VERSION)
|
#define EMU_VERSION_W LSTR(EMU_VERSION)
|
||||||
#define EMU_VERSION_EX "@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@0"
|
#define EMU_VERSION_EX "@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@@CMAKE_PROJECT_VERSION_PATCH@"
|
||||||
#define EMU_VERSION_MAJ @CMAKE_PROJECT_VERSION_MAJOR@
|
#define EMU_VERSION_MAJ @CMAKE_PROJECT_VERSION_MAJOR@
|
||||||
#define EMU_VERSION_MIN @CMAKE_PROJECT_VERSION_MINOR@
|
#define EMU_VERSION_MIN @CMAKE_PROJECT_VERSION_MINOR@
|
||||||
|
#define EMU_VERSION_PATCH @CMAKE_PROJECT_VERSION_PATCH@
|
||||||
|
|
||||||
#cmakedefine EMU_BUILD "@EMU_BUILD@"
|
#cmakedefine EMU_BUILD "@EMU_BUILD@"
|
||||||
|
#define EMU_BUILD_NUM @EMU_BUILD_NUM@
|
||||||
#cmakedefine EMU_GIT_HASH "@EMU_GIT_HASH@"
|
#cmakedefine EMU_GIT_HASH "@EMU_GIT_HASH@"
|
||||||
|
|
||||||
#ifdef EMU_BUILD
|
#ifdef EMU_BUILD
|
||||||
@@ -41,7 +43,7 @@
|
|||||||
# define EMU_GIT_HASH_W LSTR(EMU_GIT_HASH)
|
# define EMU_GIT_HASH_W LSTR(EMU_GIT_HASH)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define COPYRIGHT_YEAR "2021"
|
#define COPYRIGHT_YEAR "@EMU_COPYRIGHT_YEAR@"
|
||||||
|
|
||||||
/* Web URL info. */
|
/* Web URL info. */
|
||||||
#define EMU_SITE L"86box.net"
|
#define EMU_SITE L"86box.net"
|
||||||
|
@@ -25,6 +25,9 @@
|
|||||||
#define EMU_VERSION_EX "3.00"
|
#define EMU_VERSION_EX "3.00"
|
||||||
#define EMU_VERSION_MAJ 3
|
#define EMU_VERSION_MAJ 3
|
||||||
#define EMU_VERSION_MIN 0
|
#define EMU_VERSION_MIN 0
|
||||||
|
#define EMU_VERSION_PATCH 0
|
||||||
|
|
||||||
|
#define EMU_BUILD_NUM 0
|
||||||
|
|
||||||
#define EMU_VERSION_FULL EMU_VERSION
|
#define EMU_VERSION_FULL EMU_VERSION
|
||||||
#define EMU_VERSION_FULL_W EMU_VERSION_W
|
#define EMU_VERSION_FULL_W EMU_VERSION_W
|
||||||
|
@@ -1283,8 +1283,8 @@ END
|
|||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION EMU_VERSION_MAJ,EMU_VERSION_MIN,0,0
|
FILEVERSION EMU_VERSION_MAJ,EMU_VERSION_MIN,EMU_VERSION_PATCH,EMU_BUILD_NUM
|
||||||
PRODUCTVERSION EMU_VERSION_MAJ,EMU_VERSION_MIN,0,0
|
PRODUCTVERSION EMU_VERSION_MAJ,EMU_VERSION_MIN,EMU_VERSION_PATCH,EMU_BUILD_NUM
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
@@ -1303,7 +1303,7 @@ BEGIN
|
|||||||
VALUE "FileDescription", EMU_NAME "\0"
|
VALUE "FileDescription", EMU_NAME "\0"
|
||||||
VALUE "FileVersion", EMU_VERSION "\0"
|
VALUE "FileVersion", EMU_VERSION "\0"
|
||||||
VALUE "InternalName", EMU_NAME "\0"
|
VALUE "InternalName", EMU_NAME "\0"
|
||||||
VALUE "LegalCopyright", "Copyright \xc2\xa9 2007-2020 " EMU_NAME " contributors\0"
|
VALUE "LegalCopyright", "Copyright \xc2\xa9 2007-" COPYRIGHT_YEAR " " EMU_NAME " contributors\0"
|
||||||
VALUE "OriginalFilename", "86box.exe\0"
|
VALUE "OriginalFilename", "86box.exe\0"
|
||||||
VALUE "ProductName", EMU_NAME "\0"
|
VALUE "ProductName", EMU_NAME "\0"
|
||||||
VALUE "ProductVersion", EMU_VERSION "\0"
|
VALUE "ProductVersion", EMU_VERSION "\0"
|
||||||
|
Reference in New Issue
Block a user