docs
[pspp] / Smake
diff --git a/Smake b/Smake
index acd93102be0632c517e739bfa116cbe2c8e5a5eb..3e63d869a7aaa07048cae896ae4065a0c26f7f3e 100644 (file)
--- a/Smake
+++ b/Smake
@@ -1,5 +1,25 @@
 # -*- makefile -*-
 
+# PSPP - a program for statistical analysis.
+# Copyright (C) 2017 Free Software Foundation, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+
+all: everything
+
 # Adjust these to reflect where you've installed gnulib.
 GNULIB = ../gnulib
 GNULIB_TOOL = $(GNULIB)/gnulib-tool
@@ -7,22 +27,27 @@ GNULIB_TOOL = $(GNULIB)/gnulib-tool
 GNULIB_MODULES = \
        assert \
        byteswap \
+       c-snprintf \
        c-strcase \
        c-strcasestr \
        c-ctype \
        c-strtod \
+       c-xvasprintf \
        clean-temp \
        close \
        configmake \
        count-one-bits \
+       count-leading-zeros \
        crc \
        crypto/md4 \
-       crypto/md5 \
+       crypto/rijndael \
        dirname \
        dtoastr \
+       dtotimespec \
        environ \
        fatal-signal \
        fcntl \
+       fnmatch \
        fpieee \
        fprintf-posix \
        full-read \
@@ -31,10 +56,14 @@ GNULIB_MODULES = \
         ftello \
        fwriteerror \
        getline \
-       gettext \
+       getpass \
+       gettext-h \
+       gettime \
        gettimeofday \
         getopt-gnu \
        gitlog-to-changelog \
+       havelib \
+       iconv \
        include_next \
        isfinite \
        isinf \
@@ -42,15 +71,19 @@ GNULIB_MODULES = \
        intprops \
        inttostr \
        localcharset \
+       localename \
         mbchar \
         mbiter \
        memcasecmp \
        memchr \
+       memchr2 \
+       memmem \
        mempcpy \
        memrchr \
        minmax \
        mkdtemp \
        mkstemp \
+       pipe2 \
        printf-posix \
        printf-safe \
        progname \
@@ -60,25 +93,37 @@ GNULIB_MODULES = \
        relocatable-prog \
        rename \
        round \
+       select \
        snprintf \
        snprintf-posix \
        sprintf-posix \
        stdarg \
        stdbool \
        stdint \
+       strcasestr \
        stpcpy \
        strerror \
-       strftime \
+       nstrftime \
+       strsep \
        strtod \
        strtok_r \
        sys_stat \
        tempname \
+       termios \
+       timespec \
+       timespec-add \
+       timespec-sub \
        trunc \
+       unicase/u8-casecmp \
+       unicase/u8-casefold \
+       unicase/u8-tolower \
+       unicase/u8-toupper \
+       unicase/u8-totitle \
        unictype/ctype-print \
-       unictype/property-id-continue \
-       unictype/property-id-start \
+       unictype/category-of \
        unigbrk/uc-is-grapheme-break \
        unilbrk/u8-possible-linebreaks \
+       uninorm/nfkd \
        unistd \
        unistr/u8-check \
        unistr/u8-cpy \
@@ -93,6 +138,7 @@ GNULIB_MODULES = \
        unitypes \
        unlocked-io \
        vasprintf-posix \
+       verify \
        version-etc \
        version-etc-fsf \
        vfprintf-posix \
@@ -102,28 +148,220 @@ GNULIB_MODULES = \
        vsprintf-posix \
        xalloc \
        xalloc-die \
+       xbinary-io \
        xmalloca \
        xmemdup0 \
        xsize \
        xstrndup \
        xvasprintf
 
