blob: 3a22eef08a1963b0b5a14cc88f8fb3cef500802a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
TARBALL_DIR=../../dist
TARBALL=$(notdir $(wildcard $(TARBALL_DIR)/rabbitmq-server-[0-9.]*.tar.gz))
COMMON_DIR=../common
VERSION=$(shell echo $(TARBALL) | sed -e 's:rabbitmq-server-\(.*\)\.tar\.gz:\1:g')
# The URL at which things really get deployed
REAL_WEB_URL=http://www.rabbitmq.com/
# The user@host for an OSX machine with macports installed, which is
# used to generate the macports index files. That step will be
# skipped if this variable is not set. If you do set it, you might
# also want to set SSH_OPTS, which allows adding ssh options, e.g. to
# specify a key that will get into the OSX machine without a
# passphrase.
MACPORTS_USERHOST=
MACPORTS_DIR=macports
DEST=$(MACPORTS_DIR)/net/rabbitmq-server
all: macports
dirs:
mkdir -p $(DEST)/files
$(DEST)/Portfile: Portfile.in
for algo in md5 sha1 rmd160 ; do \
checksum=$$(openssl $$algo $(TARBALL_DIR)/$(TARBALL) | awk '{print $$NF}') ; \
echo "s|@$$algo@|$$checksum|g" ; \
done >checksums.sed
sed -e "s|@VERSION@|$(VERSION)|g;s|@BASE_URL@|$(REAL_WEB_URL)|g" \
-f checksums.sed <$^ >$@
rm checksums.sed
# The purpose of the intricate substitution below is to set up similar
# environment vars to the ones that su will on Linux. On OS X, we
# have to use the -m option to su in order to be able to set the shell
# (which for the rabbitmq user would otherwise be /dev/null). But the
# -m option means that *all* environment vars get preserved. Erlang
# needs vars such as HOME to be set. So we have to set them
# explicitly.
macports: dirs $(DEST)/Portfile
for f in rabbitmq-asroot-script-wrapper rabbitmq-script-wrapper ; do \
cp $(COMMON_DIR)/$$f $(DEST)/files ; \
done
sed -i -e 's|@SU_RABBITMQ_SH_C@|SHELL=/bin/sh HOME=/var/lib/rabbitmq USER=rabbitmq LOGNAME=rabbitmq PATH="$$(eval `PATH=MACPORTS_PREFIX/bin /usr/libexec/path_helper -s`; echo $$PATH)" su -m rabbitmq -c|' \
$(DEST)/files/rabbitmq-script-wrapper
cp patch-org.macports.rabbitmq-server.plist.diff $(DEST)/files
if [ -n "$(MACPORTS_USERHOST)" ] ; then \
tar cf - -C $(MACPORTS_DIR) . | ssh $(SSH_OPTS) $(MACPORTS_USERHOST) ' \
d="/tmp/mkportindex.$$$$" ; \
mkdir $$d \
&& cd $$d \
&& tar xf - \
&& /opt/local/bin/portindex -a -o . >/dev/null \
&& tar cf - . \
&& cd \
&& rm -rf $$d' \
| tar xf - -C $(MACPORTS_DIR) ; \
fi
clean:
rm -rf $(MACPORTS_DIR) checksums.sed
|