From ea8ca04a7cb478c6c379e64e5db655fff9c0e15a Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sat, 14 Feb 2015 15:08:07 +0100 Subject: Move Makefile (and auxiliary file replace.sh) into base folder. Adapt packaging these scripts: debian/roll-tarballs.sh debian/rules nx-libs.spec --- Makefile | 184 +++++++++++++++++++++++++++++++++++++++++++++ debian/Makefile.nx-libs | 184 --------------------------------------------- debian/Makefile.replace.sh | 51 ------------- debian/roll-tarballs.sh | 5 -- debian/rules | 5 +- nx-libs.spec | 2 - replace.sh | 51 +++++++++++++ 7 files changed, 236 insertions(+), 246 deletions(-) create mode 100644 Makefile delete mode 100644 debian/Makefile.nx-libs delete mode 100644 debian/Makefile.replace.sh create mode 100644 replace.sh diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..3aeda739b --- /dev/null +++ b/Makefile @@ -0,0 +1,184 @@ +#!/usr/bin/make -f + +INSTALL_DIR=install -d -m 755 +INSTALL_FILE=install -m 644 +INSTALL_PROGRAM=install -m 755 +INSTALL_SYMLINK=ln -s -f +COPY_SYMLINK=cp -a +RM_FILE=rm -f +RM_DIR=rmdir -p --ignore-fail-on-non-empty + +ETCDIR_NX ?= /etc/nxagent +ETCDIR_X2GO ?= /etc/x2go +PREFIX ?= /usr/local +BINDIR ?= $(PREFIX)/bin +LIBDIR ?= $(PREFIX)/lib +USRLIBDIR ?= $(LIBDIR) +INCLUDEDIR ?= $(PREFIX)/include +NXLIBDIR ?= $(PREFIX)/lib/nx +X2GOLIBDIR ?= $(PREFIX)/lib/x2go +CONFIGURE ?= ./configure + +SHELL:=/bin/bash + +%: + if test -f nxcomp/Makefile; then ${MAKE} -C nxcomp $@; fi + if test -f nxproxy/Makefile; then ${MAKE} -C nxproxy $@; fi + if test -d nx-X11; then \ + if test -f nxcompext/Makefile; then ${MAKE} -C nxcompext $@; fi; \ + if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad $@; fi; \ + if test -f nx-X11/Makefile; then ${MAKE} -C nx-X11 $@; fi; \ + fi + +all: build + +test: + echo "No testing for NX (redistributed)" + +build-lite: + cd nxcomp && autoconf && (${CONFIGURE}) && ${MAKE} + cd nxproxy && autoconf && (${CONFIGURE}) && ${MAKE} + +build-full: +# in the full case, we rely on "magic" in the nx-X11 imake-based makefiles... + cd nxcomp && autoconf + cd nxcompext && autoconf + cd nxcompshad && autoconf + cd nx-X11 && ${MAKE} World + cd nxproxy && autoconf && (${CONFIGURE}) && ${MAKE} + +build: + if ! test -d nx-X11; then \ + ${MAKE} build-lite; \ + else \ + ${MAKE} build-full; \ + fi + +install: + $(MAKE) install-lite + [ ! -d nx-X11 ] || $(MAKE) install-full + +install-lite: + $(INSTALL_DIR) $(DESTDIR)$(BINDIR) + for d in nxcomp nxproxy; do \ + $(MAKE) -C $$d install; done + mkdir -p $(DESTDIR)$(NXLIBDIR)/bin/ + mv $(DESTDIR)$(BINDIR)/nxproxy $(DESTDIR)$(NXLIBDIR)/bin/ + for f in nxproxy; do \ + $(INSTALL_PROGRAM) bin/$$f $(DESTDIR)$(BINDIR); done + + $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/man/man1/ + $(INSTALL_FILE) nxproxy/man/nxproxy.1 $(DESTDIR)$(PREFIX)/share/man/man1/ + gzip $(DESTDIR)$(PREFIX)/share/man/man1/*.1 + + +install-full: + for f in nxagent nxauth x2goagent; do \ + $(INSTALL_PROGRAM) bin/$$f $(DESTDIR)$(BINDIR); done + for d in nxcompext nxcompshad; do \ + $(MAKE) -C $$d install; done + + $(INSTALL_DIR) $(DESTDIR)$(X2GOLIBDIR)/bin/ + cd $(DESTDIR)$(X2GOLIBDIR)/bin/ && ln -sf $(NXLIBDIR)/bin/nxagent x2goagent + + $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/pixmaps + $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/x2go.xpm $(DESTDIR)$(PREFIX)/share/pixmaps + $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/nxagent.xpm $(DESTDIR)$(PREFIX)/share/pixmaps + + $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/nx + $(INSTALL_FILE) nx-X11/programs/Xserver/Xext/SecurityPolicy $(DESTDIR)$(PREFIX)/share/nx + + $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/x2go/versions + $(INSTALL_FILE) VERSION.x2goagent $(DESTDIR)$(PREFIX)/share/x2go/versions + + $(INSTALL_DIR) $(DESTDIR)$(NXLIBDIR)/bin + $(INSTALL_PROGRAM) nx-X11/programs/nxauth/nxauth $(DESTDIR)$(NXLIBDIR)/bin + $(INSTALL_PROGRAM) nx-X11/programs/Xserver/nxagent $(DESTDIR)$(NXLIBDIR)/bin + + $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/man/man1/ + $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/man/x2goagent.1 $(DESTDIR)$(PREFIX)/share/man/man1/ + $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 $(DESTDIR)$(PREFIX)/share/man/man1/ + $(INSTALL_FILE) nx-X11/programs/nxauth/nxauth.man $(DESTDIR)$(PREFIX)/share/man/man1/ + mv -f $(DESTDIR)$(PREFIX)/share/man/man1/nxauth.man $(DESTDIR)$(PREFIX)/share/man/man1/nxauth.1 + gzip $(DESTDIR)$(PREFIX)/share/man/man1/*.1 + + # create a clean nx-X11/.build-exports space + rm -Rf nx-X11/.build-exports + mkdir -p nx-X11/.build-exports/include + mkdir -p nx-X11/.build-exports/lib + + # copy headers (for libnx-x11-dev) + cp -aL nx-X11/exports/include/* nx-X11/.build-exports/include + + # copy libs (for libnx-x11), we want the targets of the links + . replace.sh; set -x; find nx-X11/exports/lib/ | grep -F ".so" | while read libpath; do \ + libfile=$$(basename $$libpath); \ + libdir=$$(dirname $$libpath); \ + link=$$(readlink $$libpath); \ + \ + mkdir -p "$$(string_rep "$$libdir" exports .build-exports)"; \ + cp -a "$$(string_rep "$$libpath" "$$libfile" "$$link")" "$$(string_rep "$$libdir" exports .build-exports)"; \ + done; + + $(INSTALL_DIR) $(DESTDIR)$(USRLIBDIR) + $(COPY_SYMLINK) nx-X11/.build-exports/lib/*.so* $(DESTDIR)$(USRLIBDIR)/ + + . replace.sh; set -x; find nx-X11/.build-exports/include/ -type d | grep -v "include/X11/bitmaps" | \ + while read dirname; do \ + $(INSTALL_DIR) "$$(string_rep "$$dirname" nx-X11/.build-exports/include "$(DESTDIR)$(INCLUDEDIR)/nx")"; \ + $(INSTALL_FILE) $${dirname}/*.h \ + "$$(string_rep "$$dirname" nx-X11/.build-exports/include "$(DESTDIR)$(INCLUDEDIR)/nx")"/ || true; \ + done; \ + + # Provide means for Xinerama support in NX/X2Go sessions. This + # This also requires two post-install symlinks: + # (DESTDIR)$(NXLIBDIR)/X11/Xinerama/libNX_X11.so.6 -> /usr//libX11.so.6 + # (DESTDIR)$(NXLIBDIR)/X11/Xinerama/libNX_Xext.so.6 -> /usr//libXext.so.6 + $(INSTALL_DIR) $(DESTDIR)$(NXLIBDIR)/X11/Xinerama + $(INSTALL_SYMLINK) $(USRLIBDIR)/libNX_Xinerama.so.1 $(DESTDIR)$(NXLIBDIR)/X11/Xinerama/libXinerama.so.1 + + $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)/nx/X11/bitmaps + $(INSTALL_FILE) nx-X11/.build-exports/include/X11/bitmaps/* \ + $(DESTDIR)$(INCLUDEDIR)/nx/X11/bitmaps/ + + $(INSTALL_DIR) $(DESTDIR)/$(ETCDIR_NX) + $(INSTALL_DIR) $(DESTDIR)/$(ETCDIR_X2GO) + $(INSTALL_FILE) etc/keystrokes.cfg $(DESTDIR)/$(ETCDIR_NX)/ + $(INSTALL_FILE) etc/keystrokes.cfg $(DESTDIR)/$(ETCDIR_X2GO)/ + $(INSTALL_FILE) etc/rgb $(DESTDIR)$(ETCDIR_X2GO)/ + $(INSTALL_FILE) etc/rgb $(DESTDIR)$(ETCDIR_NX)/ + $(INSTALL_FILE) etc/nxagent.keyboard $(DESTDIR)$(ETCDIR_NX)/ + $(INSTALL_FILE) etc/x2goagent.keyboard $(DESTDIR)$(ETCDIR_X2GO)/ + + $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/x2go + $(INSTALL_SYMLINK) $(ETCDIR_X2GO)/rgb $(DESTDIR)$(PREFIX)/share/x2go/rgb + + $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/nx + $(INSTALL_SYMLINK) $(ETCDIR_NX)/rgb $(DESTDIR)$(PREFIX)/share/nx/rgb + +uninstall: + $(MAKE) uninstall-lite + [ ! -d nx-X11 ] || $(MAKE) uninstall-full + +uninstall-lite: + for f in nxproxy; do \ + $(RM_FILE) $(DESTDIR)$(BINDIR)/$$f; done + +uninstall-full: + for f in nxagent nxauth x2goagent; do \ + $(RM_FILE) $(DESTDIR)$(BINDIR)/$$f; done + + $(RM_FILE) $(DESTDIR)$(X2GOLIBDIR)/bin/x2goagent + $(RM_DIR) $(DESTDIR)$(X2GOLIBDIR)/bin/ + + if test -f nxcomp/Makefile; then ${MAKE} -C nxcomp $@; fi + if test -f nxproxy/Makefile; then ${MAKE} -C nxproxy $@; fi + + if test -d nx-X11; then \ + if test -f nxcompext/Makefile; then ${MAKE} -C nxcompext $@; fi; \ + if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad $@; fi; \ + if test -f nx-X11/Makefile; then \ + if test -d $(NXLIBDIR); then rm -rf $(NXLIBDIR); fi; \ + if test -d $(INCLUDEDIR)/nx; then rm -rf $(INCLUDEDIR)/nx; fi; \ + fi; \ + fi diff --git a/debian/Makefile.nx-libs b/debian/Makefile.nx-libs deleted file mode 100644 index 3aeda739b..000000000 --- a/debian/Makefile.nx-libs +++ /dev/null @@ -1,184 +0,0 @@ -#!/usr/bin/make -f - -INSTALL_DIR=install -d -m 755 -INSTALL_FILE=install -m 644 -INSTALL_PROGRAM=install -m 755 -INSTALL_SYMLINK=ln -s -f -COPY_SYMLINK=cp -a -RM_FILE=rm -f -RM_DIR=rmdir -p --ignore-fail-on-non-empty - -ETCDIR_NX ?= /etc/nxagent -ETCDIR_X2GO ?= /etc/x2go -PREFIX ?= /usr/local -BINDIR ?= $(PREFIX)/bin -LIBDIR ?= $(PREFIX)/lib -USRLIBDIR ?= $(LIBDIR) -INCLUDEDIR ?= $(PREFIX)/include -NXLIBDIR ?= $(PREFIX)/lib/nx -X2GOLIBDIR ?= $(PREFIX)/lib/x2go -CONFIGURE ?= ./configure - -SHELL:=/bin/bash - -%: - if test -f nxcomp/Makefile; then ${MAKE} -C nxcomp $@; fi - if test -f nxproxy/Makefile; then ${MAKE} -C nxproxy $@; fi - if test -d nx-X11; then \ - if test -f nxcompext/Makefile; then ${MAKE} -C nxcompext $@; fi; \ - if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad $@; fi; \ - if test -f nx-X11/Makefile; then ${MAKE} -C nx-X11 $@; fi; \ - fi - -all: build - -test: - echo "No testing for NX (redistributed)" - -build-lite: - cd nxcomp && autoconf && (${CONFIGURE}) && ${MAKE} - cd nxproxy && autoconf && (${CONFIGURE}) && ${MAKE} - -build-full: -# in the full case, we rely on "magic" in the nx-X11 imake-based makefiles... - cd nxcomp && autoconf - cd nxcompext && autoconf - cd nxcompshad && autoconf - cd nx-X11 && ${MAKE} World - cd nxproxy && autoconf && (${CONFIGURE}) && ${MAKE} - -build: - if ! test -d nx-X11; then \ - ${MAKE} build-lite; \ - else \ - ${MAKE} build-full; \ - fi - -install: - $(MAKE) install-lite - [ ! -d nx-X11 ] || $(MAKE) install-full - -install-lite: - $(INSTALL_DIR) $(DESTDIR)$(BINDIR) - for d in nxcomp nxproxy; do \ - $(MAKE) -C $$d install; done - mkdir -p $(DESTDIR)$(NXLIBDIR)/bin/ - mv $(DESTDIR)$(BINDIR)/nxproxy $(DESTDIR)$(NXLIBDIR)/bin/ - for f in nxproxy; do \ - $(INSTALL_PROGRAM) bin/$$f $(DESTDIR)$(BINDIR); done - - $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/man/man1/ - $(INSTALL_FILE) nxproxy/man/nxproxy.1 $(DESTDIR)$(PREFIX)/share/man/man1/ - gzip $(DESTDIR)$(PREFIX)/share/man/man1/*.1 - - -install-full: - for f in nxagent nxauth x2goagent; do \ - $(INSTALL_PROGRAM) bin/$$f $(DESTDIR)$(BINDIR); done - for d in nxcompext nxcompshad; do \ - $(MAKE) -C $$d install; done - - $(INSTALL_DIR) $(DESTDIR)$(X2GOLIBDIR)/bin/ - cd $(DESTDIR)$(X2GOLIBDIR)/bin/ && ln -sf $(NXLIBDIR)/bin/nxagent x2goagent - - $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/pixmaps - $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/x2go.xpm $(DESTDIR)$(PREFIX)/share/pixmaps - $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/nxagent.xpm $(DESTDIR)$(PREFIX)/share/pixmaps - - $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/nx - $(INSTALL_FILE) nx-X11/programs/Xserver/Xext/SecurityPolicy $(DESTDIR)$(PREFIX)/share/nx - - $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/x2go/versions - $(INSTALL_FILE) VERSION.x2goagent $(DESTDIR)$(PREFIX)/share/x2go/versions - - $(INSTALL_DIR) $(DESTDIR)$(NXLIBDIR)/bin - $(INSTALL_PROGRAM) nx-X11/programs/nxauth/nxauth $(DESTDIR)$(NXLIBDIR)/bin - $(INSTALL_PROGRAM) nx-X11/programs/Xserver/nxagent $(DESTDIR)$(NXLIBDIR)/bin - - $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/man/man1/ - $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/man/x2goagent.1 $(DESTDIR)$(PREFIX)/share/man/man1/ - $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 $(DESTDIR)$(PREFIX)/share/man/man1/ - $(INSTALL_FILE) nx-X11/programs/nxauth/nxauth.man $(DESTDIR)$(PREFIX)/share/man/man1/ - mv -f $(DESTDIR)$(PREFIX)/share/man/man1/nxauth.man $(DESTDIR)$(PREFIX)/share/man/man1/nxauth.1 - gzip $(DESTDIR)$(PREFIX)/share/man/man1/*.1 - - # create a clean nx-X11/.build-exports space - rm -Rf nx-X11/.build-exports - mkdir -p nx-X11/.build-exports/include - mkdir -p nx-X11/.build-exports/lib - - # copy headers (for libnx-x11-dev) - cp -aL nx-X11/exports/include/* nx-X11/.build-exports/include - - # copy libs (for libnx-x11), we want the targets of the links - . replace.sh; set -x; find nx-X11/exports/lib/ | grep -F ".so" | while read libpath; do \ - libfile=$$(basename $$libpath); \ - libdir=$$(dirname $$libpath); \ - link=$$(readlink $$libpath); \ - \ - mkdir -p "$$(string_rep "$$libdir" exports .build-exports)"; \ - cp -a "$$(string_rep "$$libpath" "$$libfile" "$$link")" "$$(string_rep "$$libdir" exports .build-exports)"; \ - done; - - $(INSTALL_DIR) $(DESTDIR)$(USRLIBDIR) - $(COPY_SYMLINK) nx-X11/.build-exports/lib/*.so* $(DESTDIR)$(USRLIBDIR)/ - - . replace.sh; set -x; find nx-X11/.build-exports/include/ -type d | grep -v "include/X11/bitmaps" | \ - while read dirname; do \ - $(INSTALL_DIR) "$$(string_rep "$$dirname" nx-X11/.build-exports/include "$(DESTDIR)$(INCLUDEDIR)/nx")"; \ - $(INSTALL_FILE) $${dirname}/*.h \ - "$$(string_rep "$$dirname" nx-X11/.build-exports/include "$(DESTDIR)$(INCLUDEDIR)/nx")"/ || true; \ - done; \ - - # Provide means for Xinerama support in NX/X2Go sessions. This - # This also requires two post-install symlinks: - # (DESTDIR)$(NXLIBDIR)/X11/Xinerama/libNX_X11.so.6 -> /usr//libX11.so.6 - # (DESTDIR)$(NXLIBDIR)/X11/Xinerama/libNX_Xext.so.6 -> /usr//libXext.so.6 - $(INSTALL_DIR) $(DESTDIR)$(NXLIBDIR)/X11/Xinerama - $(INSTALL_SYMLINK) $(USRLIBDIR)/libNX_Xinerama.so.1 $(DESTDIR)$(NXLIBDIR)/X11/Xinerama/libXinerama.so.1 - - $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)/nx/X11/bitmaps - $(INSTALL_FILE) nx-X11/.build-exports/include/X11/bitmaps/* \ - $(DESTDIR)$(INCLUDEDIR)/nx/X11/bitmaps/ - - $(INSTALL_DIR) $(DESTDIR)/$(ETCDIR_NX) - $(INSTALL_DIR) $(DESTDIR)/$(ETCDIR_X2GO) - $(INSTALL_FILE) etc/keystrokes.cfg $(DESTDIR)/$(ETCDIR_NX)/ - $(INSTALL_FILE) etc/keystrokes.cfg $(DESTDIR)/$(ETCDIR_X2GO)/ - $(INSTALL_FILE) etc/rgb $(DESTDIR)$(ETCDIR_X2GO)/ - $(INSTALL_FILE) etc/rgb $(DESTDIR)$(ETCDIR_NX)/ - $(INSTALL_FILE) etc/nxagent.keyboard $(DESTDIR)$(ETCDIR_NX)/ - $(INSTALL_FILE) etc/x2goagent.keyboard $(DESTDIR)$(ETCDIR_X2GO)/ - - $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/x2go - $(INSTALL_SYMLINK) $(ETCDIR_X2GO)/rgb $(DESTDIR)$(PREFIX)/share/x2go/rgb - - $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/nx - $(INSTALL_SYMLINK) $(ETCDIR_NX)/rgb $(DESTDIR)$(PREFIX)/share/nx/rgb - -uninstall: - $(MAKE) uninstall-lite - [ ! -d nx-X11 ] || $(MAKE) uninstall-full - -uninstall-lite: - for f in nxproxy; do \ - $(RM_FILE) $(DESTDIR)$(BINDIR)/$$f; done - -uninstall-full: - for f in nxagent nxauth x2goagent; do \ - $(RM_FILE) $(DESTDIR)$(BINDIR)/$$f; done - - $(RM_FILE) $(DESTDIR)$(X2GOLIBDIR)/bin/x2goagent - $(RM_DIR) $(DESTDIR)$(X2GOLIBDIR)/bin/ - - if test -f nxcomp/Makefile; then ${MAKE} -C nxcomp $@; fi - if test -f nxproxy/Makefile; then ${MAKE} -C nxproxy $@; fi - - if test -d nx-X11; then \ - if test -f nxcompext/Makefile; then ${MAKE} -C nxcompext $@; fi; \ - if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad $@; fi; \ - if test -f nx-X11/Makefile; then \ - if test -d $(NXLIBDIR); then rm -rf $(NXLIBDIR); fi; \ - if test -d $(INCLUDEDIR)/nx; then rm -rf $(INCLUDEDIR)/nx; fi; \ - fi; \ - fi diff --git a/debian/Makefile.replace.sh b/debian/Makefile.replace.sh deleted file mode 100644 index 83d6b5b3e..000000000 --- a/debian/Makefile.replace.sh +++ /dev/null @@ -1,51 +0,0 @@ -# from http://mywiki.wooledge.org/BashFAQ/021 - -# The ${a/b/c} substitution is not POSIX compatible. Additionally, in -# bash 3.x, quotes do not escape slashes. This causes screwed up -# installation paths. -# -# SLES 11, bash-3.2-147.9.13 -# $ dirname="foo/bar" -# $ echo ${dirname//"foo/bar"/"omg/nei"} -# bar/omg/nei/bar -# -# openSUSE 12.2, bash-4.2-51.6.1 -# $ dirname="foo/bar" -# $ echo ${dirname//"foo/bar"/"omg/nei"} -# omg/nei -# -# openSUSE 12.2, dash-0.5.7-5.1.2.x86_64 -# $ dirname="foo/bar" -# $ echo ${dirname//"foo/bar"/"omg/nei"} -# dash: 2: Bad substitution -# -# Source this file into your bash scripts to make available -# a replacement (the string_rep function) for this substitution -# mess. -# - -string_rep() -{ - # initialize vars - in=$1 - unset out - - # SEARCH must not be empty - test -n "$2" || return - - while true; do - # break loop if SEARCH is no longer in "$in" - case "$in" in - *"$2"*) : ;; - *) break;; - esac - - # append everything in "$in", up to the first instance of SEARCH, and REP, to "$out" - out=$out${in%%"$2"*}$3 - # remove everything up to and including the first instance of SEARCH from "$in" - in=${in#*"$2"} - done - - # append whatever is left in "$in" after the last instance of SEARCH to out, and print - printf '%s%s\n' "$out" "$in" -} diff --git a/debian/roll-tarballs.sh b/debian/roll-tarballs.sh index 3ff7667f7..02a25dff5 100755 --- a/debian/roll-tarballs.sh +++ b/debian/roll-tarballs.sh @@ -34,7 +34,6 @@ PROJECT="nx-libs" NULL="" test -d .git || usage -test -f debian/Makefile.nx-libs || usage RELEASE="$1" test -n "${RELEASE}" || usage CHECKOUT="$2" @@ -135,10 +134,6 @@ fi mv -v debian/changelog doc/changelog -# copy the top-level makefile if no quilt patch created it before -test -f Makefile || test -f debian/Makefile.nx-libs && cp -v debian/Makefile.nx-libs Makefile -test -f replace.sh || test -f debian/Makefile.replace.sh && cp -v debian/Makefile.replace.sh replace.sh - # remove folders that we do not want to roll into the tarball rm -Rf ".pc/" rm -Rf "debian/" diff --git a/debian/rules b/debian/rules index b38d8a0b6..ad9ddded6 100755 --- a/debian/rules +++ b/debian/rules @@ -23,9 +23,8 @@ override_dh_clean: rm -f doc/changelog rm -f nx-X11/programs/Xserver/hw/nxagent/changelog rm -f nx-X11/programs/nxauth/changelog - if [ ! -f replace.sh ] && [ ! -h replace.sh ]; then ln -s debian/Makefile.replace.sh replace.sh; fi . ./replace.sh; set -x; ls debian/*.install.in | while read file; do rm -f $$(string_rep $$file .install.in .install); done - rm -fR replace.sh Makefile bin etc/rgb VERSION.x2goagent etc/keystrokes.cfg etc/nxagent.keyboard etc/x2goagent.keyboard + rm -fR bin etc/rgb VERSION.x2goagent etc/keystrokes.cfg etc/nxagent.keyboard etc/x2goagent.keyboard rm -f debian/libnx-xinerama1.postinst rm -fR .preserve/ if [ -f nxcomp/.VERSION.NoMachine ]; then mv nxcomp/.VERSION.NoMachine nxcomp/VERSION; fi @@ -98,8 +97,6 @@ override_dh_auto_build: cp -a nx-X11/programs/Xserver/hw/nxagent/CHANGELOG nx-X11/programs/Xserver/hw/nxagent/changelog cp -a nx-X11/programs/nxauth/CHANGELOG nx-X11/programs/nxauth/changelog cp -a nxproxy/CHANGELOG nxproxy/changelog - ln -s debian/Makefile.nx-libs Makefile - ln -s debian/Makefile.replace.sh replace.sh ln -s debian/wrappers bin mkdir -p etc/ ln -s ../debian/keystrokes.cfg etc/keystrokes.cfg diff --git a/nx-libs.spec b/nx-libs.spec index 31887239f..b5ac8d92f 100644 --- a/nx-libs.spec +++ b/nx-libs.spec @@ -665,8 +665,6 @@ mkdir bin/ cp -v debian/wrappers/* bin/ mkdir etc/ cp -v debian/keystrokes.cfg etc/keystrokes.cfg -cp -v debian/Makefile.nx-libs Makefile -cp -v debian/Makefile.replace.sh replace.sh cp -v debian/rgb etc/rgb cp -v debian/nxagent.keyboard etc/nxagent.keyboard cp -v debian/x2goagent.keyboard etc/x2goagent.keyboard diff --git a/replace.sh b/replace.sh new file mode 100644 index 000000000..83d6b5b3e --- /dev/null +++ b/replace.sh @@ -0,0 +1,51 @@ +# from http://mywiki.wooledge.org/BashFAQ/021 + +# The ${a/b/c} substitution is not POSIX compatible. Additionally, in +# bash 3.x, quotes do not escape slashes. This causes screwed up +# installation paths. +# +# SLES 11, bash-3.2-147.9.13 +# $ dirname="foo/bar" +# $ echo ${dirname//"foo/bar"/"omg/nei"} +# bar/omg/nei/bar +# +# openSUSE 12.2, bash-4.2-51.6.1 +# $ dirname="foo/bar" +# $ echo ${dirname//"foo/bar"/"omg/nei"} +# omg/nei +# +# openSUSE 12.2, dash-0.5.7-5.1.2.x86_64 +# $ dirname="foo/bar" +# $ echo ${dirname//"foo/bar"/"omg/nei"} +# dash: 2: Bad substitution +# +# Source this file into your bash scripts to make available +# a replacement (the string_rep function) for this substitution +# mess. +# + +string_rep() +{ + # initialize vars + in=$1 + unset out + + # SEARCH must not be empty + test -n "$2" || return + + while true; do + # break loop if SEARCH is no longer in "$in" + case "$in" in + *"$2"*) : ;; + *) break;; + esac + + # append everything in "$in", up to the first instance of SEARCH, and REP, to "$out" + out=$out${in%%"$2"*}$3 + # remove everything up to and including the first instance of SEARCH from "$in" + in=${in#*"$2"} + done + + # append whatever is left in "$in" after the last instance of SEARCH to out, and print + printf '%s%s\n' "$out" "$in" +} -- cgit v1.2.3