Skip to content

Commit

Permalink
Improve install.
Browse files Browse the repository at this point in the history
  • Loading branch information
weetmuts committed Dec 26, 2024
1 parent 3201d60 commit dde3541
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 18 deletions.
15 changes: 4 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ HAS_GIT=$(shell git rev-parse --is-inside-work-tree >/dev/null 2>&1 ; echo $$?)

ifneq ($(HAS_GIT), 0)
# We have no git used manually set version number.
VERSION:=1.0.0
VERSION:=$(shell cat dist/VERSION)
COMMIT_HASH:=
DEBVERSION:=1.0.0
else
# We have git, extract information from it.
SUPRE=
Expand All @@ -50,17 +49,14 @@ else
ifeq ($(COMMIT),$(TAG_COMMIT))
# Exactly on the tagged commit. The version is the tag!
VERSION:=$(TAG)
DEBVERSION:=$(TAG)
else
VERSION:=$(TAG)++
DEBVERSION:=$(TAG)++
endif

ifneq ($(strip $(CHANGES)),)
# There are changes, signify that with a +changes
VERSION:=$(VERSION) with uncommitted changes
COMMIT_HASH:=$(COMMIT_HASH) but with uncommitted changes
DEBVERSION:=$(DEBVERSION)l
endif

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

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

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

uninstall:
rm -f $(DESTDIR)/bin/xmq
rm -f $(DESTDIR)/man/man1/xmq.1
rm -f /etc/bash_completion.d/xmq
@./uninstall.sh $(DESTDIR)

linux64:

Expand Down
5 changes: 0 additions & 5 deletions RELEASE
Original file line number Diff line number Diff line change
@@ -1,5 +0,0 @@


Steven Pemberton noticed that xmq wrongly reported some IXML grammars
as ambiguous even though they weren't. This is now fixed. Thanks Steven!

1 change: 0 additions & 1 deletion VERSION

This file was deleted.

1 change: 1 addition & 0 deletions autoconf/spec.inc.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ PATH_SEP="@PATH_SEP@"
SRC_ROOT="@SRC_ROOT@"
BUILD_ROOT="@BUILD_ROOT@"
OUTPUT_ROOT="@OUTPUT_ROOT@"
PREFIX="@PREFIX@"

ENABLE_STATIC_XMQ="@ENABLE_STATIC_XMQ@"

Expand Down
1 change: 1 addition & 0 deletions autoconf/spec.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ PATH_SEP:=@PATH_SEP@
SRC_ROOT:=@SRC_ROOT@
BUILD_ROOT:=@BUILD_ROOT@
OUTPUT_ROOT:=@OUTPUT_ROOT@
PREFIX:=@PREFIX@

ENABLE_STATIC_XMQ:=@ENABLE_STATIC_XMQ@

Expand Down
7 changes: 7 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,7 @@ CPPFLAGS
LDFLAGS
CFLAGS
CC
PREFIX
BUILD_ROOT
OUTPUT_ROOT
SRC_ROOT
Expand Down Expand Up @@ -2486,6 +2487,12 @@ ln -s "$OUTPUT_ROOT" "$SRC_ROOT/build/default"
if test "x$prefix" = "xNONE"; then
PREFIX="$ac_default_prefix"
else
PREFIX="$prefix"
fi
Expand Down
6 changes: 6 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ AC_SUBST(CONF_NAME)
AC_SUBST(SRC_ROOT)
AC_SUBST(OUTPUT_ROOT)
AC_SUBST(BUILD_ROOT)
AC_SUBST(PREFIX)
if test "x$prefix" = "xNONE"; then
PREFIX="$ac_default_prefix"
else
PREFIX="$prefix"
fi

AC_HEADER_STAT

Expand Down
1 change: 1 addition & 0 deletions dist/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.1.1
39 changes: 39 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/sh

set -e

if [ "$1" = "" ] || [ "$1" = "-h" ]
then
echo "Usage: install.sh [build_dir] [dest_dir]
Example: install.sh build/default/release /usr/local
"
exit 0
fi

FROM="$1"
DESTDIR="$2"

if [ ! -f "$FROM/../spec.inc" ]
then
echo "Oups, please supply a build dir such as build/default/release"
exit 1
fi

if [ ! -d "$DESTDIR" ]
then
echo "Oups, please supply a valid dest_dir directory."
exit 1
fi

#. "${FROM}/../spec.inc"

install -Dm 755 -s "${FROM}/xmq" "${DESTDIR}/bin/xmq"
install -Dm 644 -s "${FROM}/libxmq.a" "${DESTDIR}/lib/libxmq.a"
install -Dm 644 -s "${FROM}/libxmq.so" "${DESTDIR}/lib/libxmq.so"
cp "src/main/c/xmq.h" "${DESTDIR}/include/xmq.h"
chmod 644 "src/main/c/xmq.h"
install -Dm 644 "doc/xmq.1" "${DESTDIR}/man/man1/xmq.1"
install -Dm 644 "scripts/autocompletion_for_xmq.sh" "${DESTDIR}/share/bash-completion/completions/xmq"

echo
echo "xmq and libxmq sucessfully installed."
2 changes: 1 addition & 1 deletion make/Main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ $(SRC_ROOT)/dist/xmq.h: $(SRC_ROOT)/src/main/c/xmq.h
@cp $< $@
@echo "Copied dist/xmq.h"

$(SRC_ROOT)/dist/xmq.c: $(SRC_ROOT)/src/main/c/xmq.c $(PARTS_SOURCES) $(SRC_ROOT)/VERSION $(OUTPUT_ROOT)/update_yaep
$(SRC_ROOT)/dist/xmq.c: $(SRC_ROOT)/src/main/c/xmq.c $(PARTS_SOURCES) $(SRC_ROOT)/build/VERSION $(OUTPUT_ROOT)/update_yaep
$(AT)$(SRC_ROOT)/scripts/build_xmq_from_parts.sh $(OUTPUT_ROOT) $<
$(AT)cp $(OUTPUT_ROOT)/xmq-in-progress $(SRC_ROOT)/dist/xmq.c
@echo "Generated dist/xmq.c"
Expand Down
29 changes: 29 additions & 0 deletions uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

set -e

if [ "$1" = "" ] || [ "$1" = "-h" ]
then
echo "Usage: uninstall.sh [dest_dir]
Example: uninstall.sh /usr/local
"
exit 0
fi

DESTDIR="$1"

if [ ! -d "$DESTDIR" ]
then
echo "Oups, please supply a valid dest_dir directory."
exit 1
fi

rm -f "${DESTDIR}/bin/xmq"
rm -f "${DESTDIR}/lib/libxmq.a"
rm -f "${DESTDIR}/lib/libxmq.so"
rm -f "${DESTDIR}/include/xmq.h"
rm -f "${DESTDIR}/man/man1/xmq.1"
rm -f "${DESTDIR}/share/bash-completion/completions/xmq"

echo
echo "xmq and libxmq sucessfully uninstalled."

0 comments on commit dde3541

Please sign in to comment.