From 7039d04ee6ea4b24b69d7153a84da633923d1a1a Mon Sep 17 00:00:00 2001 From: David Sansome Date: Mon, 3 May 2010 13:58:41 +0000 Subject: [PATCH] Keep all the version numbers in one file, so we don't have to change it in hundreds of places each release. --- CMakeLists.txt | 4 +-- Version.cmake | 18 +++++++++++++ dist/CMakeLists.txt | 9 +++++++ dist/{Info.plist => Info.plist.in} | 6 ++--- dist/{clementine.spec => clementine.spec.in} | 2 +- dist/{maketarball.sh => maketarball.sh.in} | 2 +- .../{clementine.nsi => clementine.nsi.in} | 9 ++++--- dist/windows/{windres.rc => windres.rc.in} | 8 +++--- src/CMakeLists.txt | 8 +++++- src/config.h.in | 26 +++++++++++++++++++ src/main.cpp | 3 ++- 11 files changed, 78 insertions(+), 17 deletions(-) create mode 100644 Version.cmake create mode 100644 dist/CMakeLists.txt rename dist/{Info.plist => Info.plist.in} (86%) rename dist/{clementine.spec => clementine.spec.in} (97%) rename dist/{maketarball.sh => maketarball.sh.in} (85%) rename dist/windows/{clementine.nsi => clementine.nsi.in} (96%) rename dist/windows/{windres.rc => windres.rc.in} (59%) create mode 100644 src/config.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt index adf5ec8f6..1306a360d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 2.6) include(FindPkgConfig) +include(Version.cmake) if (CMAKE_FIND_ROOT_PATH) # Help find the Qt headers if we're cross compiling (since we can't run qmake.exe) @@ -109,10 +110,9 @@ add_subdirectory(src) if (NOT APPLE) add_subdirectory(3rdparty/qxt) endif (NOT APPLE) - add_subdirectory(3rdparty/universalchardet) - add_subdirectory(tests) +add_subdirectory(dist) if (WIN32 OR APPLE) message(STATUS "Building static qsqlite plugin") diff --git a/Version.cmake b/Version.cmake new file mode 100644 index 000000000..724364fd1 --- /dev/null +++ b/Version.cmake @@ -0,0 +1,18 @@ +# Change this file when releasing a new version. +# You'll also need to add a new changelog entry in: +# debian/changelog +# dist/clementine.spec + +# Version numbers. For m.n rc, use m.(n-1).99 +set(CLEMENTINE_VERSION_MAJOR 0) +set(CLEMENTINE_VERSION_MINOR 2) +set(CLEMENTINE_VERSION_PATCH 99) +set(CLEMENTINE_VERSION_STRING "0.3 rc3") # Displayed in GUIs +set(CLEMENTINE_VERSION_SHORT_STRING "0.3-rc3") # Used in filenames + + +if (CLEMENTINE_VERSION_PATCH) + set(CLEMENTINE_VERSION ${CLEMENTINE_VERSION_MAJOR}.${CLEMENTINE_VERSION_MINOR}.${CLEMENTINE_VERSION_PATCH}) +else (CLEMENTINE_VERSION_PATCH) + set(CLEMENTINE_VERSION ${CLEMENTINE_VERSION_MAJOR}.${CLEMENTINE_VERSION_MINOR}) +endif (CLEMENTINE_VERSION_PATCH) diff --git a/dist/CMakeLists.txt b/dist/CMakeLists.txt new file mode 100644 index 000000000..4e7749e56 --- /dev/null +++ b/dist/CMakeLists.txt @@ -0,0 +1,9 @@ +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/clementine.spec.in + ${CMAKE_CURRENT_SOURCE_DIR}/clementine.spec) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in + ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/maketarball.sh.in + ${CMAKE_CURRENT_SOURCE_DIR}/maketarball.sh @ONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/windows/clementine.nsi.in + ${CMAKE_CURRENT_SOURCE_DIR}/windows/clementine.nsi @ONLY) +# windows/windres.rc is done by src/CMakeLists.txt diff --git a/dist/Info.plist b/dist/Info.plist.in similarity index 86% rename from dist/Info.plist rename to dist/Info.plist.in index e2d4a77b5..445b4293b 100644 --- a/dist/Info.plist +++ b/dist/Info.plist.in @@ -7,7 +7,7 @@ CFBundleExecutable clementine CFBundleGetInfoString - Clementine 0.3 beta 3 + Clementine ${CLEMENTINE_VERSION_STRING} CFBundleIconFile clementine CFBundleIdentifier @@ -15,13 +15,13 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleLongVersionString - 0.3 beta 3 + ${CLEMENTINE_VERSION_STRING} CFBundleName Clementine CFBundlePackageType APPL CFBundleShortVersionString - 0.3_beta3 + ${CLEMENTINE_VERSION_SHORTSTRING} CFBundleVersion 123 CSResourcesFileMapped diff --git a/dist/clementine.spec b/dist/clementine.spec.in similarity index 97% rename from dist/clementine.spec rename to dist/clementine.spec.in index 14cb8938d..9f14584c8 100644 --- a/dist/clementine.spec +++ b/dist/clementine.spec.in @@ -1,5 +1,5 @@ Name: clementine -Version: 0.2.99 +Version: ${CLEMENTINE_VERSION} Release: 1%{?dist} Summary: A music player and library organiser diff --git a/dist/maketarball.sh b/dist/maketarball.sh.in similarity index 85% rename from dist/maketarball.sh rename to dist/maketarball.sh.in index a1c03d338..a2b5c96ec 100755 --- a/dist/maketarball.sh +++ b/dist/maketarball.sh.in @@ -2,7 +2,7 @@ name=clementine url=`svn info | grep URL | head -n1 | awk '{print $2}' | sed 's/\/dist//'` -version=`grep Version $name.spec | head -n1 | awk '{print $2}'` +version="@CLEMENTINE_VERSION@" echo "Checking out $url into $name-$version..." diff --git a/dist/windows/clementine.nsi b/dist/windows/clementine.nsi.in similarity index 96% rename from dist/windows/clementine.nsi rename to dist/windows/clementine.nsi.in index 4b61ade92..ec18338a0 100644 --- a/dist/windows/clementine.nsi +++ b/dist/windows/clementine.nsi.in @@ -1,8 +1,9 @@ !define PRODUCT_NAME "Clementine" !define PRODUCT_PUBLISHER "Clementine" -!define PRODUCT_VERSION_MAJOR 0 -!define PRODUCT_VERSION_MINOR 3 -!define PRODUCT_DISPLAY_VERSION "0.3-rc3" +!define PRODUCT_VERSION_MAJOR @CLEMENTINE_VERSION_MAJOR@ +!define PRODUCT_VERSION_MINOR @CLEMENTINE_VERSION_MINOR@ +!define PRODUCT_DISPLAY_VERSION "@CLEMENTINE_VERSION_STRING@" +!define PRODUCT_DISPLAY_VERSION_SHORT "@CLEMENTINE_VERSION_SHORT_STRING@" !define PRODUCT_WEB_SITE "http://code.google.com/p/clementine-player/" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" @@ -30,7 +31,7 @@ SetCompressor /SOLID lzma !insertmacro MUI_LANGUAGE "English" Name "${PRODUCT_NAME}" -OutFile "${PRODUCT_NAME}Setup-${PRODUCT_DISPLAY_VERSION}.exe" +OutFile "${PRODUCT_NAME}Setup-${PRODUCT_DISPLAY_VERSION_SHORT}.exe" InstallDir "${PRODUCT_INSTALL_DIR}" ShowInstDetails show ShowUnInstDetails show diff --git a/dist/windows/windres.rc b/dist/windows/windres.rc.in similarity index 59% rename from dist/windows/windres.rc rename to dist/windows/windres.rc.in index 80b0470eb..525934ee0 100644 --- a/dist/windows/windres.rc +++ b/dist/windows/windres.rc.in @@ -1,7 +1,7 @@ clementine ICON "clementine.ico" 1 VERSIONINFO -FILEVERSION 0,2,0,0 -PRODUCTVERSION 0,2,0,0 +FILEVERSION ${CLEMENTINE_VERSION_MAJOR},${CLEMENTINE_VERSION_MINOR},${CLEMENTINE_VERSION_PATCH},0 +PRODUCTVERSION ${CLEMENTINE_VERSION_MAJOR},${CLEMENTINE_VERSION_MINOR},${CLEMENTINE_VERSION_PATCH},0 BEGIN BLOCK "StringFileInfo" BEGIN @@ -9,12 +9,12 @@ BEGIN BEGIN VALUE "CompanyName", "Clementine" VALUE "FileDescription", "Clementine music player" - VALUE "FileVersion", "0.2" + VALUE "FileVersion", "${CLEMENTINE_VERSION_STRING}" VALUE "InternalName", "clementine" VALUE "LegalCopyright", "David Sansome" VALUE "OriginalFilename", "clementine.exe" VALUE "ProductName", "Clementine" - VALUE "ProductVersion", "0.2" + VALUE "ProductVersion", "${CLEMENTINE_VERSION_STRING}" END END diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 23be9b374..cb6348125 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -228,6 +228,10 @@ set(CLEMENTINE-LANGUAGES tr ) +# Configured header file that contains various macros +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in + ${CMAKE_CURRENT_BINARY_DIR}/config.h) + # OSD and DBus. if(APPLE) set(CLEMENTINE-SOURCES ${CLEMENTINE-SOURCES} osd_mac.mm mac_startup.mm) @@ -264,7 +268,9 @@ endif(APPLE) # resource file for windows if(WIN32) - set(CLEMENTINE-WIN32-RESOURCES ../dist/windows/windres.rc) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../dist/windows/windres.rc.in + ${CMAKE_CURRENT_BINARY_DIR}/windres.rc) + set(CLEMENTINE-WIN32-RESOURCES windres.rc) endif(WIN32) qt4_wrap_cpp(CLEMENTINE-SOURCES-MOC ${CLEMENTINE-MOC-HEADERS}) diff --git a/src/config.h.in b/src/config.h.in new file mode 100644 index 000000000..2be2be084 --- /dev/null +++ b/src/config.h.in @@ -0,0 +1,26 @@ +/* This file is part of Clementine. + + Clementine 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. + + Clementine 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 + along with Clementine. If not, see . +*/ + +#ifndef CONFIG_H_IN +#define CONFIG_H_IN + +#define CLEMENTINE_VERSION_MAJOR ${CLEMENTINE_VERSION_MAJOR} +#define CLEMENTINE_VERSION_MINOR ${CLEMENTINE_VERSION_MINOR} +#define CLEMENTINE_VERSION_PATCH ${CLEMENTINE_VERSION_PATCH} +#define CLEMENTINE_VERSION_STRING "${CLEMENTINE_VERSION_STRING}" +#define CLEMENTINE_VERSION_SHORT_STRING "${CLEMENTINE_VERSION_SHORT_STRING}" + +#endif // CONFIG_H_IN diff --git a/src/main.cpp b/src/main.cpp index dec10fd23..9854a8c94 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -29,6 +29,7 @@ #include "potranslator.h" #include "commandlineoptions.h" #include "engines/enginebase.h" +#include "config.h" #include #include @@ -79,7 +80,7 @@ int main(int argc, char *argv[]) { #endif QCoreApplication::setApplicationName("Clementine"); - QCoreApplication::setApplicationVersion("0.3 rc1"); + QCoreApplication::setApplicationVersion(CLEMENTINE_VERSION_STRING); QCoreApplication::setOrganizationName("Clementine"); QCoreApplication::setOrganizationDomain("davidsansome.com");