Dear Christian,

I recommend this style for now as the default binary package
for GNU/Linux operating systems. It would also work well for BSD-derived
operating systems. You probably weren't asking about Android, but since
that also uses Linux, I note that I don't know whether this is how one
installs software on Android.

I propose three alternative routines for preparing the package.

1. We can use the previously linked (and now attached) "build" file
   at the end of the build process. It relies on the basex zip package 
   and on some Unix-style utilities. I am happy to be the one to run it.
2. I can assist a BaseX developer in rewriting my packaging utility with
   maven and Java in a way that will run on Windows. It would still
   be run at the end of the build process, after the zip file.
3. If someone documents how to build BaseX with command-line utilities,
   that is, without Eclipse, I will look into packaging the whole build
   process for Unix-like operating systems.

Option three is best. It is best because only this option produces
a source package that can be built on Unix-like operating systems
in a conventional way.

Options one and two are still good because they at least produce
a convenient binary package.

Please receive my sincere salutations.
Kralj Karlo
#!/bin/sh
set -e
VERSION="$1"
test -n "$VERSION" || exit 1

dist="dist/basex-$VERSION"
src="release/BaseX943.zip"
dest="$dist/lib/basex-${VERSION}"
if ! test -d "$dest"; then
  tmp="$(mktemp -d)"
  mkdir -p "$(dirname "$dest")"
  unzip -d "$tmp" "$src"
  mv "$tmp/basex/" "$dest"
  rm -r "$tmp"
fi

printf '.PHONY: all install clean
VERSION = %s
PREFIX ?= /usr/local

bin = bin/basex bin/basexclient bin/basexgui bin/basexhttp bin/basexhttpstop bin/basexserver bin/basexserverstop
wrapped_noprefix = libexec/basex-$(VERSION)/basex
wrapped = $(PREFIX)/$(wrapped_noprefix)

all: $(bin) $(wrapped_noprefix)
clean:
	rm -rf bin libexec
install: $(bin) $(wrapped_noprefix)
	mkdir -p $(PREFIX)/bin $(PREFIX)/lib/basex-$(VERSION) $(PREFIX)/libexec/basex-$(VERSION)
	install bin/* $(PREFIX)/bin/
	install libexec/basex-$(VERSION)/* $(PREFIX)/libexec/basex-$(VERSION)/
	rm -Rf $(PREFIX)/lib/basex-$(VERSION)
	cp -R lib/basex-$(VERSION) $(PREFIX)/lib/basex-$(VERSION)

$(wrapped_noprefix):
	mkdir -p "$$(dirname "$@")"
	sed [email protected]@$(PREFIX)@ basex.template > $@
bin:
	mkdir -p $@
bin/basex: bin
	echo $(wrapped) org.basex.BaseX "$$@" > $@
bin/basexclient: bin
	echo $(wrapped) org.basex.BaseXClient "$$@" > $@
bin/basexgui: bin
	echo $(wrapped) org.basex.BaseXGUI "$$@" > $@
bin/basexhttp: bin
	echo $(wrapped) org.basex.BaseXHTTP "$$@" > $@
bin/basexhttpstop: bin
	echo $(wrapped) org.basex.BaseXHTTP "$$@" stop > $@
bin/basexserver: bin
	echo $(wrapped) org.basex.BaseXServer "$$@" > $@
bin/basexserverstop: bin
	echo $(wrapped) org.basex.BaseXServer "$$@" stop > $@
' "${VERSION}" > "$dist/Makefile"

mkdir -p "$dist/libexec/basex-${VERSION}"
printf '#!/bin/sh
MAIN=$PREFIX/lib/basex-%s
CP="$MAIN/BaseX.jar:$MAIN/lib/custom/*:$MAIN/lib/*:$CLASSPATH"
BASEX_JVM="-Xmx2g $BASEX_JVM"
exec java -cp "$CP" $BASEX_JVM "$@"
' "${VERSION}" > "$dist/basex.template"

echo 'WELCOME! ---------------------------------------------------------------

BaseX is a light-weight, high-performance and scalable XML Database
engine and XPath/XQuery 3.1 Processor, which includes full support for
the W3C Update and Full Text extensions. An interactive and user-
friendly GUI frontend gives you great insight into your XML documents.

INSTALL ----------------------------------------------------------------

Build and install like this.

  make
  make install

Some configuration possibilities are documented below.

The above will install to the prefix /usr/local. You can set
a different prefix. For example

  make clean
  make PREFIX=/usr
  make PREFIX=/usr install

Since the java executable is sometimes installed in an unconventional
directory, you might want to set the path to the executable rather than
relying on it being in the PATH. 

  sed -i s@java@/usr/local/jdk-11/bin/java@ basex.template
  make clean install

HELP -------------------------------------------------------------------

 Please find more help in our online documentation:

   http://docs.basex.org

 BaseX is an Open Source project and BSD-licensed. You are welcome
 to join our basex-talk mailing list and give all kinds of feedback:

   http://basex.org/open-source

 You may as fork our BaseX repository and send pull requests:

   https://github.com/BaseXdb/BaseX/issues

 Have fun,
 Your BaseX Team

------------------------------------------------------------------------
' > "$dist/README"

cd dist
tar czf "basex-$VERSION.tar.gz" "basex-$VERSION"

Reply via email to