-all: 
+APP_ICONS = \
+src/ui/gui/icons/16x16/apps/org.fsf.pspp.png \
+src/ui/gui/icons/32x32/apps/org.fsf.pspp.png \
+src/ui/gui/icons/48x48/apps/org.fsf.pspp.png \
+src/ui/gui/icons/256x256/apps/org.fsf.pspp.png \
+src/ui/gui/icons/scalable/apps/org.fsf.pspp.svg
+
+CATEGORY_ICONS = \
+src/ui/gui/icons/48x48/categories/align-left.png \
+src/ui/gui/icons/48x48/categories/align-center.png \
+src/ui/gui/icons/48x48/categories/align-right.png \
+src/ui/gui/icons/48x48/categories/measure-scale.png \
+src/ui/gui/icons/48x48/categories/measure-ordinal.png \
+src/ui/gui/icons/48x48/categories/measure-nominal.png \
+src/ui/gui/icons/48x48/categories/measure-date-scale.png \
+src/ui/gui/icons/48x48/categories/measure-date-nominal.png \
+src/ui/gui/icons/48x48/categories/measure-date-ordinal.png \
+src/ui/gui/icons/48x48/categories/measure-time-scale.png \
+src/ui/gui/icons/48x48/categories/measure-time-nominal.png \
+src/ui/gui/icons/48x48/categories/measure-time-ordinal.png \
+src/ui/gui/icons/48x48/categories/measure-string-nominal.png \
+src/ui/gui/icons/48x48/categories/measure-string-ordinal.png \
+src/ui/gui/icons/48x48/categories/measure-currency-scale.png \
+src/ui/gui/icons/48x48/categories/measure-currency-nominal.png \
+src/ui/gui/icons/48x48/categories/measure-currency-ordinal.png \
+src/ui/gui/icons/48x48/categories/role-input.png \
+src/ui/gui/icons/48x48/categories/role-target.png \
+src/ui/gui/icons/48x48/categories/role-both.png \
+src/ui/gui/icons/48x48/categories/role-none.png \
+src/ui/gui/icons/48x48/categories/role-partition.png \
+src/ui/gui/icons/48x48/categories/role-split.png \
+src/ui/gui/icons/scalable/categories/align-left.svg \
+src/ui/gui/icons/scalable/categories/align-center.svg \
+src/ui/gui/icons/scalable/categories/align-right.svg \
+src/ui/gui/icons/scalable/categories/measure-scale.svg \
+src/ui/gui/icons/scalable/categories/measure-ordinal.svg \
+src/ui/gui/icons/scalable/categories/measure-nominal.svg \
+src/ui/gui/icons/scalable/categories/measure-date-scale.svg \
+src/ui/gui/icons/scalable/categories/measure-date-nominal.svg \
+src/ui/gui/icons/scalable/categories/measure-date-ordinal.svg \
+src/ui/gui/icons/scalable/categories/measure-time-scale.svg \
+src/ui/gui/icons/scalable/categories/measure-time-nominal.svg \
+src/ui/gui/icons/scalable/categories/measure-time-ordinal.svg \
+src/ui/gui/icons/scalable/categories/measure-string-nominal.svg \
+src/ui/gui/icons/scalable/categories/measure-string-ordinal.svg \
+src/ui/gui/icons/scalable/categories/measure-currency-scale.svg \
+src/ui/gui/icons/scalable/categories/measure-currency-nominal.svg \
+src/ui/gui/icons/scalable/categories/measure-currency-ordinal.svg \
+src/ui/gui/icons/scalable/categories/role-input.svg \
+src/ui/gui/icons/scalable/categories/role-target.svg \
+src/ui/gui/icons/scalable/categories/role-both.svg \
+src/ui/gui/icons/scalable/categories/role-none.svg \
+src/ui/gui/icons/scalable/categories/role-partition.svg \
+src/ui/gui/icons/scalable/categories/role-split.svg
+
+# Mimetype icons have size dependent layouts
+MIMETYPE_ICONS = \
+src/ui/gui/icons/16x16/mimetypes/application-x-spss-por.png \
+src/ui/gui/icons/16x16/mimetypes/application-x-spss-sav.png \
+src/ui/gui/icons/16x16/mimetypes/application-x-spss-sps.png \
+src/ui/gui/icons/16x16/mimetypes/application-x-spss-zsav.png \
+src/ui/gui/icons/22x22/mimetypes/application-x-spss-por.png \
+src/ui/gui/icons/22x22/mimetypes/application-x-spss-sav.png \
+src/ui/gui/icons/22x22/mimetypes/application-x-spss-sps.png \
+src/ui/gui/icons/22x22/mimetypes/application-x-spss-zsav.png \
+src/ui/gui/icons/24x24/mimetypes/application-x-spss-por.png \
+src/ui/gui/icons/24x24/mimetypes/application-x-spss-sav.png \
+src/ui/gui/icons/24x24/mimetypes/application-x-spss-sps.png \
+src/ui/gui/icons/24x24/mimetypes/application-x-spss-zsav.png \
+src/ui/gui/icons/32x32/mimetypes/application-x-spss-por.png \
+src/ui/gui/icons/32x32/mimetypes/application-x-spss-sav.png \
+src/ui/gui/icons/32x32/mimetypes/application-x-spss-sps.png \
+src/ui/gui/icons/32x32/mimetypes/application-x-spss-zsav.png \
+src/ui/gui/icons/48x48/mimetypes/application-x-spss-por.png \
+src/ui/gui/icons/48x48/mimetypes/application-x-spss-sav.png \
+src/ui/gui/icons/48x48/mimetypes/application-x-spss-sps.png \
+src/ui/gui/icons/48x48/mimetypes/application-x-spss-zsav.png \
+src/ui/gui/icons/256x256/mimetypes/application-x-spss-por.png \
+src/ui/gui/icons/256x256/mimetypes/application-x-spss-sav.png \
+src/ui/gui/icons/256x256/mimetypes/application-x-spss-sps.png \
+src/ui/gui/icons/256x256/mimetypes/application-x-spss-zsav.png
+
+src/ui/gui/artwork/splash-t.svg: src/ui/gui/artwork/splash.svg
+       cp $< $@
+
+src/ui/gui/artwork/splash-r.svg: src/ui/gui/artwork/splash.svg
+       sed -e '/inkscape:label="Overlay"/s/inline/none/' $< > $@
+
+MISC_ICONS = src/ui/gui/icons/splash-t.png \
+       src/ui/gui/icons/splash-r.png
+
+ACTION_ICONS = \
+src/ui/gui/icons/24x24/actions/pspp-file-open-data.png \
+src/ui/gui/icons/24x24/actions/pspp-file-save-data.png \
+src/ui/gui/icons/24x24/actions/pspp-edit-go-to-variable.png \
+src/ui/gui/icons/24x24/actions/pspp-edit-go-to-case.png \
+src/ui/gui/icons/24x24/actions/pspp-edit-find.png \
+src/ui/gui/icons/24x24/actions/pspp-edit-insert-case.png \
+src/ui/gui/icons/24x24/actions/pspp-edit-insert-variable.png \
+src/ui/gui/icons/24x24/actions/pspp-data-split-file.png \
+src/ui/gui/icons/24x24/actions/pspp-data-weight-cases.png \
+src/ui/gui/icons/24x24/actions/pspp-view-value-labels.png \
+src/ui/gui/icons/48x48/actions/pspp-file-open-data.png \
+src/ui/gui/icons/48x48/actions/pspp-file-save-data.png \
+src/ui/gui/icons/48x48/actions/pspp-edit-go-to-variable.png \
+src/ui/gui/icons/48x48/actions/pspp-edit-go-to-case.png \
+src/ui/gui/icons/48x48/actions/pspp-edit-find.png \
+src/ui/gui/icons/48x48/actions/pspp-edit-insert-case.png \
+src/ui/gui/icons/48x48/actions/pspp-edit-insert-variable.png \
+src/ui/gui/icons/48x48/actions/pspp-data-split-file.png \
+src/ui/gui/icons/48x48/actions/pspp-data-weight-cases.png \
+src/ui/gui/icons/48x48/actions/pspp-view-value-labels.png \
+src/ui/gui/icons/96x96/actions/pspp-file-open-data.png \
+src/ui/gui/icons/96x96/actions/pspp-file-save-data.png \
+src/ui/gui/icons/96x96/actions/pspp-edit-go-to-variable.png \
+src/ui/gui/icons/96x96/actions/pspp-edit-go-to-case.png \
+src/ui/gui/icons/96x96/actions/pspp-edit-find.png \
+src/ui/gui/icons/96x96/actions/pspp-edit-insert-case.png \
+src/ui/gui/icons/96x96/actions/pspp-edit-insert-variable.png \
+src/ui/gui/icons/96x96/actions/pspp-data-split-file.png \
+src/ui/gui/icons/96x96/actions/pspp-data-weight-cases.png \
+src/ui/gui/icons/96x96/actions/pspp-view-value-labels.png \
+src/ui/gui/icons/scalable/actions/pspp-file-open-data.svg \
+src/ui/gui/icons/scalable/actions/pspp-file-save-data.svg \
+src/ui/gui/icons/scalable/actions/pspp-edit-go-to-variable.svg \
+src/ui/gui/icons/scalable/actions/pspp-edit-go-to-case.svg \
+src/ui/gui/icons/scalable/actions/pspp-edit-find.svg \
+src/ui/gui/icons/scalable/actions/pspp-edit-insert-case.svg \
+src/ui/gui/icons/scalable/actions/pspp-edit-insert-variable.svg \
+src/ui/gui/icons/scalable/actions/pspp-data-split-file.svg \
+src/ui/gui/icons/scalable/actions/pspp-data-weight-cases.svg \
+src/ui/gui/icons/scalable/actions/pspp-view-value-labels.svg
+
+ICONS=$(CATEGORY_ICONS) $(ACTION_ICONS) $(MIMETYPE_ICONS) $(APP_ICONS) $(MISC_ICONS)
+
+ICON_SOURCES = $(wildcard src/ui/gui/artwork/*/*/*.svg)
+ICON_SOURCES += $(wildcard src/ui/gui/artwork/splash*.svg)
+
+everything: prep_ph  icons
+       $(MAKE) -f Smake Makefile.in configure
+
+icons: $(ICONS)
+clean-icons:
+       rm -f $(ICONS)
+.PHONY: icons clean-icons
+
+src/ui/gui/icons/manifest: $(MAKEFILE_LIST)
+       $(RM) $@
+       printf '# This is a generated file. Do not edit.\n' >> $@
+       printf 'icons =' >> $@
+       for i in  $(ICONS); do \
+               printf ' \\\n\t '$$i >> $@; \
+       done
+       echo >> $@
+       echo >> $@
+       printf 'icon_srcs = ' >> $@
+       for i in  $(ICON_SOURCES); do \
+               printf ' \\\n\t '$$i  >> $@ ;\
+       done
+       echo ' ' >> $@
+       echo >> $@
+
+
+src/ui/gui/resources.xml: $(ICONS)
+       printf '<?xml version="1.0" encoding="UTF-8"?>\n' > $@
+       printf '<gresources>\n' >> $@
+       printf ' <gresource prefix="gnu/pspp">\n' >> $@
+       for x in $^; do \
+         z=`echo "$$x" | sed -e 's%src/ui/gui/%%'` ; \
+         printf "  <file>$$z</file>\n" >> $@ ; \
+       done
+       printf ' </gresource>\n' >> $@
+       printf '</gresources>\n' >> $@
+
+
+.PHONY: prep_ph
+prep_ph:
        test -e ChangeLog || touch ChangeLog
        test -d m4 || mkdir m4
        touch m4/Makefile.am
