diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index 9cda4d2..46f4bb7 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -22,29 +22,11 @@ if(NOT CPACK_PACKAGE_NAME) set(CPACK_PACKAGE_NAME "${PROJECT_NAME}") -ENDIF() - -set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE.txt") - -set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) -set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) -set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) - -set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${PROJECT_VERSION}) +endif() -set(CPACK_SOURCE_GENERATOR "TGZ") set(CPACK_SOURCE_IGNORE_FILES "${CMAKE_BINARY_DIR}" "^${PROJECT_SOURCE_DIR}/.git*" ) -message("-- Package file name is ${CPACK_PACKAGE_FILE_NAME}" ) - -set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}) - -if(UNIX AND NOT APPLE AND NOT ANDROID) - configure_file("rpm/bcg729.spec.cmake" "${PROJECT_SOURCE_DIR}/bcg729.spec" @ONLY) -endif() - -include(CPack) - +bc_make_package_source_target() diff --git a/build/rpm/bcg729.spec.cmake b/build/rpm/bcg729.spec.cmake index 0f3e86e..9a32472 100755 --- a/build/rpm/bcg729.spec.cmake +++ b/build/rpm/bcg729.spec.cmake @@ -2,6 +2,7 @@ %define _prefix @CMAKE_INSTALL_PREFIX@ %define pkg_prefix @BC_PACKAGE_NAME_PREFIX@ +%define package_name @CPACK_PACKAGE_NAME@-${FULL_VERSION} # re-define some directories for older RPMBuild versions which don't. This messes up the doc/ dir # taken from https://fedoraproject.org/wiki/Packaging:RPMMacros?rd=Packaging/RPMMacros @@ -9,19 +10,16 @@ %define _datadir %{_datarootdir} %define _docdir %{_datadir}/doc -%define build_number 1 - - Name: @CPACK_PACKAGE_NAME@ -Version: @PROJECT_VERSION@ -Release: %{build_number}%{?dist} +Version: ${RPM_VERSION} +Release: ${RPM_RELEASE}%{?dist} Summary: Bcg729 is an opensource implementation of both encoder and decoder of the ITU G729 Annex A/B speech codec. Group: Applications/Communications License: GPL URL: http://www.linphone.org -Source0: %{name}-%{version}.tar.gz +Source0: %{package_name}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Requires: %{pkg_prefix}bctoolbox @@ -57,7 +55,7 @@ Libraries and headers required to develop software with bcg729 %custom_debug_package %prep -%setup -n %{name}-%{version} +%setup -n %{package_name} %build %{expand:%%%cmake_name} . -DCMAKE_BUILD_TYPE=@CMAKE_BUILD_TYPE@ -DCMAKE_PREFIX_PATH:PATH=%{_prefix}