Skip to content

Commit

Permalink
Fix broken .RPMs by providing a custom spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
joneschrisg committed Jun 25, 2013
1 parent 77e7ac4 commit f4f6c8b
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 7 deletions.
23 changes: 16 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# *-* Mode: cmake; *-*

cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 2.8)
project(rr)

enable_testing()
Expand All @@ -10,8 +10,11 @@ set(PROJECT_BINARY_DIR ${CMAKE_SOURCE_DIR}/obj)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

# CAREFUL! "-" is an invalid character in RPM package names, while
# debian is happy with it. However, "_" is illegal in debs, while RPM
# is cool with it. Sigh.
set(rr_VERSION_MAJOR 0)
set(rr_VERSION_MINOR 0-prerelease)
set(rr_VERSION_MINOR 0prerelease)
set(rr_VERSION_PATCH 0)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g3 -Wall -Werror -m32")
Expand Down Expand Up @@ -86,20 +89,26 @@ set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_OUTPUT_FILE_PREFIX dist)
set(CPACK_GENERATOR "TGZ;RPM;DEB")
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_BINARY_DIR "${CMAKE_SOURCE_DIR}")

set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
"Lightweight tool for recording and replaying execution of applications (trees of processes and threads)")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README")
set(CPACK_PACKAGE_VENDOR "Mozilla Foundation")

set(CPACK_RPM_PACKAGE_RELEASE 1)
set(CPACK_RPM_PACKAGE_GROUP "Development/Debuggers")
set(CPACK_RPM_PACKAGE_LICENSE "MIT and BSD")
#set(CPACK_RPM_PACKAGE_REQUIRES "requires: pfm, disasm")

set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Mozilla Foundation")
set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
#set(CPACK_DEBIAN_PACKAGE_DEPENDS "pfm, disasm")

# XXX Cmake 2.8.7 doesn't know how to avoid specifiying /usr,
# /usr/bin, etc, as files to be installed, but distros are finicky
# about their specification. We want to manually filter those paths
# out of our install list but 2.8.7 also isn't capable of that.
set(CPACK_RPM_USER_BINARY_SPECFILE "${CMAKE_SOURCE_DIR}/rr.spec")
set(CPACK_RPM_PACKAGE_RELEASE 1)
set(CPACK_RPM_PACKAGE_GROUP "Development/Debuggers")
set(CPACK_RPM_PACKAGE_LICENSE "MIT and BSD")
#set(CPACK_RPM_PACKAGE_REQUIRES "Requires: pfm, disasm")

include (CPack)
43 changes: 43 additions & 0 deletions rr.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Buildroot: @CPACK_BINARY_DIR@/_CPack_Packages/@CPACK_SYSTEM_NAME@/RPM/@CPACK_PACKAGE_FILE_NAME@
Summary: Lightweight tool for recording and replaying execution of applications (trees of processes and threads)
Name: @CPACK_PACKAGE_NAME@
Version: @CPACK_PACKAGE_VERSION@
Release: @CPACK_RPM_PACKAGE_RELEASE@
License: @CPACK_RPM_PACKAGE_LICENSE@
Group: Development/Debuggers
Vendor: @CPACK_PACKAGE_VENDOR@
Prefix: @CPACK_PACKAGING_INSTALL_PREFIX@
@CPACK_RPM_PACKAGE_REQUIRES@

%define _rpmdir @CPACK_BINARY_DIR@/_CPack_Packages/@CPACK_SYSTEM_NAME@/RPM
%define _rpmfilename @[email protected]
%define _unpackaged_files_terminate_build 0
%define _topdir @CPACK_BINARY_DIR@/_CPack_Packages/@CPACK_SYSTEM_NAME@/RPM

%description
rr is a lightweight tool for recording and replaying execution of applications (trees of processes and threads). For more information, please visit

http://mozilla.github.com/rr

# This is a shortcutted spec file generated by CMake RPM generator
# we skip _install step because CPack does that for us.
# We do only save CPack installed tree in _prepr
# and then restore it in build.
%prep
mv $RPM_BUILD_ROOT @CPACK_BINARY_DIR@/_CPack_Packages/@CPACK_SYSTEM_NAME@/RPM/tmpBBroot

%install
if [ -e $RPM_BUILD_ROOT ];
then
rm -Rf $RPM_BUILD_ROOT
fi
mv "@CPACK_BINARY_DIR@/_CPack_Packages/@CPACK_SYSTEM_NAME@/RPM/tmpBBroot" $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
@CPACK_PACKAGING_INSTALL_PREFIX@/lib/*
@CPACK_PACKAGING_INSTALL_PREFIX@/bin/rr

%changelog
* Tue Jun 25 2013 Chris Jones <cjones@triton> -
- Initial build.

0 comments on commit f4f6c8b

Please sign in to comment.