Commit 43b81325 authored by Nick Mathewson's avatar Nick Mathewson 🦀
Browse files

Merge remote-tracking branch 'origin/maint-0.2.3'

parents 5919e8e5 ae75fb13
Loading
Loading
Loading
Loading
+16 −17
Original line number Diff line number Diff line
@@ -24,23 +24,22 @@ EXTRA_DIST = \
#install-data-local:
#	$(INSTALL) -m 755 -d $(LOCALSTATEDIR)/lib/tor

# Assume a tarball is in .. for now.
dist-rpm:
	RPM_BUILD_DIR="/tmp/tor-rpm-build-$$$$";                \
	rm -rf $$RPM_BUILD_DIR;                                 \
	mkdir $$RPM_BUILD_DIR || exit 1;                        \
	for subdir in BUILD RPMS SOURCES SPECS SRPMS; do        \
	    mkdir $$RPM_BUILD_DIR/$$subdir;                     \
	done;                                                   \
	mkdir $$RPM_BUILD_DIR/SOURCES/tor-$(VERSION);           \
	cp -R ./ $$RPM_BUILD_DIR/SOURCES/tor-$(VERSION)/;       \
	pushd $$RPM_BUILD_DIR/SOURCES/;                         \
	tar zcf tor-$(VERSION).tar.gz ./;                       \
	popd;                                                   \
	LIBS=-lrt rpmbuild -ba --define "_topdir $$RPM_BUILD_DIR" tor.spec; \
	mv $$RPM_BUILD_DIR/SRPMS/* .;                           \
	mv $$RPM_BUILD_DIR/RPMS/* .;                            \
	rm -rf $$RPM_BUILD_DIR
# Allows to override rpmbuild with rpmbuild-md5 from fedora-packager so that
# building for EL5 won't fail on https://bugzilla.redhat.com/show_bug.cgi?id=490613
RPMBUILD ?= rpmbuild

# Use automake's dist-gzip target to build the tarball
dist-rpm: dist-gzip
	TIMESTAMP=$$(date +"%Y-%m-%d_%H.%M.%S"); 				\
	RPM_BUILD_DIR=$$(mktemp -d "/tmp/tor-rpm-build-$$TIMESTAMP-XXXX");	\
	mkdir -p "$$RPM_BUILD_DIR"/{BUILD,RPMS,SOURCES/"tor-$(VERSION)",SPECS,SRPMS}; \
	cp -fa "$(distdir).tar.gz" "$$RPM_BUILD_DIR"/SOURCES/;			\
	LIBS=-lrt $(RPMBUILD) -ba --define "_topdir $$RPM_BUILD_DIR" tor.spec; 	\
	cp -fa "$$RPM_BUILD_DIR"/SRPMS/* .;                           		\
	cp -fa "$$RPM_BUILD_DIR"/RPMS/* .;                            		\
	rm -rf "$$RPM_BUILD_DIR";						\
	echo "RPM build finished";						\
	#end of dist-rpm

dist: check

changes/bug6043

0 → 100644
+6 −0
Original line number Diff line number Diff line
  o Packaging (RPM):
    - Our default RPM spec files have been updated to work with mock
      and rpmbuild on RHEL/Fedora. They have an updated set of
      dependencies and conflicts, a fix for an ancient typo when creating
      the "_tor" user, and better instructions. Thanks to Ondrej
      Mikle for the patch series; fix for bug 6043.
+43 −13
Original line number Diff line number Diff line
@@ -2,18 +2,9 @@
##
The process used to create the official rpms is as follows:

Download latest stable libevent from
http://www.monkey.org/~provos/libevent/

The first step of compiling libevent is to configure it as follows:
./configure --enable-static --disable-shared 

Complete the "make" and "make install".  You will need to be root,
or sudo -s, to complete the "make install".

Check for a successful universal binary of libevent.a in, by default,
/usr/local/lib by using the following command:
	"file /usr/local/lib/libevent.a"
You'll need to install libevent headers, usually located in package named
libevent-devel. Alternatively, you could download latest libevent from
http://libevent.org/ but that shouldn't be necessary.

Download and Extract the latest tor source code from
https://www.torproject.org/download
@@ -23,4 +14,43 @@ LIBS=-lrt ./configure
make dist-rpm

You should have at least two, maybe three, rpms.  There should be the binary
i386.rpm, a src.rpm, and on redhat/centos machines, a debuginfo.rpm.
(i686|x86_64).rpm, a src.rpm, and on redhat/centos machines, a debuginfo.rpm.
The debuginfo rpms are created if package redhat-rpm-config is installed (case
of redhat distros).

This step suffices unless you want to create RPMs for distros other than the
one you used for building.


## Instructions for building RPMs for multiple architectures or distributions
## using 'mock' on Fedora or RHEL (and clones)

Make sure you have mock installed and configured, see following HOWTOs for setup:
https://fedoraproject.org/wiki/How_to_create_an_RPM_package
https://fedoraproject.org/wiki/Using_Mock_to_test_package_builds

Take the source RPM generated by previous step, and execute mock for every
target architecture (the names come from files in /etc/mock, strip the .cfg
extension in the -r parameter):

mock --rebuild -r fedora-17-x86_64 tor-X.Y.Z.src.rpm

Building for EL5 from newer distro (e.g. EL6 or Fedora 17) will fail due to bug
(https://bugzilla.redhat.com/show_bug.cgi?id=490613).
Here's a workaround:

Before even building the source RPM, install fedora-packager and instruct
the build system to use rpmbuild-md5 like this:

yum install fedora-packager
export RPMBUILD=rpmbuild-md5

Then proceed as usual to create the source RPM and binary RPMs:

LIBS=-lrt ./configure
make dist-rpm
mock --rebuild -r epel-5-x86_64 tor-X.Y.Z.src.rpm


(Note: don't build under OpenVZ - it breaks unshare() syscall, which in turn
breaks mock. It could save you several hours.)
+16 −11
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
# This should be incremented whenever the spec file changes, but
# can drop back to zero at a new Tor version

%define specver 0
%define specver 1

## Things users may want to change
#
@@ -108,17 +108,14 @@ License: 3-clause BSD
Vendor: The Tor Project (https://torproject.org)
Packager: Erinn Clark <erinn@torproject.org>

%if %{is_suse}
Requires: openssl >= 0.9.7
BuildRequires: openssl-devel >= 0.9.7, rpm >= 4.0, zlib-devel
%else 
Requires: openssl >= 0.9.7
BuildRequires: openssl-devel >= 0.9.7
%endif
%if %{is_fc}
BuildRequires: rpm-build >= 4.0
Requires: openssl >= 0.9.7, libevent >= 1.4.13
BuildRequires: openssl-devel >= 0.9.7, libevent-devel >= 1.4.13, asciidoc

# Fedora 16 and RHEL 5 have following conflicting packages according to rpm search
%if %{is_rh}
Conflicts: tor-core, tor-lsb, tor-upstart
%endif

Requires(pre): /usr/bin/id, /bin/date, /bin/sh
Requires(pre): %{_sbindir}/useradd, %{_sbindir}/groupadd

@@ -287,6 +284,14 @@ exit 0
%attr(0750,%{toruser},%{torgroup}) %dir %{_localstatedir}/log/%{name}

%changelog
* Thu Jun 21 2012 Ondrej Mikle <ondrej.mikle@gmail.com>
- fixed to work with both rpmbuild and mock on RHEL/Fedora
- removed unnecessary files from rpm such as .git repo
- fixed build dependencies and package conflicts
- fixed creating _tor user on Fedora 17 (ancient typo)
- added/updated build instructions for RPM creation
- confirmed to build and run on EL5, EL6, Fedora 16/17, OpenSuse 12.1

* Fri Aug 20 2010 Erinn Clark <erinn@torproject.org>
- add conflicts for Fedora packages
- add logic for SuSE since it requires special doc handling