Commit a92ea867 authored by Ghislain MARY's avatar Ghislain MARY

Do not build RPM package with CPack.

parent 08060c38
......@@ -20,14 +20,12 @@
#
############################################################################
include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/BcToolboxCMakeUtils.cmake)
if(NOT CPACK_PACKAGE_NAME)
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
endif()
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Toolbox package used by Belledonne Communications projects")
set(CPACK_PACKAGE_VENDOR "Belledonne Communications")
set(CPACK_PACKAGE_CONTACT "jehan.monnier@linphone.org")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../COPYING")
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
......@@ -36,55 +34,21 @@ set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${PROJECT_VERSION})
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}")
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_IGNORE_FILES
"^${CMAKE_BINARY_DIR}"
"^${PROJECT_SOURCE_DIR}/\\\\.git.*"
"^${CMAKE_BINARY_DIR}"
"^${PROJECT_SOURCE_DIR}/.git.*"
)
#set(CPACK_COMPONENTS_ALL runtime devel)
#set(CPACK_COMPONENT_DEVEL_DEPENDS runtime)
#set(CPACK_COMPONENT_RUNTIME_DISPLAY_NAME ${PACKAGE})
#set(CPACK_COMPONENT_DEVEL_DISPLAY_NAME ${PACKAGE}-devel)
find_package(Git 1.7.10) # --count option of git rev-list is available only since (more or less) git 1.7.10
if(GIT_EXECUTABLE)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-list --count ${PROJECT_VERSION}..HEAD
OUTPUT_VARIABLE PROJECT_VERSION_BUILD
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
# if BUILD VERSION is available, append it to package filename
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${PROJECT_VERSION_BUILD}")
set(CPACK_RPM_PACKAGE_RELEASE "${PROJECT_VERSION_BUILD}")
set(CPACK_DEBIAN_PACKAGE_VERSION "${PROJECT_VERSION}-${PROJECT_VERSION_BUILD}")
bc_project_build_version(${PROJECT_VERSION} PROJECT_VERSION_BUILD)
if(PROJECT_VERSION_BUILD)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${PROJECT_VERSION_BUILD}")
endif()
set(CPACK_RPM_COMPONENT_INSTALL OFF)
if("${CPACK_GENERATOR}" STREQUAL "RPM")
set (CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig ${CMAKE_INSTALL_FULL_LIBDIR}/cmake)
endif()
message("-- Package file name is ${CPACK_PACKAGE_FILE_NAME}" )
if("${CPACK_GENERATOR}" STREQUAL "RPM" OR "${CPACK_GENERATOR}" STREQUAL "DEB")
if (NOT CPACK_PACKAGING_INSTALL_PREFIX AND CMAKE_INSTALL_PREFIX)
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
message(STATUS "Setting packaging install prefix to ${CPACK_PACKAGING_INSTALL_PREFIX}")
endif()
endif()
if("${CPACK_GENERATOR}" STREQUAL "DEB")
set(CPACK_DEBIAN_PACKAGE_DEBUG ON)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_BINARY_DIR}/CPackEnv.cmake")
file(WRITE "${CPACK_PROJECT_CONFIG_FILE}" "set(ENV{LD_LIBRARY_PATH} \"./${CMAKE_INSTALL_FULL_LIBDIR}\")")
set(SHLIBS_FILE "${CMAKE_CURRENT_BINARY_DIR}/shlibs")
file(WRITE "${SHLIBS_FILE}" "libbctoolbox ${BCTOOLBOX_SO_VERSION} ${CPACK_PACKAGE_NAME}\n")
file(APPEND "${SHLIBS_FILE}" "libbctoolbox-tester ${BCTOOLBOXTESTER_SO_VERSION} ${CPACK_PACKAGE_NAME}\n")
execute_process(COMMAND chmod 644 "${SHLIBS_FILE}")
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${SHLIBS_FILE})
endif()
set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/rpm/bctoolbox.spec.cmake ${CMAKE_CURRENT_SOURCE_DIR}/../bctoolbox.spec)
include(CPack)
# -*- rpm-spec -*-
## rpmbuild options
# These 2 lines are here because we can build the RPM for flexisip, in which
# case we prefix the entire installation so that we don't break compatibility
# with the user's libs.
# To compile with bc prefix, use rpmbuild -ba --with bc [SPEC]
%define pkg_name %{?_with_bc:bc-bctoolbox}%{!?_with_bc:bctoolbox}
%{?_with_bc: %define _prefix /opt/belledonne-communications}
%define tests_component %{?_without_tests_component:0}%{?!_without_tests_component:1}
%define pkg_prefix %{?_with_bc:bc-}%{!?_with_bc:}
# 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
%define _datarootdir %{_prefix}/share
%define _datadir %{_datarootdir}
%define _docdir %{_datadir}/doc
%define build_number @PROJECT_VERSION_BUILD@
%if %{build_number}
%define build_number_ext -%{build_number}
%endif
Name: %{pkg_name}
Version: @PROJECT_VERSION@
Release: %{build_number}%{?dist}
Summary: Belr is language recognition library for ABNF based protocols.
Group: Applications/Communications
License: GPL
URL: http://www.linphone.org
Source0: %{name}-%{version}%{?build_number_ext}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Requires: %{pkg_prefix}bctoolbox
%description
Toolbox package used by Belledonne Communications projects
%package devel
Summary: Development libraries for bctoolbox
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
%description devel
Libraries and headers required to develop software with bctoolbox
%if 0%{?rhel} && 0%{?rhel} <= 7
%global cmake_name cmake3
%define ctest_name ctest3
%else
%global cmake_name cmake
%define ctest_name ctest
%endif
%prep
%setup -n %{name}-%{version}%{?build_number_ext}
%build
%{expand:%%%cmake_name} . -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} -DCMAKE_PREFIX_PATH:PATH=%{_prefix} -DENABLE_TESTS=NO -DENABLE_TESTS_COMPONENT=${tests_component}
make %{?_smp_mflags}
%install
make install DESTDIR=%{buildroot}
%check
%{ctest_name} -V %{?_smp_mflags}
%clean
rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING NEWS README.md
%{_libdir}/*.so.*
%files devel
%defattr(-,root,root)
%{_includedir}/bctoolbox
%{_libdir}/libbctoolbox.a
%{_libdir}/libbctoolbox.so
%{_libdir}/pkgconfig/bctoolbox.pc
%{_datadir}/bctoolbox/cmake/BcGitVersion.cmake
%{_datadir}/bctoolbox/cmake/BcToolboxCMakeUtils.cmake
%{_datadir}/bctoolbox/cmake/BcToolboxConfig.cmake
%{_datadir}/bctoolbox/cmake/BcToolboxConfigVersion.cmake
%{_datadir}/bctoolbox/cmake/BcToolboxTargets-noconfig.cmake
%{_datadir}/bctoolbox/cmake/BcToolboxTargets.cmake
%{_datadir}/bctoolbox/cmake/gitversion.h.in
%if %{tests_component}
%{_libdir}/libbctoolbox-tester.a
%{_libdir}/libbctoolbox-tester.so
%{_libdir}/pkgconfig/bctoolbox-tester.pc
%endif
%changelog
* Tue Jan 16 2018 Ghislain MARY <ghislain.mary@belledonne-communications.com>
- Initial RPM release.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment