Skip to content

Commit dde3541

Browse files
committed
Improve install.
1 parent 3201d60 commit dde3541

File tree

11 files changed

+89
-18
lines changed

11 files changed

+89
-18
lines changed

Makefile

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ HAS_GIT=$(shell git rev-parse --is-inside-work-tree >/dev/null 2>&1 ; echo $$?)
2626

2727
ifneq ($(HAS_GIT), 0)
2828
# We have no git used manually set version number.
29-
VERSION:=1.0.0
29+
VERSION:=$(shell cat dist/VERSION)
3030
COMMIT_HASH:=
31-
DEBVERSION:=1.0.0
3231
else
3332
# We have git, extract information from it.
3433
SUPRE=
@@ -50,17 +49,14 @@ else
5049
ifeq ($(COMMIT),$(TAG_COMMIT))
5150
# Exactly on the tagged commit. The version is the tag!
5251
VERSION:=$(TAG)
53-
DEBVERSION:=$(TAG)
5452
else
5553
VERSION:=$(TAG)++
56-
DEBVERSION:=$(TAG)++
5754
endif
5855

5956
ifneq ($(strip $(CHANGES)),)
6057
# There are changes, signify that with a +changes
6158
VERSION:=$(VERSION) with uncommitted changes
6259
COMMIT_HASH:=$(COMMIT_HASH) but with uncommitted changes
63-
DEBVERSION:=$(DEBVERSION)l
6460
endif
6561

6662
endif
@@ -129,6 +125,7 @@ lcov:
129125
@for x in $(BUILDDIRS); do echo; echo Bulding $$(basename $$x) ; $(MAKE) --no-print-directory -C $$x debug lcov ; done
130126

131127
dist:
128+
@echo "$(VERSION)" | cut -f 1 -d '-' > dist/VERSION
132129
@cat CHANGES | sed '/20..-..-..:/q' | head -n -1 | sed '$d' > RELEASE
133130
@rm -f dist/xmq.c dist/xmq.h
134131
@$(MAKE) --no-print-directory -C $(FIRSTDIR) release $(shell pwd)/dist/xmq.c $(shell pwd)/dist/xmq.h
@@ -176,14 +173,10 @@ clean-all:
176173

177174
DESTDIR?=/usr/local
178175
install:
179-
install -Dm 755 -s build/default/release/xmq $(DESTDIR)/bin/xmq
180-
install -Dm 644 doc/xmq.1 $(DESTDIR)/man/man1/xmq.1
181-
install -Dm 644 scripts/autocompletion_for_xmq.sh /etc/bash_completion.d/xmq
176+
@./install.sh build/default/release $(DESTDIR)
182177

183178
uninstall:
184-
rm -f $(DESTDIR)/bin/xmq
185-
rm -f $(DESTDIR)/man/man1/xmq.1
186-
rm -f /etc/bash_completion.d/xmq
179+
@./uninstall.sh $(DESTDIR)
187180

188181
linux64:
189182

RELEASE

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +0,0 @@
1-
2-
3-
Steven Pemberton noticed that xmq wrongly reported some IXML grammars
4-
as ambiguous even though they weren't. This is now fixed. Thanks Steven!
5-

VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

autoconf/spec.inc.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ PATH_SEP="@PATH_SEP@"
88
SRC_ROOT="@SRC_ROOT@"
99
BUILD_ROOT="@BUILD_ROOT@"
1010
OUTPUT_ROOT="@OUTPUT_ROOT@"
11+
PREFIX="@PREFIX@"
1112

1213
ENABLE_STATIC_XMQ="@ENABLE_STATIC_XMQ@"
1314

autoconf/spec.mk.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ PATH_SEP:=@PATH_SEP@
2121
SRC_ROOT:=@SRC_ROOT@
2222
BUILD_ROOT:=@BUILD_ROOT@
2323
OUTPUT_ROOT:=@OUTPUT_ROOT@
24+
PREFIX:=@PREFIX@
2425

2526
ENABLE_STATIC_XMQ:=@ENABLE_STATIC_XMQ@
2627

configure

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,7 @@ CPPFLAGS
657657
LDFLAGS
658658
CFLAGS
659659
CC
660+
PREFIX
660661
BUILD_ROOT
661662
OUTPUT_ROOT
662663
SRC_ROOT
@@ -2486,6 +2487,12 @@ ln -s "$OUTPUT_ROOT" "$SRC_ROOT/build/default"
24862487
24872488
24882489
2490+
if test "x$prefix" = "xNONE"; then
2491+
PREFIX="$ac_default_prefix"
2492+
else
2493+
PREFIX="$prefix"
2494+
fi
2495+
24892496
24902497
24912498

configure.ac

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ AC_SUBST(CONF_NAME)
108108
AC_SUBST(SRC_ROOT)
109109
AC_SUBST(OUTPUT_ROOT)
110110
AC_SUBST(BUILD_ROOT)
111+
AC_SUBST(PREFIX)
112+
if test "x$prefix" = "xNONE"; then
113+
PREFIX="$ac_default_prefix"
114+
else
115+
PREFIX="$prefix"
116+
fi
111117

112118
AC_HEADER_STAT
113119

dist/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.1.1

install.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
if [ "$1" = "" ] || [ "$1" = "-h" ]
6+
then
7+
echo "Usage: install.sh [build_dir] [dest_dir]
8+
Example: install.sh build/default/release /usr/local
9+
"
10+
exit 0
11+
fi
12+
13+
FROM="$1"
14+
DESTDIR="$2"
15+
16+
if [ ! -f "$FROM/../spec.inc" ]
17+
then
18+
echo "Oups, please supply a build dir such as build/default/release"
19+
exit 1
20+
fi
21+
22+
if [ ! -d "$DESTDIR" ]
23+
then
24+
echo "Oups, please supply a valid dest_dir directory."
25+
exit 1
26+
fi
27+
28+
#. "${FROM}/../spec.inc"
29+
30+
install -Dm 755 -s "${FROM}/xmq" "${DESTDIR}/bin/xmq"
31+
install -Dm 644 -s "${FROM}/libxmq.a" "${DESTDIR}/lib/libxmq.a"
32+
install -Dm 644 -s "${FROM}/libxmq.so" "${DESTDIR}/lib/libxmq.so"
33+
cp "src/main/c/xmq.h" "${DESTDIR}/include/xmq.h"
34+
chmod 644 "src/main/c/xmq.h"
35+
install -Dm 644 "doc/xmq.1" "${DESTDIR}/man/man1/xmq.1"
36+
install -Dm 644 "scripts/autocompletion_for_xmq.sh" "${DESTDIR}/share/bash-completion/completions/xmq"
37+
38+
echo
39+
echo "xmq and libxmq sucessfully installed."

make/Main.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ $(SRC_ROOT)/dist/xmq.h: $(SRC_ROOT)/src/main/c/xmq.h
203203
@cp $< $@
204204
@echo "Copied dist/xmq.h"
205205

206-
$(SRC_ROOT)/dist/xmq.c: $(SRC_ROOT)/src/main/c/xmq.c $(PARTS_SOURCES) $(SRC_ROOT)/VERSION $(OUTPUT_ROOT)/update_yaep
206+
$(SRC_ROOT)/dist/xmq.c: $(SRC_ROOT)/src/main/c/xmq.c $(PARTS_SOURCES) $(SRC_ROOT)/build/VERSION $(OUTPUT_ROOT)/update_yaep
207207
$(AT)$(SRC_ROOT)/scripts/build_xmq_from_parts.sh $(OUTPUT_ROOT) $<
208208
$(AT)cp $(OUTPUT_ROOT)/xmq-in-progress $(SRC_ROOT)/dist/xmq.c
209209
@echo "Generated dist/xmq.c"

0 commit comments

Comments
 (0)