-       $(MAKE) -f Smake gnulib
-       libtoolize --force --automake
-       aclocal -I m4 -I gl/m4
-       autoconf
-       autoheader
-       automake --add-missing --copy --no-force
-
-gnulib:
+       touch build-aux/config.rpath
        $(GNULIB_TOOL) --add-import --no-changelog --m4-base=gl/m4 \
                --source-base=gl --lib=libgl --tests-base=tests \
-               --doc-base=gl/doc --aux-dir=build-aux --import \
+               --doc-base=gl/doc --aux-dir=build-aux \
+               --makefile-name=automake.mk --automake-subdir \
                --libtool $(GNULIB_MODULES)
+       if (glibtoolize --version) >/dev/null 2>&1; then        \
+               LIBTOOLIZE=glibtoolize;                         \
+       elif (libtoolize --version) >/dev/null 2>&1; then       \
+               LIBTOOLIZE=libtoolize;                          \
+       else                                                    \
+               echo >&2 "libtoolize not found";                \
+               exit 1;                                         \
+       fi;                                                     \
+       $$LIBTOOLIZE --force --automake --copy
+
+aclocal.m4:
+       aclocal -I m4 -I gl/m4
+
+configure: configure.ac aclocal.m4
+       autoconf || rm $@  # autoconf 2.69 has (what I think is) a bug.  It will create configure even when failure is detected.
+
+config.h.in: configure.ac
+       autoheader
+
+Makefile.in: Makefile.am config.h.in aclocal.m4 src/ui/gui/resources.xml src/ui/gui/icons/manifest
+       automake --add-missing --copy --no-force --include-deps
 
 
 gettextize:
