diff --git a/.gitignore b/.gitignore index abc5146aa..1ad071e9d 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,6 @@ # Project configuration -------------------------------------------------------- *.pro.user -build* Project.sln.lnk WORK OUTPUT @@ -35,3 +34,4 @@ GTAGS # OTHER ------------------------------------------------------------------------ vgcore.* +linphone.spec diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ab13c3b1..801c63561 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -448,21 +448,10 @@ install(FILES "${ASSETS_ASSISTANT_DIR}/use-linphone-sip-account.rc" ) # ------------------------------------------------------------------------------ -# CPack settings. +# CPack settings & RPM. # ------------------------------------------------------------------------------ -set(CPACK_SOURCE_GENERATOR "TGZ") -set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}") -set(CPACK_SOURCE_IGNORE_FILES - "^${CMAKE_BINARY_DIR}" - "/\\\\..+" - "OUTPUT" - "WORK" - "cmake_builder" - "submodules" -) - -include(CPack) +add_subdirectory(build) # ------------------------------------------------------------------------------ # To start better integration into IDE. diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt new file mode 100644 index 000000000..87a1bd4ee --- /dev/null +++ b/build/CMakeLists.txt @@ -0,0 +1,57 @@ +############################################################################ +# CMakeLists.txt +# Copyright (C) 2018 Belledonne Communications, Grenoble France +# +############################################################################ +# +# 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 2 +# 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 +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +############################################################################ + +if (NOT CPACK_PACKAGE_NAME) + set(CPACK_PACKAGE_NAME "linphone") +endif () + +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE") + +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}) + +set(CPACK_SOURCE_GENERATOR "TGZ") +set(CPACK_SOURCE_IGNORE_FILES + "^${PROJECT_SOURCE_DIR}/.git*" + "^${CMAKE_BINARY_DIR}" + "/\\\\..+" + "OUTPUT" + "WORK" + "cmake_builder" + "submodules" +) + +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 () + +message("-- Package file name is ${CPACK_PACKAGE_FILE_NAME}") + +set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}) + +bc_generate_rpm_specfile("rpm/linphone.spec.cmake" "${PROJECT_SOURCE_DIR}/linphone.spec") + +include(CPack) diff --git a/build/rpm/linphone.spec.cmake b/build/rpm/linphone.spec.cmake new file mode 100644 index 000000000..196a453ef --- /dev/null +++ b/build/rpm/linphone.spec.cmake @@ -0,0 +1,70 @@ +# -*- rpm-spec -*- + +%define _prefix @CMAKE_INSTALL_PREFIX@ +%define pkg_prefix @BC_PACKAGE_NAME_PREFIX@ + +%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: @CPACK_PACKAGE_NAME@ +Version: @PROJECT_VERSION@ +Release: %{build_number}%{?dist} +Summary: A free (libre) SIP video-phone. + +Group: Communications/Telephony +License: GPL +URL: https://www.linphone.org +Source0: %{name}-%{version}%{?build_number_ext}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot + +Requires: %{pkg_prefix}bctoolbox +Requires: %{pkg_prefix}belcard +Requires: %{pkg_prefix}liblinphone +Requires: %{pkg_prefix}mediastreamer +Requires: %{pkg_prefix}minizip + +%description +A free (libre) SIP video-phone. + +%if 0%{?rhel} && 0%{?rhel} <= 7 +%global cmake_name cmake3 +%define ctest_name ctest3 +%else +%global cmake_name cmake +%define ctest_name ctest +%endif + +%define custom_debug_package %{!?_enable_debug_packages:%debug_package}%{?_enable_debug_package:%{nil}} +%custom_debug_package + +%prep +%setup -n %{name}-%{version}%{?build_number_ext} + +%build +%{expand:%%%cmake_name} . -DCMAKE_BUILD_TYPE=@CMAKE_BUILD_TYPE@ -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} -DCMAKE_PREFIX_PATH:PATH=%{_prefix} @RPM_ALL_CMAKE_OPTIONS@ +make %{?_smp_mflags} + +%install +make install DESTDIR=%{buildroot} + +%clean +rm -rf $RPM_BUILD_ROOT + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root,-) +%doc LICENSE CHANGELOG.md README.md +%{_bindir}/ +%{_datadir}/ + +%changelog +* Thu Mar 15 2018 ronan.abhamon +- Initial RPM release.