diff --git a/Makefile b/Makefile index 77cadd9..7421fc9 100755 --- a/Makefile +++ b/Makefile @@ -36,11 +36,18 @@ uninstall: uninstall-lib uninstall-doc uninstall-cfgtool # Reinstall everything. (EXPERIMENTAL) reinstall: uninstall install -# Make a distribution tarball. +# Make a distribution tarball dist: mrproper + $(call bcmd,mkdir,lib$(NAME)-$(VERSION),\ + $(MD) .dist) + $(call bcmd,cp,* lib$(NAME)-$(VERSION),\ + $(CP) -R * .dist) + $(call qcmd,\ + $(MV) .dist lib$(NAME)-$(VERSION)) $(call bcmd,tarball,lib$(NAME)-$(VERSION),\ tar czf lib$(NAME)-$(VERSION).tar.gz \ - --exclude .git --transform "s/^/lib$(NAME)-$(VERSION)\//" *) + --exclude .git lib$(NAME)-$(VERSION)) + $(call qcmd,$(RM) -r lib$(NAME)-$(VERSION)) .PHONY: all mostlyclean mclean clean fclean mrproper re .PHONY: dist install uninstall reinstall @@ -122,19 +129,17 @@ $(eval $(call make-moduleobj-rule,$(mod)))) $(call imsg,Installing the library.) $(call qcmd,$(INST) -m 755 -d "$(ILIBDIR)") $(call qcmd,$(INST) -m 755 -t "$(ILIBDIR)" $(SONAME)) - $(if $(LINK_TO_MAJOR),\ $(call imsg,Linking lib$(NAME).so to lib$(NAME).so.$(MAJOR).)) $(if $(LINK_TO_MAJOR),\ $(call qcmd,$(LN) lib$(NAME).so.$(MAJOR) "$(ILIBDIR)/lib$(NAME).so")) - $(if $(INSTALL_DEVEL),\ $(call imsg,Installing development files.)) - $(if $(INSTALL_DEVEL),\ - $(call qcmd,$(INST) -m 755 -d $(patsubst %,"$(IINCDIR)/%",\ - $(sort $(dir $(INCPUB)))))) + $(if $(INSTALL_DEVEL),$(call qcmd,$(INST) -m 755 -d $(patsubst %,\ + "$(IINCDIR)/lib$(NAME)-$(VERSION)/%",$(sort $(dir $(INCPUB)))))) $(if $(INSTALL_DEVEL),$(foreach i,$(INCPUB),\ - $(call qcmd,$(INST) -m 644 $(INCDIR)/$(i).h "$(IINCDIR)/$(i).h"$(\n)))) + $(call qcmd,$(INST) -m 644 $(INCDIR)/$(i).h \ + "$(IINCDIR)/lib$(NAME)-$(VERSION)/$(i).h"$(\n)))) # Uninstall the library, development files and udev rule. (experimental) uninstall-lib: $(CHECKCFG) @@ -156,16 +161,15 @@ $(eval $(call make-moduleobj-rule,$(mod)))) $(call qcmd,tools/write-config \ --name=lib$(NAME) --version=$(VERSION) \ --maintainer="$(MAINTAINER_NAME) <$(MAINTAINER_MAIL)>" \ - --incdir="$(OIINCDIR)" --libdir="$(OILIBDIR)" \ + --incdir="$(OIINCDIR)/lib$(NAME)-$(VERSION)" --libdir="$(OILIBDIR)" \ >"$(IBINDIR)/lib$(NAME)-config" \ && chmod 755 "$(IBINDIR)/lib$(NAME)-config") - $(call imsg,Installing the pkg-config configuration.) $(call qcmd,$(INST) -m 755 -d "$(IPKGDIR)") $(call qcmd,tools/write-pkg-config \ --name=$(NAME) --version=$(VERSION) \ --description="$(DESCRIPTION)" \ - --incdir="$(OIINCDIR)" --libdir="$(OILIBDIR)" \ + --incdir="$(OIINCDIR)/lib$(NAME)-$(VERSION)" --libdir="$(OILIBDIR)" \ >"$(IPKGDIR)/lib$(NAME).pc" \ && chmod 644 "$(IPKGDIR)/lib$(NAME).pc") @@ -239,4 +243,15 @@ $(eval $(call make-uninstall-doc-rule,$(sec)))) .PHONY: all-doc mostlyclean-doc mclean-doc clean-doc re-doc .PHONY: install-doc uninstall-doc .PHONY: $(foreach s,$(MAN_SECTIONS),install-doc-$(s) uninstall-doc-$(s)) +#******************************************************************************# +# Packaging # +#******************************************************************************# +# Package for debian. +deb: + debuild --no-tgz-check -us -uc +# Clean packaging +clean-deb: + debuild clean + +.PHONY: deb clean-deb # End of file. diff --git a/Makefile.vars b/Makefile.vars index 8f9e188..0a398ac 100755 --- a/Makefile.vars +++ b/Makefile.vars @@ -68,7 +68,7 @@ # - All C compiling flags CFLAGS := -I $(INCDIR) $(CHKFLAGS) -std=gnu11 -fPIC -O2 \ -D LOGLEVEL="ll_$(LOG_LEVEL)" \ - -D AUTHOR="$(AUTHOR)" -D AUTHOR_MAIL="$(AUTHOR_MAIL)" \ + -D MAINTAINER="$(MAINTAINER_NAME) <$(MAINTAINER_MAIL)>" \ -D LICENSE="$(LICENSE)" -D VERSION="$(VERSION)" \ $(shell $(PKGCONFIG) --cflags zlib 2>/dev/null ) \ $(CMOREFLAGS) diff --git a/README.md b/README.md index f50baea..a2b386b 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,18 @@ I took these as a reference because these are the ones I work with. | -------------------------------------------------- | -------- | | [zlib](http://zlib.net/) | >= 1.2.8 | +### Debian Packaging dependencies +| Name | Version | +| ----------------------------------------------------------- | -------- | +| [debhelper](http://joeyh.name/code/debhelper/) | >= 9.0 | +| [devscripts](https://packages.debian.org/stable/devscripts) | >= 2.15 | + ## Building -Just `./configure` then `make`. +To package for Debian, use the `deb` target. You shouldn't configure before +running this target, `debian/rules` will make it for you. Packages and +associated file are created in the parent directory. + +If you ought to make it yourself, just `./configure` then `make`. To install, use `make install`. If you're using a custom target, by default, the prefix will be diff --git a/configure b/configure index 72435e9..2edf88a 100755 --- a/configure +++ b/configure @@ -135,16 +135,14 @@ got '$level'" esac; done #******************************************************************************# -# Check for defaults # +# Little things # #******************************************************************************# -# Cross-compiling things -if [ ! $prefix_set ]; then - prefix='${root}/usr/'"$target" +# Cross-compilation things +if [ ! $prefix_set ] && [ $target ]; then + prefix="$prefix"/"$target" fi -#******************************************************************************# -# Evaluate variables # -#******************************************************************************# +# Evaluate variables for var in prefix sysconfdir bindir libdir pkgdir includedir mandir; do eval $var'='$(eval 'echo $'$var) done diff --git a/debian/.gitignore b/debian/.gitignore new file mode 100644 index 0000000..d451da9 --- /dev/null +++ b/debian/.gitignore @@ -0,0 +1,13 @@ +/libp7 +/libp7-dev +/libp7-doc +/tmp +/files +/libp7.debhelper.log +/libp7.postinst.debhelper +/libp7.postrm.debhelper +/libp7.substvars +/libp7-dev.debhelper.log +/libp7-dev.substvars +/libp7-doc.debhelper.log +/libp7-doc.substvars diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..bfd1e77 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +libg1m (1.0) stable; urgency=medium + + * Initial release. + + -- Thomas Touhey Wed, 04 Jan 2017 18:44:18 +0100 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..304885e --- /dev/null +++ b/debian/control @@ -0,0 +1,41 @@ +Standards-Version: 3.9.6 +Source: libg1m +Priority: optional +Maintainer: Thomas Touhey +Section: libs +Homepage: https://forge.touhey.fr/casio/lib/libg1m +Build-Depends: debhelper (>= 9), make (>= 4.0), gcc (>= 4.9), + binutils (>= 2.25), libc6 (>= 2.19), zlib1g-dev (>= 1.0), + asciidoc (>= 8.6.9), gzip (>= 1.6) + +Package: libg1m-1.0 +Section: libs +Architecture: linux-any +Multi-Arch: same +Suggests: mcsfile +Pre-Depends: ${misc:Pre-Depends} +Depends: ${shlibs:Depends}, ${misc:Depends}, + zlib1g (>= 1.0) +Description: CASIO files parsing library + Library for parsing CASIO files with a StandardHeader (usually g[1-3][a-z]). + . + This package contains the main shared library. + +Package: libg1m-1.0-dev +Section: libdevel +Architecture: linux-any +Depends: ${shlibs:Depends}, ${misc:Depends}, libg1m-1.0 (= ${binary:Version}) +Recommends: libg1m-1.0-doc +Description: CASIO files parsing library development files + Library for parsing CASIO files with a StandardHeader (usually g[1-3][a-z]). + . + This package contains C headers for libg1m. + +Package: libg1m-1.0-doc +Section: doc +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: documentation for CASIO files parsing library + Library for parsing CASIO files with a StandardHeader (usually g[1-3][a-z]). + . + This package contains the manpages for libg1m. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..6ea81e9 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,20 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: libg1m +Upstream-Contact: Thomas Touhey +Source: https://forge.touhey.fr/casio/lib/libp7/ + +Files: * +Copyright: © 2016 Thomas "CakeIsALie5" Touhey +License: GPL-2 + 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. + . + On Debian systems, the complete text of the GPL license can be found + in the /usr/share/common-licenses/GPL-2 file. diff --git a/debian/libg1m-1.0-dev.install b/debian/libg1m-1.0-dev.install new file mode 100644 index 0000000..c518eaa --- /dev/null +++ b/debian/libg1m-1.0-dev.install @@ -0,0 +1,4 @@ +usr/bin/* +usr/lib/**/libg1m.so +usr/lib/**/pkgconfig/*.pc +usr/include/libg1m-*/**/* diff --git a/debian/libg1m-1.0-dev.manpages b/debian/libg1m-1.0-dev.manpages new file mode 100644 index 0000000..0633c2f --- /dev/null +++ b/debian/libg1m-1.0-dev.manpages @@ -0,0 +1 @@ +man/man1/libg1m-config.1 diff --git a/debian/libg1m-1.0-doc.manpages b/debian/libg1m-1.0-doc.manpages new file mode 100644 index 0000000..4df3b31 --- /dev/null +++ b/debian/libg1m-1.0-doc.manpages @@ -0,0 +1 @@ +man/man3/*.3 diff --git a/debian/libg1m-1.0.install b/debian/libg1m-1.0.install new file mode 100644 index 0000000..51064b2 --- /dev/null +++ b/debian/libg1m-1.0.install @@ -0,0 +1 @@ +usr/lib/**/libg1m.so.* diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..ec18039 --- /dev/null +++ b/debian/rules @@ -0,0 +1,7 @@ +#!/usr/bin/make -f +# uncomment if necessary - read debhelper(7) for more info +#DH_VERBOSE = 1 + +# main packaging script, based on dh9 syntax +%: + dh $@ diff --git a/doc/libg1m-config.1.txt b/doc/libg1m-config.1.txt new file mode 100644 index 0000000..544a5f0 --- /dev/null +++ b/doc/libg1m-config.1.txt @@ -0,0 +1,45 @@ +LIBG1M-CONFIG(1) +================ +Thomas "Cakeisalie5" Touhey +:Email: thomas@touhey.fr +:man source: libg1m +:man manual: libg1m manual + +NAME +---- +libg1m-config - script to get information about the installed version of libg1m + +SYNOPSIS +-------- +*libg1m-config* [--version] [--cflags] [--libs] + +DESCRIPTION +----------- +*libg1m-config* is a tool that is used to configure and determine the compiler +and linker flags that should be used to compile and link programs, libraries, +and plugins that use libg1m. + +OPTIONS +------- +*--cflags*:: + Print the compiler flags that are necessary to compile a program or library + that uses libg1m. +*--libs*:: + Print the linker flags that are necessary to link a program that + uses libg1m. +*--version*:: + Prints the currently installed version of libg1m on standard output. + +EXAMPLES +-------- +gcc -o main.o $(libg1m-config --cflags) main.c:: + is how you might use *libg1m-config* to compile a C source file for an + executable program. +gcc -o my_app $(libg1m-config --libs) main.o util.o:: + is how you might use *libg1m-config* to link compiled objects into an + executable program. + +SEE ALSO +-------- +*libg1m*(3), +*pkg-config*(1) diff --git a/src/core/strerror.c b/src/core/strerror.c index 5d27b08..16b5baf 100644 --- a/src/core/strerror.c +++ b/src/core/strerror.c @@ -30,7 +30,7 @@ const char *g1m_error_strings[] = { "given stream was not seekable", [g1m_error_magic] = - "magic/control problem", + "is probably not a file libg1m can parse, or is corrupted", [g1m_error_eof] = "unexpected EOF", [g1m_error_alloc] = diff --git a/src/core/version.c b/src/core/version.c index 1c0aa22..346c1b8 100644 --- a/src/core/version.c +++ b/src/core/version.c @@ -34,7 +34,7 @@ static const char version_message[] = "libg1m v" QUOTE(VERSION) " (licensed under GPLv2)\n" -"Made by " QUOTE(AUTHOR) " <" QUOTE(AUTHOR_MAIL) ">.\n" +"Maintained by " QUOTE(MAINTAINER) ".\n" "\n" "Compiled with the '" LLS "' loglevel.\n" "\n" diff --git a/src/parse/fkey.c b/src/parse/fkey.c index f6070a7..f6ed3a0 100644 --- a/src/parse/fkey.c +++ b/src/parse/fkey.c @@ -30,6 +30,24 @@ static uint32_t **fkeydup(uint8_t *fkey) return (pixels); } +/** + * fkeydup3: + * "Duplicate" function key for fx-CG. + * + * @arg fkey fkey to duplicate. + * @return the "duplicated" function key. + */ + +static uint32_t **fkeydup3(uint8_t *fkey) +{ + uint32_t **pixels = alloc_pixels(FKEY3_WIDTH, FKEY3_HEIGHT); + if (!pixels) return (NULL); + prepare_pixels(pixels, FKEY3_WIDTH, FKEY3_HEIGHT) + + g1m_pixels_from_packed1bit(pixels, fkey, FKEY3_WIDTH, FKEY3_HEIGHT); + return (pixels); +} + /* ************************************************************************** */ /* fx function keys file parsing utilities */ /* ************************************************************************** */ diff --git a/src/parse/picture.c b/src/parse/picture.c index e24ab8c..0ae8c26 100644 --- a/src/parse/picture.c +++ b/src/parse/picture.c @@ -149,6 +149,7 @@ int g1m_parse_c2p(g1m_t *handle, FILE *stream, (void)stream; /* TODO */ log_info("C2P files are not managed yet."); + log_info("Size is %zx", sizeof(struct c2p_subheader)); /* no error */ return (0);