@@ -146,30 +384,109 @@ _debug: all
        test -d _debug || mkdir _debug
        cd _debug && ../configure $(CONFIGUREFLAGS) --enable-debug
 
-PO_FILES = po/ChangeLog \
-po/Rules-quot po/boldquot.sed          \
+
+
+PO_FILES = po/Rules-quot po/boldquot.sed \
 po/cat-id-tbl.c po/en@boldquot.header po/en@quot.header                        \
 po/insert-header.sin po/quot.sed po/remove-potcdate.sin po/stamp-po    \
 po/Makevars.template po/pspp.pot
 
-clean:
+clean: clean-icons
        rm -f config.sub config.guess config.rpath
        rm -fr autom4te.cache
        rm -f aclocal.m4
        rm -f missing mkinstalldirs
        rm -f install-sh
-       rm -f configure Makefile 
+       rm -f configure Makefile
        rm -f depcomp
        rm -rf intl gl
        rm -f m4/*.m4
-       rm -f $(PO_FILES) po/*.gmo 
+       rm -f $(PO_FILES) po/*.gmo
        rm -f mdate-sh texinfo.tex
        rm -f doc/stamp-vti
        rm -f config.h.in~
        rm -f config.h.in
-       find . -name Makefile.in -exec rm -f {} \; 
-       rm -f compile
-       rm -f ltmain.sh
-       rm -f reloc-ldflags install-reloc
+       rm -f gl/Makefile.in
+       rm -f gl/automake.mk
+       rm -f Makefile.in
+       rm -f build-aux/compile
+       rm -f build-aux/ltmain.sh
+       rm -f build-aux/reloc-ldflags
+       rm -f build-aux/install-reloc
+       rm -f build-aux/config.rpath
+       rm -f build-aux/config.libpath
+       rm -f build-aux/libtool-reloc
+       rm -f build-aux/gitlog-to-changelog
 
 .PHONY: all gettextize clean
+
+
+# The "convert" program from imagemagick can be used to create png from svg but doesn't properly deal
+# with the alpha channels.  Therefore, it is not recommended for production pspp builds, but might
+# be useful to get something working on a platform which doesn't have a working gimp.
+
+#svg2png=convert -background transparent $1 $3
+
+# Graphical layout of icons and our portfolio
+# ===========================================
+#
+# We have two different kinds of icons in our artwork collection
+#
+#   a) The mimetype icons have a different graphical layout depending on resolution
+#      This assumes that a higher resolution means a bigger size. On the bigger
+#      size you can identify more details and this is used in the design.
+#   b) Icons which are designed based on 16x16 pixels which are just scaled
+#      This are all other icons.
+#
+# Icon resolutions
+#
+# The different icon resolutions are historically derived for bitmaps when an icon
+# is displayed in different sizes. Then a scaled version of the icon requires a new
+# bitmap image. All our icons are now svg type and can be scaled from one svg file as
+# the names suggests - scalable vector format.
+#
+# The strategy for pspp gui
+#
+# All icons which are simply scaled provide a default 48x48 bitmap png image plus
+# an svg version in the scalable directory.
+# The mimetype icons with different layouts provide png bitmaps in their original resolutions
+#
+# The artwork directory contains only the pure source svg files. No copies and no
+# version has another size indication although it is an svg.
+#
+#  => mimetype icons are located in 16x16, 32x32, ... , 256x256 (different designs)
+#  => all others are in scaled (just one design svg)
+#
+
+# Rule for icons with size dependent graphical design
+src/ui/gui/icons/%.png: src/ui/gui/artwork/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
+       mkdir -p $(dir $@)
+       build-aux/svg2png "$<" "$(lastword $^)" "$@"
+
+# Rules for icons which are simply scaled - Attention multitarget would trigger only once...
+src/ui/gui/icons/16x16/%.png : src/ui/gui/artwork/scalable/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
+       mkdir -p $(dir $@)
+       build-aux/svg2png "$<" "$(lastword $^)" "$@"
+src/ui/gui/icons/22x22/%.png : src/ui/gui/artwork/scalable/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
+       mkdir -p $(dir $@)
+       build-aux/svg2png "$<" "$(lastword $^)" "$@"
+src/ui/gui/icons/24x24/%.png : src/ui/gui/artwork/scalable/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
+       mkdir -p $(dir $@)
+       build-aux/svg2png "$<" "$(lastword $^)" "$@"
+src/ui/gui/icons/32x32/%.png : src/ui/gui/artwork/scalable/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
+       mkdir -p $(dir $@)
+       build-aux/svg2png "$<" "$(lastword $^)" "$@"
+src/ui/gui/icons/48x48/%.png : src/ui/gui/artwork/scalable/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
+       mkdir -p $(dir $@)
+       build-aux/svg2png "$<" "$(lastword $^)" "$@"
+src/ui/gui/icons/96x96/%.png : src/ui/gui/artwork/scalable/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
+       mkdir -p $(dir $@)
+       build-aux/svg2png "$<" "$(lastword $^)" "$@"
+src/ui/gui/icons/256x256/%.png : src/ui/gui/artwork/scalable/%.svg build-aux/svg2png src/ui/gui/icons/COPYING_CCBYSA3
+       mkdir -p $(dir $@)
+       build-aux/svg2png "$<" "$(lastword $^)" "$@"
+
+# Copy svg
+src/ui/gui/icons/%.svg: src/ui/gui/artwork/%.svg
+       mkdir -p $(dir $@)
+       cp $< $@