diff --git a/Makefile b/Makefile index 56cdbd2..787c633 100644 --- a/Makefile +++ b/Makefile @@ -8,25 +8,80 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -DEPENDS = ncurses,readline +# Some, but not all of variables are required. The following list +# describes the required variables: +# +# * URL: The main website of the upstream project +# * REPO: The location of the package on the source pacakge +# server. This might be one of core, main, dev, or +# perhaps others. +# * BRIEF: Short description, should be 50 chars or less +# * SNAPVER: This is the package version. When a package is +# changed, but no changes are made to the source code +# this value should be increased. This would include +# things like usher being modified, changes to default +# configuration files, file permissions, etc. +# * ARCHIVE: The default commands that set this variable should +# work in most cases, but in some cases it may need +# to be modified. This variable should contain the +# path to the source of the package (./SRC/filename) +# * TYPE: This is probably not really needed due to the +# ability of gnu tar to figure it out on its own. +# Should probably be removed at some point. +# * SRCDIR: This is the name of the source directory after the +# package source is extracted. The default command +# should in most cases set this automatically. +# * PATCHDIR: This directory should be ./SRC/patches and is +# required, whether or not patches are used. +# * VERSION: This should be set automatically based on the +# version string in the source directory and SNAPVER. +# The default command here should work in many cases, +# but certain packages may need to use a different +# method. +# +# Variables that aren't required: +# +# * ARCH: This should be populated for packages which contain +# compiled binaries. If it is not populated the ARCH +# will be set to 'noarch'. +# * DEPENDS: If any other packages are required for this package +# to function then they need to be listed here, +# preferably in alphabetical order. +# * BUILDDEPS: Any package beyond packages from the core repo +# need to be listed here. The idea is that we +# can automate building and testing packages +# from clean core systems. The core repo is +# intended to include only the base minimum +# packages which provide a functional system. +# * SRCPKG: By default this is populated automatically with +# the name of the package (current directory). If +# the source package is used to generate multiple +# packages then this variable should contain the +# name of the git repo that tracks the source. +# * DESC: This is to be used to provide a longer description +# of the package. + ARCH = x86_64 -URL = http://www.gnu.org/software/bc/ -DESC = bc is an arbitrary precision numeric processing language. -SNAPVER = sr1 +DEPENDS = flex,glibc +BUILDDEPS = ed,gcc +SRCPKG = +URL = https://www.gnu.org/software/bc/ +REPO = main +BRIEF = bc is an arbitrary precision numeric processing language +DESC = bc is a language that supports arbitrary precision numbers with \ +interactive execution of statements. There are some similarities in the \ +syntax to the C programming language. +SNAPVER = 0 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 = rm -v $(ROOT)/usr/share/info/dir +VERSION := $(shell echo $(SRCDIR)|egrep -o '\-[0-9].*'|sed 's/^-//')-$(SNAPVER) include /usr/share/snap/Makefile.snaplinux -$(SRCDIR): $(ARCHIVE) +$(SRCDIR)/configure: $(ARCHIVE) @if [ '$(TYPE)' == 'application/x-bzip2' ]; then \ tar -jxf $(ARCHIVE); \ elif [ '$(TYPE)' == 'application/x-gzip' ]; then \ @@ -39,40 +94,40 @@ $(SRCDIR): $(ARCHIVE) echo 'Unable to determine archive type'; \ exit 1; \ fi + @touch $(SRCDIR)/configure -$(SRCDIR)/config.log: $(SRCDIR) - @cd $(SRCDIR) && for patch in `find $(PATCHDIR) -name \*.patch`; do \ +$(SRCDIR)/config.log: $(SRCDIR)/configure + @cd $(SRCDIR) && \ + for patch in `find $(PATCHDIR) -name \*.patch|sort`; do \ patch --verbose -Np1 -i $$patch; \ done @cd $(SRCDIR); \ ./configure \ --prefix=/usr \ - --mandir=/usr/share/man \ - --infodir=/usr/share/info \ --with-readline \ --build=x86_64-snap-linux-gnu \ --host=x86_64-snap-linux-gnu \ --target=x86_64-snap-linux-gnu -$(SRCDIR)/bc/bc: $(SRCDIR)/config.log - @cd $(SRCDIR); \ - $(MAKE) +# binfile should be replaced with a file generated by the +# make process. It won't really break anything if not +# set to a valid file, but the source make process will +# be re-executed even if it isn't necessary -$(ROOT): $(SRCDIR)/bc/bc +$(SRCDIR)/binfile: $(SRCDIR)/config.log + @cd $(SRCDIR) && make + +$(ROOT): $(SRCDIR)/binfile @if [ -d $(ROOT) ]; then \ touch $(ROOT); \ else \ mkdir -v $(ROOT); \ fi - @cd $(SRCDIR); \ - $(MAKEINST) DESTDIR=$(ROOT) - - @$(SNAPHACKS) + @cd $(SRCDIR) && make install DESTDIR=$(ROOT) test: $(ROOT) - @cd $(SRCDIR); \ - echo "quit" | ./bc/bc -l Test/checklib.b + @cd $(SRCDIR) && echo "quit" | ./bc/bc -l Test/checklib.b clean: @rm -rvf $(ROOT) \ diff --git a/SNAP/README b/SNAP/README index 19a3ff1..cb756b1 100644 --- a/SNAP/README +++ b/SNAP/README @@ -1,3 +1,5 @@ -This is the directory where the manifest, snapinfo, and files.tar.gz -files will be created. It is also where the usher file should be -placed if it is required by the package. +This is the directory where the manifest, snapinfo, +and files.tar.gz files will be created. It is also +where the usher file should be placed if it is +required by the package. Any other files that need +to be included could also be placed here. diff --git a/SRC/bc-1.06.95.tar.bz2 b/SRC/bc-1.06.95.tar.bz2 deleted file mode 100644 index dc49232..0000000 Binary files a/SRC/bc-1.06.95.tar.bz2 and /dev/null differ diff --git a/SRC/bc-1.06.95.tar.bz2.sig b/SRC/bc-1.06.95.tar.bz2.sig deleted file mode 100644 index 48fafa5..0000000 Binary files a/SRC/bc-1.06.95.tar.bz2.sig and /dev/null differ diff --git a/SRC/bc-1.07.1.tar.gz b/SRC/bc-1.07.1.tar.gz new file mode 100644 index 0000000..f9a6c69 Binary files /dev/null and b/SRC/bc-1.07.1.tar.gz differ diff --git a/SRC/bc-1.07.1.tar.gz.sig b/SRC/bc-1.07.1.tar.gz.sig new file mode 100644 index 0000000..709232c Binary files /dev/null and b/SRC/bc-1.07.1.tar.gz.sig differ diff --git a/SRC/patches/01_fix-segfault-jumping-to-label.patch b/SRC/patches/01_fix-segfault-jumping-to-label.patch deleted file mode 100644 index 13adf29..0000000 --- a/SRC/patches/01_fix-segfault-jumping-to-label.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff -purN a/bc/execute.c b/bc/execute.c ---- a/bc/execute.c 2006-09-04 21:39:31.000000000 -0500 -+++ b/bc/execute.c 2016-09-09 12:57:14.756000000 -0500 -@@ -133,7 +133,11 @@ execute () - gp = functions[pc.pc_func].f_label; - l_gp = label_num >> BC_LABEL_LOG; - l_off = label_num % BC_LABEL_GROUP; -- while (l_gp-- > 0) gp = gp->l_next; -+ while (gp && l_gp-- > 0) gp = gp->l_next; -+ if (!gp) { -+ rt_error ("No label group for label %d.", label_num); -+ break; -+ } - pc.pc_addr = gp->l_adrs[l_off]; - } - break; diff --git a/SRC/patches/02_fix-memory-leak.patch b/SRC/patches/02_fix-memory-leak.patch deleted file mode 100644 index eb59861..0000000 --- a/SRC/patches/02_fix-memory-leak.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -purN a/bc/bc.y b/bc/bc.y ---- a/bc/bc.y 2006-09-04 21:39:31.000000000 -0500 -+++ b/bc/bc.y 2016-09-09 13:02:41.476000000 -0500 -@@ -569,6 +569,7 @@ expression : named_expression ASSIGN_O - generate (">"); - break; - } -+ free($2); - } - | expression '+' expression - { -diff -purN a/bc/util.c b/bc/util.c ---- a/bc/util.c 2006-09-04 21:39:31.000000000 -0500 -+++ b/bc/util.c 2016-09-09 13:02:41.476000000 -0500 -@@ -602,8 +602,7 @@ lookup (name, namekind) - case FUNCTDEF: - if (id->f_name != 0) - { -- if (namekind != FUNCT) -- free(name); -+ free(name); - /* Check to see if we are redefining a math lib function. */ - if (use_math && namekind == FUNCTDEF && id->f_name <= 6) - id->f_name = next_func++; diff --git a/SRC/patches/03_fix-uninitialized-variable.patch b/SRC/patches/03_fix-uninitialized-variable.patch deleted file mode 100644 index dfafe05..0000000 --- a/SRC/patches/03_fix-uninitialized-variable.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -purN a/bc/storage.c b/bc/storage.c ---- a/bc/storage.c 2006-09-04 21:39:31.000000000 -0500 -+++ b/bc/storage.c 2016-09-09 13:05:09.720000000 -0500 -@@ -99,6 +99,7 @@ more_functions (VOID) - { - f = &functions[indx]; - f->f_defined = FALSE; -+ f->f_void = FALSE; - f->f_body = (char *) bc_malloc (BC_START_SIZE); - f->f_body_size = BC_START_SIZE; - f->f_code_size = 0; diff --git a/SRC/patches/README b/SRC/patches/README index 253cdcd..976577a 100644 --- a/SRC/patches/README +++ b/SRC/patches/README @@ -1,2 +1,3 @@ -Place any patch files here and preface each with a number indicating -the order of execution. Patch files are expected to use a .patch extension. +Place any patch files here and preface each with a +number indicating the order of execution. Patch +files are expected to use a .patch extension.