From 3021446ba47a24c5741f0104ae2ee66644fc6435 Mon Sep 17 00:00:00 2001 From: Jay Larson Date: Sat, 28 Jul 2018 10:29:28 -0500 Subject: [PATCH] The following changes were made: * Removed some old Makefile vars no longer used * Split off separate dev package --- Makefile | 51 +++++++++++++++++++++++++++++------------------ Makefile.flex-dev | 16 +++++++++++++++ 2 files changed, 48 insertions(+), 19 deletions(-) create mode 100644 Makefile.flex-dev diff --git a/Makefile b/Makefile index b807f9d..3f4e92f 100644 --- a/Makefile +++ b/Makefile @@ -8,26 +8,29 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -DEPENDS = -ARCH = x86_64 -URL = http://flex.sourceforge.net/ +export ARCH = x86_64 +export DEPENDS = glibc +export BUILDDEPS = +export SRCPKG = $(PACKAGE) +export URL = http://flex.sourceforge.net/ +REPO = main +BRIEF = Flex is a tool for generating scanners DESC = Flex is a tool for generating scanners. A scanner, sometimes called a \ tokenizer, is a program which recognizes lexical patterns in text. -SNAPVER = sr1 +SNAPVER = 3 ARCHIVE := $(PWD)/SRC/$(shell ls SRC|egrep '(bz2|gz|tar|xz)$$'|tail -1) TYPE := $(shell file -ib $(ARCHIVE)|cut -d';' -f1|tr -d '\n') SRCDIR := $(shell tar -tf $(ARCHIVE)|head -1|sed 's/\/.*//') PATCHDIR := $(PWD)/SRC/patches -VERSION := $(shell echo $(SRCDIR)|egrep -o '\-[0-9].*'|sed 's/^-//')$(SNAPVER) - -MAKE = make -MAKEINST = make install -SNAPHACKS = ln -sv flex $(ROOT)/usr/bin/lex && \ - rm -v $(ROOT)/usr/share/info/dir +export VERSION := $(shell echo $(SRCDIR)|egrep -o '\-[0-9].*'| \ + sed 's/^-//')-$(SNAPVER) include /usr/share/snap/Makefile.snaplinux +DEV := $(PWD)/$(PACKAGE)-dev +DEVROOT := $(DEV)/ROOT + $(SRCDIR)/configure: $(ARCHIVE) @if [ '$(TYPE)' == 'application/x-bzip2' ]; then \ tar -jxf $(ARCHIVE); \ @@ -43,9 +46,10 @@ $(SRCDIR)/configure: $(ARCHIVE) fi $(SRCDIR)/config.log: $(SRCDIR)/configure - @if [ -f $(PATCHDIR)/*.patch ]; then \ - cd $(SRCDIR) && cat $(PATCHDIR)/*.patch|patch --verbose -Np1; \ - fi + @cd $(SRCDIR) && \ + for patch in `find $(PATCHDIR) -name \*.patch|sort`; do \ + patch --verbose -Np1 -i $$patch; \ + done @cd $(SRCDIR); \ ./configure \ --prefix=/usr \ @@ -54,8 +58,7 @@ $(SRCDIR)/config.log: $(SRCDIR)/configure --target=x86_64-snap-linux-gnu $(SRCDIR)/src/flex: $(SRCDIR)/config.log - @cd $(SRCDIR); \ - $(MAKE) + @cd $(SRCDIR) && make $(ROOT): $(SRCDIR)/src/flex @if [ -d $(ROOT) ]; then \ @@ -64,10 +67,19 @@ $(ROOT): $(SRCDIR)/src/flex mkdir -v $(ROOT); \ fi - @cd $(SRCDIR); \ - $(MAKEINST) DESTDIR=$(ROOT) - - @$(SNAPHACKS) + @cd $(SRCDIR) && make install DESTDIR=$(ROOT) && \ + ln -sv flex $(ROOT)/usr/bin/lex && \ + rm -v $(ROOT)/usr/share/info/dir && \ + install -v -d $(DEV)/SNAP && \ + install -v -d $(DEVROOT) && \ + for file in `find $(ROOT)| \ + egrep '\.(a|h|la)$$'`; do \ + path=`dirname $$file|sed "s[$(ROOT)[$(DEVROOT)["`; \ + mkdir -p $$path; \ + mv $$file $$path; \ + done + @find $(ROOT) -type d -empty -delete && \ + cd $(DEV) && make -f ../Makefile.$(PACKAGE)-dev && mv *.snap ../ test: $(ROOT) @cd $(SRCDIR); \ @@ -75,6 +87,7 @@ test: $(ROOT) clean: @rm -rvf $(ROOT) \ + $(DEV) \ $(SNAPINFO) \ $(MANIFEST) \ $(FILES) \ diff --git a/Makefile.flex-dev b/Makefile.flex-dev new file mode 100644 index 0000000..6ce7579 --- /dev/null +++ b/Makefile.flex-dev @@ -0,0 +1,16 @@ +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation here: +# (http://www.gnu.org/licenses/gpl-2.0.html) +# +# 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. + +DEPENDS = flex +REPO = dev +BRIEF = Development files for flex +DESC = Development files for flex + +include /usr/share/snap/Makefile.snaplinux