Obsolete
/
packaging
Archived
3
0
Fork 0

--version option added.

master
Luka Vandervelden 2019-08-28 20:25:59 +02:00
parent 8a4946f726
commit aac0eff75f
4 changed files with 22 additions and 4 deletions

View File

@ -1,5 +1,5 @@
PACKAGE = 'package' PACKAGE = 'package'
VERSION = '0.1.0' VERSION = '0.2.0'
PREFIX := /usr/local PREFIX := /usr/local
BINDIR := $(PREFIX)/bin BINDIR := $(PREFIX)/bin
@ -8,6 +8,7 @@ SHAREDIR := $(PREFIX)/share
INCLUDEDIR := $(PREFIX)/include INCLUDEDIR := $(PREFIX)/include
MANDIR := $(SHAREDIR)/man MANDIR := $(SHAREDIR)/man
LIBEXECDIR := $(PREFIX)/libexec LIBEXECDIR := $(PREFIX)/libexec
VERSION := 0.2.0
CC := cc CC := cc
AR := ar AR := ar
@ -20,7 +21,7 @@ Q := @
all: package assemble-apk.sh src/config.cr all: package assemble-apk.sh src/config.cr
@: @:
package: src/main.cr src/config.cr src/context.cr src/instructions.cr src/main.cr src/package.cr src/recipe.cr src/sources.cr src/config.cr package: src/main.cr src/config.cr src/context.cr src/exception.cr src/instructions.cr src/main.cr src/package.cr src/recipe.cr src/sources.cr src/spec.cr src/config.cr
@echo ' CR > package' @echo ' CR > package'
$(Q)crystal src/main.cr -o 'package' $(Q)crystal src/main.cr -o 'package'
@ -53,7 +54,7 @@ assemble-apk.sh.uninstall:
src/config.cr: src/config.cr.in src src/config.cr: src/config.cr.in src
@echo ' SED > src/config.cr' @echo ' SED > src/config.cr'
$(Q)sed -e 's&@PREFIX@&$(PREFIX)&;s&@BINDIR@&$(BINDIR)&;s&@LIBDIR@&$(LIBDIR)&;s&@SHAREDIR@&$(SHAREDIR)&;s&@INCLUDEDIR@&$(INCLUDEDIR)&;s&@MANDIR@&$(MANDIR)&;s&@LIBEXECDIR@&$(LIBEXECDIR)&;' src/config.cr.in > 'src/config.cr' $(Q)sed -e 's&@PREFIX@&$(PREFIX)&;s&@BINDIR@&$(BINDIR)&;s&@LIBDIR@&$(LIBDIR)&;s&@SHAREDIR@&$(SHAREDIR)&;s&@INCLUDEDIR@&$(INCLUDEDIR)&;s&@MANDIR@&$(MANDIR)&;s&@LIBEXECDIR@&$(LIBEXECDIR)&;s&@VERSION@&$(VERSION)&;' src/config.cr.in > 'src/config.cr'
$(Q)chmod +x 'src/config.cr' $(Q)chmod +x 'src/config.cr'
@ -120,11 +121,13 @@ $(PACKAGE)-$(VERSION).tar.gz: distdir
$(Q)tar czf $(PACKAGE)-$(VERSION).tar.gz \ $(Q)tar czf $(PACKAGE)-$(VERSION).tar.gz \
$(PACKAGE)-$(VERSION)/src/config.cr.in \ $(PACKAGE)-$(VERSION)/src/config.cr.in \
$(PACKAGE)-$(VERSION)/src/context.cr \ $(PACKAGE)-$(VERSION)/src/context.cr \
$(PACKAGE)-$(VERSION)/src/exception.cr \
$(PACKAGE)-$(VERSION)/src/instructions.cr \ $(PACKAGE)-$(VERSION)/src/instructions.cr \
$(PACKAGE)-$(VERSION)/src/main.cr \ $(PACKAGE)-$(VERSION)/src/main.cr \
$(PACKAGE)-$(VERSION)/src/package.cr \ $(PACKAGE)-$(VERSION)/src/package.cr \
$(PACKAGE)-$(VERSION)/src/recipe.cr \ $(PACKAGE)-$(VERSION)/src/recipe.cr \
$(PACKAGE)-$(VERSION)/src/sources.cr \ $(PACKAGE)-$(VERSION)/src/sources.cr \
$(PACKAGE)-$(VERSION)/src/spec.cr \
$(PACKAGE)-$(VERSION)/src/config.cr $(PACKAGE)-$(VERSION)/src/config.cr
dist-xz: $(PACKAGE)-$(VERSION).tar.xz dist-xz: $(PACKAGE)-$(VERSION).tar.xz
@ -133,11 +136,13 @@ $(PACKAGE)-$(VERSION).tar.xz: distdir
$(Q)tar cJf $(PACKAGE)-$(VERSION).tar.xz \ $(Q)tar cJf $(PACKAGE)-$(VERSION).tar.xz \
$(PACKAGE)-$(VERSION)/src/config.cr.in \ $(PACKAGE)-$(VERSION)/src/config.cr.in \
$(PACKAGE)-$(VERSION)/src/context.cr \ $(PACKAGE)-$(VERSION)/src/context.cr \
$(PACKAGE)-$(VERSION)/src/exception.cr \
$(PACKAGE)-$(VERSION)/src/instructions.cr \ $(PACKAGE)-$(VERSION)/src/instructions.cr \
$(PACKAGE)-$(VERSION)/src/main.cr \ $(PACKAGE)-$(VERSION)/src/main.cr \
$(PACKAGE)-$(VERSION)/src/package.cr \ $(PACKAGE)-$(VERSION)/src/package.cr \
$(PACKAGE)-$(VERSION)/src/recipe.cr \ $(PACKAGE)-$(VERSION)/src/recipe.cr \
$(PACKAGE)-$(VERSION)/src/sources.cr \ $(PACKAGE)-$(VERSION)/src/sources.cr \
$(PACKAGE)-$(VERSION)/src/spec.cr \
$(PACKAGE)-$(VERSION)/src/config.cr $(PACKAGE)-$(VERSION)/src/config.cr
dist-bz2: $(PACKAGE)-$(VERSION).tar.bz2 dist-bz2: $(PACKAGE)-$(VERSION).tar.bz2
@ -146,15 +151,17 @@ $(PACKAGE)-$(VERSION).tar.bz2: distdir
$(Q)tar cjf $(PACKAGE)-$(VERSION).tar.bz2 \ $(Q)tar cjf $(PACKAGE)-$(VERSION).tar.bz2 \
$(PACKAGE)-$(VERSION)/src/config.cr.in \ $(PACKAGE)-$(VERSION)/src/config.cr.in \
$(PACKAGE)-$(VERSION)/src/context.cr \ $(PACKAGE)-$(VERSION)/src/context.cr \
$(PACKAGE)-$(VERSION)/src/exception.cr \
$(PACKAGE)-$(VERSION)/src/instructions.cr \ $(PACKAGE)-$(VERSION)/src/instructions.cr \
$(PACKAGE)-$(VERSION)/src/main.cr \ $(PACKAGE)-$(VERSION)/src/main.cr \
$(PACKAGE)-$(VERSION)/src/package.cr \ $(PACKAGE)-$(VERSION)/src/package.cr \
$(PACKAGE)-$(VERSION)/src/recipe.cr \ $(PACKAGE)-$(VERSION)/src/recipe.cr \
$(PACKAGE)-$(VERSION)/src/sources.cr \ $(PACKAGE)-$(VERSION)/src/sources.cr \
$(PACKAGE)-$(VERSION)/src/spec.cr \
$(PACKAGE)-$(VERSION)/src/config.cr $(PACKAGE)-$(VERSION)/src/config.cr
help: help:
@echo ' :: package-0.1.0' @echo ' :: package-0.2.0'
@echo '' @echo ''
@echo 'Generic targets:' @echo 'Generic targets:'
@echo ' - help  Prints this help message.' @echo ' - help  Prints this help message.'
@ -176,6 +183,7 @@ help:
@echo ' - INCLUDEDIR  ${INCLUDEDIR}' @echo ' - INCLUDEDIR  ${INCLUDEDIR}'
@echo ' - MANDIR  ${MANDIR}' @echo ' - MANDIR  ${MANDIR}'
@echo ' - LIBEXECDIR  ${LIBEXECDIR}' @echo ' - LIBEXECDIR  ${LIBEXECDIR}'
@echo ' - VERSION  ${VERSION}'
@echo '' @echo ''
@echo 'Project targets: ' @echo 'Project targets: '
@echo ' - package  crystal' @echo ' - package  crystal'

View File

@ -4,6 +4,7 @@ version=0.2.0
variables+=( variables+=(
LIBEXECDIR '$(PREFIX)/libexec' LIBEXECDIR '$(PREFIX)/libexec'
VERSION "$version"
) )
targets=(package assemble-apk.sh) targets=(package assemble-apk.sh)

View File

@ -2,3 +2,7 @@
# These values are changed by `make` at build-time. # These values are changed by `make` at build-time.
OWN_LIBEXEC_DIR = "@LIBEXECDIR@/package" OWN_LIBEXEC_DIR = "@LIBEXECDIR@/package"
module Package
Version = "@VERSION@"
end

View File

@ -42,6 +42,11 @@ OptionParser.parse! do |parser|
exit 0 exit 0
} }
parser.on("-V", "--version", "Prints package's version and exits.") {
puts Package::Version
exit 0
}
parser.invalid_option do |flag| parser.invalid_option do |flag|
STDERR.puts "ERROR: #{flag} is not a valid option." STDERR.puts "ERROR: #{flag} is not a valid option."
STDERR.puts parser STDERR.puts parser