Commit 9727bd20 authored by Marcellus Siegburg's avatar Marcellus Siegburg
Browse files

Fix building of distribution

parent 20d52911
......@@ -75,7 +75,7 @@ else
export BASETRUNKDIR = $(ROOT)/base-trunk
export CURRYTOOLSDIR = # not used
endif
export BASELIBDIR = $(BASETRUNKDIR)/src
BASELIBDIR := $(realpath $(BASETRUNKDIR)/src)
# binary directory and executables
export BINDIR=$(ROOT)/bin
......@@ -86,9 +86,7 @@ export LIBDIR = $(ROOT)/lib
# Directory where the documentation files are located
export DOCDIR = $(ROOT)/docs
# The version number of the base libraries:
BASEPACKAGEFILE = $(BASETRUNKDIR)/package.json
BASEVERSION := $(shell grep '"version":' $(BASEPACKAGEFILE) | grep -Eo "[0-9][^\"]+")
BASEVERSIONFILE = $(LIBDIR)/VERSION
# Executable of CurryCheck:
CURRYCHECK := $(shell which curry-check)
......@@ -98,9 +96,9 @@ CURRYDOC := $(shell which curry-doc)
MD2PDF := $(shell which md2pdf)
# The version information file for PAKCS:
PAKCSVERSION=$(ROOT)/src/pakcsversion.pl
PAKCSVERSION = $(ROOT)/src/pakcsversion.pl
# The version information file for the manual:
MANUALVERSION=$(DOCDIR)/src/version.tex
MANUALVERSION = $(DOCDIR)/src/version.tex
# Various executables used in the installation
# --------------------------------------------
......@@ -256,7 +254,7 @@ manual:
fi
# Create file with version information for PAKCS:
$(PAKCSVERSION): Makefile $(BASEPACKAGEFILE)
$(PAKCSVERSION): Makefile $(BASEVERSIONFILE)
echo ':- module(pakcsversion,[compilerVersion/1, compilerMajorVersion/1, compilerMinorVersion/1, compilerRevisionVersion/1, buildVersion/1, buildDate/1, buildDir/1, pkgInstallDir/1, baseVersion/1]).' > $@
echo "compilerVersion('PAKCS$(MAJORVERSION).$(MINORVERSION)')." >> $@
echo 'compilerMajorVersion($(MAJORVERSION)).' >> $@
......@@ -361,95 +359,55 @@ cleanall: clean
fi
rm -f pakcsinitrc pakcsinitrc.bak
################################DISTRIBUTION##################################
# Create distribution versions of the complete system as tar files
# pakcs*.tar.gz:
# directory name of distribution
FULLNAME = pakcs-$(VERSION)
# temporary directory to create distribution version
PAKCSDIST = $(FULLNAME)
# architecture name
ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH)-$(shell uname -s)
# Files to be excluded for source distribution
SRC_EXCLUDE = --exclude=bin
# Files to be excluded for binary distribution
BIN_EXCLUDE = --exclude=frontend
# date of distribution
DIST_DATE = $(shell date +%Y%m%d)
.PHONY: dist
dist:
rm -rf pakcs*.tar.gz $(PAKCSDIST) # remove any old distribution
git clone . $(PAKCSDIST) # create copy of git version
cd $(PAKCSDIST) && git submodule init && git submodule update
cd $(PAKCSDIST) && $(MAKE) copylibs
cd $(PAKCSDIST) && $(MAKE) cleandist # delete unnessary files
mkdir -p $(PAKCSDIST)/bin && cp -p $(CYMAKE) $(PAKCSDIST)/bin
@if [ -f docs/Manual.pdf ] ; then cp -p docs/Manual.pdf docs/markdown_syntax.html $(PAKCSDIST)/docs ; fi
cat Makefile | sed -e "/#DISTRIBUTION#/,\$$d" \
| sed 's|^COMPILERDATE *:=.*$$|COMPILERDATE =$(COMPILERDATE)|' \
> $(PAKCSDIST)/Makefile
tar cfvz $(FULLNAME)-src.tar.gz $(SRC_EXCLUDE) $(PAKCSDIST)
tar cfvz $(FULLNAME)-$(ARCH).tar.gz $(BIN_EXCLUDE) $(PAKCSDIST)
rm -rf $(PAKCSDIST)
@echo "----------------------------------------------------------------"
@echo "Distribution files pakcs*.tar.gz generated."
.PHONY: distdated
distdated: dist
mv $(FULLNAME)-src.tar.gz $(FULLNAME)-$(DIST_DATE)-src.tar.gz
mv $(FULLNAME)-$(ARCH).tar.gz $(FULLNAME)-$(DIST_DATE)-$(ARCH).tar.gz
# Clean all files that should not be included in a distribution
.PHONY: cleandist
cleandist:
rm -rf .git .gitmodules .gitignore
rm -rf $(BASELIBDIR)
rm -rf currytools/.git currytools/.gitignore
rm -f currytools/download_tools.sh
cd $(FRONTENDDIR)/curry-base && rm -rf .git .gitignore dist
cd $(FRONTENDDIR)/curry-frontend && rm -rf .git .gitignore dist
rm -rf docs/src
rm -rf debian
rm -f KNOWN_BUGS CHANGELOG.html
##########################################################################
### PART: Copylibs ###
##########################################################################
CURRY_FILES :=$(shell cd $(BASELIBDIR) && find * -name "*.curry")
LIB_CURRY_FILES = $(addprefix $(LIBDIR)/,$(CURRY_FILES))
MODULE_FOLDERS :=$(addprefix $(LIBDIR)/,$(shell cd $(BASELIBDIR) && find * -type d))
LIB_CURRY_FILES :=$(addprefix $(LIBDIR)/,$(CURRY_FILES))
PAKCS_FILES :=$(addprefix $(LIBDIR)/,$(shell cd $(BASELIBDIR) && find * -name "*.pakcs"))
PAKCS_CURRY_FILES :=$(addsuffix .curry, $(basename $(PAKCS_FILES)))
NON_PAKCS_BASENAMES=$(basename $(filter-out $(CURRY_PAKCS_FILES), $(LIB_CURRY_FILES)))
CURRYONLY_FILES =$(addsuffix .curry, $(filter-out $(basename $(PAKCS_FILES)), $(NON_PAKCS_BASENAMES)))
# Install the library sources into the $(LIBDIR), if there is a $(BASELIBDIR);
# Search all curry files in the $(LIBDIR), otherwise.
ifdef BASELIBDIR
CURRY_FILES := $(shell cd $(BASELIBDIR) && find * -name "*.curry")
MODULE_FOLDERS := $(addprefix $(LIBDIR)/,$(shell cd $(BASELIBDIR) && find * -type d))
PAKCS_FILES := $(addprefix $(LIBDIR)/,$(shell cd $(BASELIBDIR) && find * -name "*.pakcs"))
PAKCS_CURRY_FILES := $(addsuffix .curry, $(basename $(PAKCS_FILES)))
NON_PAKCS_BASENAMES = $(basename $(filter-out $(PAKCS_CURRY_FILES), $(LIB_CURRY_FILES)))
CURRYONLY_FILES = $(addsuffix .curry, $(filter-out $(basename $(PAKCS_FILES)), $(NON_PAKCS_BASENAMES)))
# Install the library sources into the Curry system library directory:
copylibs: | copylib-folders copylib-files
copylibs: | copylib-folders copylib-files
copylib-folders: $(LIBDIR) $(MODULE_FOLDERS)
copylib-folders: $(LIBDIR) $(MODULE_FOLDERS)
copylib-files: $(CURRYONLY_FILES) $(PAKCS_CURRY_FILES)
copylib-files: $(CURRYONLY_FILES) $(PAKCS_CURRY_FILES) $(BASEVERSIONFILE)
$(LIBDIR):
$(LIBDIR): $(BASELIBDIR)
mkdir -p $@
$(MODULE_FOLDERS): $(LIBDIR)/%: $(BASELIBDIR)/%
$(MODULE_FOLDERS): $(LIBDIR)/%: $(BASELIBDIR)/%
mkdir -p $@
$(CURRYONLY_FILES): $(LIBDIR)/%.curry: $(BASELIBDIR)/%.curry
$(CURRYONLY_FILES): $(LIBDIR)/%.curry: $(BASELIBDIR)/%.curry
cp $< $@
$(PAKCS_FILES): $(LIBDIR)/%.pakcs: $(BASELIBDIR)/%.pakcs
$(PAKCS_FILES): $(LIBDIR)/%.pakcs: $(BASELIBDIR)/%.pakcs
cp $< $@
$(PAKCS_CURRY_FILES): $(LIBDIR)/%.curry: $(BASELIBDIR)/%.curry $(LIBDIR)/%.pakcs
$(PAKCS_CURRY_FILES): $(LIBDIR)/%.curry: $(BASELIBDIR)/%.curry $(LIBDIR)/%.pakcs
cp $< $@
# The version number of the base libraries:
BASEPACKAGEFILE = $(BASETRUNKDIR)/package.json
BASEVERSION := $(shell grep '"version":' $(BASEPACKAGEFILE) | grep -Eo "[0-9][^\"]+")
$(BASEVERSIONFILE): $(BASEPACKAGEFILE)
echo $(BASEVERSION) > $@
else
CURRY_FILES := $(shell cd $(LIBDIR) && find * -name "*.curry")
BASEVERSION := $(shell cat $(BASEVERSIONFILE))
copylibs: $(LIBDIR)
endif
##########################################################################
### PART: Compile System Libraries and Generate Documentation ###
##########################################################################
......@@ -586,3 +544,56 @@ $(TEXDOCDIR)/$1.tex: $(LIBDIR)/$(subst .,/,$1).curry
endef
$(foreach module, $(LIB_NAMES),$(eval $(call TEXRULE,$(module))))
################################DISTRIBUTION##################################
# Create distribution versions of the complete system as tar files
# pakcs*.tar.gz:
# directory name of distribution
FULLNAME = pakcs-$(VERSION)
# temporary directory to create distribution version
PAKCSDIST = $(FULLNAME)
# architecture name
ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH)-$(shell uname -s)
# Files to be excluded for source distribution
SRC_EXCLUDE = --exclude=bin
# Files to be excluded for binary distribution
BIN_EXCLUDE = --exclude=frontend
# date of distribution
DIST_DATE = $(shell date +%Y%m%d)
.PHONY: dist
dist:
rm -rf pakcs*.tar.gz $(PAKCSDIST) # remove any old distribution
git clone . $(PAKCSDIST) # create copy of git version
cd $(PAKCSDIST) && git submodule init && git submodule update
cd $(PAKCSDIST) && $(MAKE) copylibs
cd $(PAKCSDIST) && $(MAKE) cleandist # delete unnessary files
mkdir -p $(PAKCSDIST)/bin && cp -p $(CYMAKE) $(PAKCSDIST)/bin
@if [ -f docs/Manual.pdf ] ; then cp -p docs/Manual.pdf docs/markdown_syntax.html $(PAKCSDIST)/docs ; fi
cat Makefile | sed -e "/#DISTRIBUTION#/,\$$d" \
| sed 's|^COMPILERDATE *:=.*$$|COMPILERDATE =$(COMPILERDATE)|' \
> $(PAKCSDIST)/Makefile
tar cfvz $(FULLNAME)-src.tar.gz $(SRC_EXCLUDE) $(PAKCSDIST)
tar cfvz $(FULLNAME)-$(ARCH).tar.gz $(BIN_EXCLUDE) $(PAKCSDIST)
rm -rf $(PAKCSDIST)
@echo "----------------------------------------------------------------"
@echo "Distribution files pakcs*.tar.gz generated."
.PHONY: distdated
distdated: dist
mv $(FULLNAME)-src.tar.gz $(FULLNAME)-$(DIST_DATE)-src.tar.gz
mv $(FULLNAME)-$(ARCH).tar.gz $(FULLNAME)-$(DIST_DATE)-$(ARCH).tar.gz
# Clean all files that should not be included in a distribution
.PHONY: cleandist
cleandist:
rm -rf .git .gitmodules .gitignore
rm -rf $(BASETRUNKDIR)
rm -rf currytools/.git currytools/.gitignore
rm -f currytools/download_tools.sh
cd $(FRONTENDDIR)/curry-base && rm -rf .git .gitignore dist
cd $(FRONTENDDIR)/curry-frontend && rm -rf .git .gitignore dist
rm -rf docs/src
rm -rf debian
rm -f KNOWN_BUGS CHANGELOG.html
......@@ -72,7 +72,7 @@ swi.state: prologbasics.pl basics.pl version.pl loader.pl evaluator.pl c2p.pl \
echo "compile(c2p). c2p('$(LIBDIR)/Prelude'), compile('$(LIBDIR)/.curry/pakcs/Prelude'),loader:loadAndCompile('$(LIBDIR)/.curry/pakcs/Prelude.pl',[],create). saveprog_entry('swi.state',user:pakcsMain)." | "$(SWI)" $(SWIOPTIONS)
$(LIBDIR)/.curry/Prelude.fcy: $(LIBDIR)/Prelude.curry
cd $(LIBDIR) && $(MAKE) .curry/Prelude.fcy
cd $(ROOT) && $(MAKE) $(LIBDIR)/.curry/Prelude.fcy
#
# generate correct versions of run-time libraries for SWI-Prolog
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment