2015-06-02 15:01:40 +02:00
|
|
|
#!/usr/bin/env bash
|
2018-09-02 10:27:39 +02:00
|
|
|
#
|
|
|
|
# generate_version
|
|
|
|
#
|
2019-10-15 19:32:44 +02:00
|
|
|
# Make a Version.h file to accompany CUSTOM_VERSION_FILE
|
2018-09-02 10:27:39 +02:00
|
|
|
#
|
2015-06-02 15:01:40 +02:00
|
|
|
|
2019-10-15 19:32:44 +02:00
|
|
|
DIR=${1:-"Marlin"}
|
2019-07-05 10:40:32 +02:00
|
|
|
|
|
|
|
# MRCC3=$( git merge-base HEAD upstream/bugfix-2.0.x 2>/dev/null )
|
|
|
|
# MRCC2=$( git merge-base HEAD upstream/bugfix-1.1.x 2>/dev/null )
|
|
|
|
# MRCC1=$( git merge-base HEAD upstream/1.1.x 2>/dev/null )
|
|
|
|
|
|
|
|
# BASE='?'
|
|
|
|
# if [[ -n $MRCC3 && $MRCC3 != $MRCC2 ]]; then
|
|
|
|
# BASE=bugfix-2.0.x
|
|
|
|
# elif [[ -n $MRCC2 ]]; then
|
|
|
|
# BASE=bugfix-1.1.x
|
|
|
|
# elif [[ -n $MRCC1 ]]; then
|
|
|
|
# BASE=1.1.x
|
|
|
|
# fi
|
2016-05-01 04:31:19 +02:00
|
|
|
|
|
|
|
BUILDATE=$(date '+%s')
|
|
|
|
DISTDATE=$(date '+%Y-%m-%d %H:%M')
|
|
|
|
|
|
|
|
BRANCH=$(git -C "${DIR}" symbolic-ref -q --short HEAD)
|
|
|
|
VERSION=$(git -C "${DIR}" describe --tags --first-parent 2>/dev/null)
|
|
|
|
|
2018-09-02 10:27:39 +02:00
|
|
|
[ -z "${BRANCH}" ] && BRANCH=$(echo "${TRAVIS_BRANCH}")
|
|
|
|
[ -z "${VERSION}" ] && VERSION=$(git -C "${DIR}" describe --tags --first-parent --always 2>/dev/null)
|
2016-05-01 04:31:19 +02:00
|
|
|
|
2016-05-20 03:30:03 +02:00
|
|
|
SHORT_BUILD_VERSION=$(echo "${BRANCH}")
|
|
|
|
DETAILED_BUILD_VERSION=$(echo "${BRANCH}-${VERSION}")
|
|
|
|
|
2016-05-01 04:31:19 +02:00
|
|
|
# Gets some misc options from their defaults
|
|
|
|
DEFAULT_MACHINE_UUID=$(awk -F'"' \
|
|
|
|
'/#define DEFAULT_MACHINE_UUID/{ print $2 }' < "${DIR}/Version.h")
|
|
|
|
MACHINE_NAME=$(awk -F'"' \
|
|
|
|
'/#define MACHINE_NAME/{ print $2 }' < "${DIR}/Version.h")
|
|
|
|
PROTOCOL_VERSION=$(awk -F'"' \
|
|
|
|
'/#define PROTOCOL_VERSION/{ print $2 }' < "${DIR}/Version.h")
|
|
|
|
SOURCE_CODE_URL=$(awk -F'"' \
|
|
|
|
'/#define SOURCE_CODE_URL/{ print $2 }' < "${DIR}/Version.h")
|
|
|
|
WEBSITE_URL=$(awk -F'"' \
|
|
|
|
'/#define WEBSITE_URL/{ print $2 }' < "${DIR}/Version.h")
|
2016-04-24 06:43:29 +02:00
|
|
|
|
2019-10-15 19:32:44 +02:00
|
|
|
cat > "${DIR}/Version.h" <<EOF
|
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
2020-02-03 15:00:57 +01:00
|
|
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
2019-10-15 19:32:44 +02:00
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
|
|
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2020-07-17 16:30:41 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2019-10-15 19:32:44 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2016-04-24 06:43:29 +02:00
|
|
|
/**
|
|
|
|
* THIS FILE IS AUTOMATICALLY GENERATED DO NOT MANUALLY EDIT IT.
|
|
|
|
* IT DOES NOT GET COMMITTED TO THE REPOSITORY.
|
2016-05-20 03:30:03 +02:00
|
|
|
*
|
|
|
|
* Branch: ${BRANCH}
|
|
|
|
* Version: ${VERSION}
|
2016-04-24 06:43:29 +02:00
|
|
|
*/
|
|
|
|
|
2019-10-15 19:32:44 +02:00
|
|
|
/**
|
|
|
|
* Marlin release version identifier
|
|
|
|
*/
|
|
|
|
#ifndef SHORT_BUILD_VERSION
|
|
|
|
#define SHORT_BUILD_VERSION "${SHORT_BUILD_VERSION}"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Verbose version identifier which should contain a reference to the location
|
|
|
|
* from where the binary was downloaded or the source code was compiled.
|
|
|
|
*/
|
|
|
|
#ifndef DETAILED_BUILD_VERSION
|
|
|
|
#define DETAILED_BUILD_VERSION "${DETAILED_BUILD_VERSION}"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The STRING_DISTRIBUTION_DATE represents when the binary file was built,
|
|
|
|
* here we define this default string as the date where the latest release
|
|
|
|
* version was tagged.
|
|
|
|
*/
|
|
|
|
#ifndef STRING_DISTRIBUTION_DATE
|
|
|
|
#define STRING_DISTRIBUTION_DATE "${DISTDATE}"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The protocol for communication to the host. Protocol indicates communication
|
|
|
|
* standards such as the use of ASCII, "echo:" and "error:" line prefixes, etc.
|
|
|
|
* (Other behaviors are given by the firmware version and capabilities report.)
|
|
|
|
*/
|
|
|
|
#ifndef PROTOCOL_VERSION
|
|
|
|
#define PROTOCOL_VERSION "${PROTOCOL_VERSION}"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines a generic printer name to be output to the LCD after booting Marlin.
|
|
|
|
*/
|
|
|
|
#ifndef MACHINE_NAME
|
|
|
|
#define MACHINE_NAME "${MACHINE_NAME}"
|
|
|
|
#endif
|
2016-04-22 17:07:26 +02:00
|
|
|
|
2019-10-15 19:32:44 +02:00
|
|
|
/**
|
|
|
|
* The SOURCE_CODE_URL is the location where users will find the Marlin Source
|
|
|
|
* Code which is installed on the device. In most cases —unless the manufacturer
|
|
|
|
* has a distinct Github fork— the Source Code URL should just be the main
|
|
|
|
* Marlin repository.
|
|
|
|
*/
|
|
|
|
#ifndef SOURCE_CODE_URL
|
|
|
|
#define SOURCE_CODE_URL "${SOURCE_CODE_URL}"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Default generic printer UUID.
|
|
|
|
*/
|
|
|
|
#ifndef DEFAULT_MACHINE_UUID
|
|
|
|
#define DEFAULT_MACHINE_UUID "${DEFAULT_MACHINE_UUID}"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The WEBSITE_URL is the location where users can get more information such as
|
|
|
|
* documentation about a specific Marlin release.
|
|
|
|
*/
|
|
|
|
#ifndef WEBSITE_URL
|
|
|
|
#define WEBSITE_URL "${WEBSITE_URL}"
|
|
|
|
#endif
|
2016-05-01 04:31:19 +02:00
|
|
|
|
|
|
|
EOF
|