diff --git a/.gitignore b/.gitignore index 594850b6d..69b985389 100644 --- a/.gitignore +++ b/.gitignore @@ -106,3 +106,4 @@ tools/lp-test-ecc tools/lp-sendmsg *.pyc +liblinphone.spec diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index 1f1b88af7..ac389909d 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -1,6 +1,6 @@ ############################################################################ # CMakeLists.txt -# Copyright (C) 2017 Belledonne Communications, Grenoble France +# Copyright (C) 2017-2018 Belledonne Communications, Grenoble France # ############################################################################ # @@ -20,7 +20,7 @@ # ############################################################################ -if (NOT CPACK_PACKAGE_NAME) +if(NOT CPACK_PACKAGE_NAME) set(CPACK_PACKAGE_NAME "liblinphone") ENDIF() @@ -40,13 +40,14 @@ set(CPACK_SOURCE_IGNORE_FILES 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}") + 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}) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/rpm/liblinphone.spec.in ${CMAKE_CURRENT_SOURCE_DIR}/../liblinphone.spec) + +bc_generate_rpm_specfile("rpm/liblinphone.spec.cmake" "${PROJECT_SOURCE_DIR}/liblinphone.spec") include(CPack) diff --git a/build/rpm/liblinphone.spec.in b/build/rpm/liblinphone.spec.cmake similarity index 66% rename from build/rpm/liblinphone.spec.in rename to build/rpm/liblinphone.spec.cmake index 1ea7e5aa3..b0f030334 100755 --- a/build/rpm/liblinphone.spec.in +++ b/build/rpm/liblinphone.spec.cmake @@ -1,12 +1,7 @@ # -*- 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-liblinphone}%{!?_with_bc:liblinphone} -%{?_with_bc: %define _prefix /opt/belledonne-communications} +%define _prefix @CMAKE_INSTALL_PREFIX@ +%define pkg_prefix @BC_PACKAGE_NAME_PREFIX@ # 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 @@ -15,18 +10,20 @@ %define _docdir %{_datadir}/doc %define build_number @PROJECT_VERSION_BUILD@ +%if %{build_number} +%define build_number_ext -%{build_number} +%endif - -Name: %{pkg_name} +Name: @CPACK_PACKAGE_NAME@ Version: @PROJECT_VERSION@ -Release: %build_number%{?dist} +Release: %{build_number}%{?dist} Summary: Phone anywhere in the whole world by using the Internet Group: Applications/Communications License: GPL URL: http://www.linphone.org -Source0: %{name}-%{version}-%{build_number}.tar.gz +Source0: %{name}-%{version}%{?build_number_ext}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Requires: %{pkg_prefix}bctoolbox @@ -34,15 +31,13 @@ Requires: %{pkg_prefix}ortp Requires: %{pkg_prefix}mediastreamer Requires: %{pkg_prefix}belle-sip Requires: %{pkg_prefix}belr -%if %{?_with_soci:1}%{!?_with_soci:0} +%if @ENABLE_SOCI_STORAGE@ Requires: %{pkg_prefix}soci %endif %description liblinphone is the voip sdk used by Linphone -%define video %{?_without_video:0}%{!?_without_video:1} - %package devel Summary: Development libraries for liblinphone @@ -61,11 +56,15 @@ develop programs using the liblinphone library. %define ctest_name ctest %endif +# This is for debian builds where debug_package has to be manually specified, whereas in centos it does not +%define custom_debug_package %{!?_enable_debug_packages:%debug_package}%{?_enable_debug_package:%{nil}} +%custom_debug_package + %prep -%setup -n %{name}-%{version}-%build_number +%setup -n %{name}-%{version}%{?build_number_ext} %build -%{expand:%%%cmake_name} . -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} -DCMAKE_PREFIX_PATH:PATH=%{_prefix} -DENABLE_VIDEO=%{video} +%{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 @@ -84,25 +83,32 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %doc AUTHORS ChangeLog COPYING NEWS README.md TODO -%{_bindir}/linphonec -%{_bindir}/linphonecsh -%{_bindir}/lp-auto-answer -%{_bindir}/lp-test-ecc +%if @ENABLE_DAEMON@ || @ENABLE_CONSOLE_UI@ +%{_bindir}/* +%endif %{_libdir}/*.so.* #%{_mandir}/* %{_datadir}/linphone %{_datadir}/sounds/linphone -%{_datadir}/Linphone/rootca.pem %files devel %defattr(-,root,root) -%{_bindir}/* %{_includedir}/linphone +%if @ENABLE_CXX_WRAPPER@ +%{_includedir}/linphone++ +%endif +%if @ENABLE_STATIC@ %{_libdir}/*.a +%endif +%if @ENABLE_SHARED@ %{_libdir}/*.so -#%{_docdir} +%endif +%if @ENABLE_DOC@ +%{_docdir}/linphone*/html +%{_docdir}/linphone*/xml +%endif %{_datadir}/Linphone/cmake/*.cmake -%{_datadir}/liblinphone_tester +%{_datadir}/LinphoneCxx/cmake/*.cmake %{_datadir}/belr/grammars/cpim_grammar