Commit dba4def4 authored by jehan's avatar jehan

prepare cmake based rpm build

parent 2335fdf5
......@@ -206,6 +206,7 @@ set(ORTPDEPS_LIBS )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ortp.pc.in ${CMAKE_CURRENT_BINARY_DIR}/ortp.pc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ortp.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ortp.spec.cmake ${CMAKE_CURRENT_SOURCE_DIR}/ortp.spec)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
......
......@@ -20,9 +20,7 @@
#
############################################################################
if(NOT CPACK_PACKAGE_NAME)
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
endif()
set(CPACK_PACKAGE_NAME "ortp")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../COPYING")
......@@ -37,21 +35,38 @@ set(CPACK_SOURCE_IGNORE_FILES
"${CMAKE_BINARY_DIR}"
"^${PROJECT_SOURCE_DIR}/.git*"
)
find_package(Git 1.7.10) # --count option of git rev-list is available only since (more or less) git 1.7.10
find_program (WC wc)
if (WC)
set(GIT_MINIMUN_VERSION 1.7.1) #might be even lower
else()
set(GIT_MINIMUN_VERSION 1.7.10) # --count option of git rev-list is available only since (more or less) git 1.7.10)
endif()
find_package(Git ${GIT_MINIMUN_VERSION})
string(COMPARE GREATER "${GIT_VERSION_STRING}" "1.7.10" GIT_REV_LIST_HAS_COUNT)
if (GIT_REV_LIST_HAS_COUNT)
set(GIT_REV_LIST_COMMAND "${GIT_EXECUTABLE}" "rev-list" "--count" "${PROJECT_VERSION}..HEAD")
set(WC_COMMAND )
else()
set(GIT_REV_LIST_COMMAND "${GIT_EXECUTABLE}" "rev-list" "${PROJECT_VERSION}..HEAD")
set(WC_COMMAND "${WC}" "-l")
endif()
if(GIT_EXECUTABLE)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-list --count ${PROJECT_VERSION}..HEAD
COMMAND ${GIT_REV_LIST_COMMAND}
COMMAND ${WC_COMMAND}
OUTPUT_VARIABLE PROJECT_VERSION_BUILD
OUTPUT_STRIP_TRAILING_WHITESPACE
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}")
message("Package file name is ${CPACK_PACKAGE_FILE_NAME}" )
endif()
set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})
include(CPack)
# -*- rpm-spec -*-
#
# ortp -- Real-time Transport Protocol Stack
#
# Default is optimized for Pentium IV but will execute on Pentium II &
# later (i686).
# 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-ortp}%{!?_with_bc:ortp}
%{?_with_bc: %define _prefix /opt/belledonne-communications}
%define srtp %{?_without_srtp:0}%{?!_without_srtp:1}
# 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
%ifarch %ix86
%define ortp_cpu pentium4
%endif
%define build_number %(git describe --tags --abbrev=40 | sed -rn 's/^.*-([0-9]+)-g[a-z0-9]{40}$/\1/p' || echo '1')
Summary: Real-time Transport Protocol Stack
Name: %pkg_name
Version: @ORTP_PKGCONFIG_VERSION@
Release: %build_number%{?dist}
#to be alined with redhat which changed epoc to 1 for an unknown reason
Epoch: 1
License: GPL
Group: Applications/Communications
URL: http://linphone.org/ortp/
Source0: %{name}-%{version}-%build_number.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
%ifarch %ix86
BuildArch: i686
%endif
%description
oRTP is a LGPL licensed C library implementing the RTP protocol
(rfc3550). It is available for most unix clones (primilarly Linux and
HP-UX), and Microsoft Windows.
%package devel
Summary: Headers, libraries and docs for the oRTP library
Group: Development/Libraries
BuildRequires: doxygen
#to be alined with redhat which changed epoc to 1 for an unknown reason
Epoch: 1
Requires: %{name} = %{epoch}:%{version}-%{release}
%description devel
oRTP is a LGPL licensed C library implementing the RTP protocol
(rfc1889). It is available for most unix clones (primilarly Linux and
HP-UX), and Microsoft Windows.
This package contains header files and development libraries needed to
develop programs using the oRTP library.
%ifarch %ix86
%define ortp_arch_cflags -malign-double -march=i686 -mtune=%{ortp_cpu}
%else
# Must be non-empty
%define ortp_arch_cflags -Wall
%endif
%define ortp_cflags %ortp_arch_cflags -Wall -g -pipe -pthread -O3 -fomit-frame-pointer -fno-schedule-insns -fschedule-insns2 -fno-strict-aliasing
%prep
%setup -n %{name}-%{version}-%build_number
%build
%cmake .
make %{?_smp_mflags}
%install
make install DESTDIR=%{buildroot}
%check
ctest -V %{?_smp_mflags}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc %{_docdir}/ortp-%{version}/README
%doc %{_docdir}/ortp-%{version}/ChangeLog
%doc %{_docdir}/ortp-%{version}/COPYING
%doc %{_docdir}/ortp-%{version}/AUTHORS
%{_libdir}/*.so.*
%files devel
%defattr(-,root,root,-)
%doc %{_docdir}/ortp-%{version}/html/*
%{_libdir}/*.la
%{_libdir}/*.a
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%{_includedir}/*
%changelog
* Tue Oct 25 2005 Francois-Xavier Kowalski <fix@hp.com>
- Add to oRTP distribution with "make rpm" target
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