# HG changeset patch # User John D # Date 1496768193 14400 # Node ID 022eeecc83f340f6ea4a978dc6e1e08a1baa771a # Parent a5cb50beaa80308c72f06369da41064e9712db2d units: update to v2.14 * changed src/units.mk: update version, checksum * src/mingw-units-1-fixes.patch: removed * src/units-1-fixes.patch: removed * dist-files.mk: removed ref to mingw-units-1-fixes.patch, units-1-fixes.patch diff -r a5cb50beaa80 -r 022eeecc83f3 dist-files.mk --- a/dist-files.mk Mon Jun 05 15:48:34 2017 -0400 +++ b/dist-files.mk Tue Jun 06 12:56:33 2017 -0400 @@ -664,7 +664,6 @@ transfig-1-fixes.patch \ transfig.mk \ tre.mk \ - units-1-fixes.patch \ units.mk \ uuid.mk \ vala.mk \ diff -r a5cb50beaa80 -r 022eeecc83f3 src/mingw-units-1-fixes.patch --- a/src/mingw-units-1-fixes.patch Mon Jun 05 15:48:34 2017 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -diff -ur units-2.02.orig/Makefile.in units-2.02/Makefile.in ---- units-2.02.orig/Makefile.in 2013-12-07 06:56:41.000000000 -0500 -+++ units-2.02/Makefile.in 2013-12-07 19:50:21.000000000 -0500 -@@ -35,7 +35,7 @@ - TEXI2DVI = texi2dvi - TEXI2PDF = texi2pdf - LDFLAGS = @LDFLAGS@ --LIBS= @LIBS@ -+LIBS= @LIBS@ -lkernel32 - VPATH = @srcdir@ - - datarootdir = @datarootdir@ -diff -ur units-2.02.orig/units.c units-2.02/units.c ---- units-2.02.orig/units.c 2013-12-07 06:56:41.000000000 -0500 -+++ units-2.02/units.c 2013-12-07 20:51:00.000000000 -0500 -@@ -56,13 +56,28 @@ - #include "getopt.h" - #include "units.h" - --#ifndef UNITSFILE --# define UNITSFILE "definitions.units" --#endif -+#ifdef _WIN32 -+ #define WIN32_LEAN_AND_MEAN -+ #include - --#ifndef LOCALEMAP --# define LOCALEMAP "locale.map" --#endif -+# ifdef UNITSFILE -+# undef UNITSFILE -+# endif -+# define UNITSFILE "/share/units/definitions.units" -+ -+# ifdef LOCALEMAP -+# undef LOCALEMAP -+# endif -+# define LOCALEMAP "/share/units/locale.map" -+#else -+# ifndef UNITSFILE -+# define UNITSFILE "definitions.units" -+# endif -+ -+# ifndef LOCALEMAP -+# define LOCALEMAP "locale.map" -+# endif -+#endif - - #ifndef EOFCHAR - # define EOFCHAR "D" -@@ -1187,6 +1202,31 @@ - } - #endif - -+#ifdef _WIN32 -+char * root_path() -+{ -+ static char buff[2048]; -+ if(GetModuleFileName(NULL, buff, 2048) > 0)\ -+ { -+ /* name should be something like \somepath\bin\units.exe */ -+ char * ptr; -+ -+ ptr = strrchr(buff, '\\'); -+ if(ptr) *ptr = 0; -+ -+ ptr = strrchr(buff, '\\'); -+ if(ptr) -+ { -+ *ptr = 0; -+ } -+ } -+ else -+ strcpy(buff, "c:"); -+ -+ return buff; -+} -+#endif -+ - - /* - Read in units data. -@@ -3296,6 +3336,18 @@ - return file; - file = UNITSFILE; - testfile = fopen(file, "rt"); -+ -+#ifdef _WIN32 -+ if (!testfile) { -+ char * root = root_path(); -+ file = mymalloc(strlen(root)+strlen(UNITSFILE)+2,"(findunitsfile)"); -+ strcpy(file, root); -+ strcat(file, "\\"); -+ strcat(file, UNITSFILE); -+ testfile = fopen(file, "rt"); -+ } -+#endif -+ - if (!testfile) { - char *direc, *env; - char separator[2]; -@@ -4214,6 +4266,17 @@ - char *value; - char name[80]; - map = fopen(LOCALEMAP,"rt"); -+#ifdef _WIN32 -+ if (!map) { -+ char * root = root_path(); -+ char * file = mymalloc(strlen(root)+strlen(UNITSFILE)+2,"(localmap)"); -+ strcpy(file, root); -+ strcat(file, "\\"); -+ strcat(file, LOCALEMAP); -+ map = fopen(file, "rt"); -+ free(file); -+ } -+#endif - if (!map) - fprintf(stderr,"%s: Unable to read locale map '%s'\n",progname,LOCALEMAP); - else { diff -r a5cb50beaa80 -r 022eeecc83f3 src/units-1-fixes.patch --- a/src/units-1-fixes.patch Mon Jun 05 15:48:34 2017 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ ---- a/units.c.orig 2013-10-21 11:47:34 -0400 -+++ b/units.c 2013-10-21 12:18:24 -0400 -@@ -1166,23 +1166,23 @@ - int - setenv(const char *name, const char *val, int overwrite) - { -- char *environ; -+ char *environ1; - - if (!overwrite && getenv(name) != NULL) - return 0; -- environ = (char *) malloc(strlen(name) + strlen(val) + 2); -- if (!environ) -+ environ1 = (char *) malloc(strlen(name) + strlen(val) + 2); -+ if (!environ1) - return 1; -- strcpy(environ, name); -- strcat(environ, "="); -- strcat(environ, val); -+ strcpy(environ1, name); -+ strcat(environ1, "="); -+ strcat(environ1, val); - - /* putenv() doesn't copy its argument, so don't free environ */ - - #if defined _WIN32 && defined _MSC_VER -- return _putenv(environ); -+ return _putenv(environ1); - #else -- return putenv(environ); -+ return putenv(environ1); - #endif - } - #endif diff -r a5cb50beaa80 -r 022eeecc83f3 src/units.mk --- a/src/units.mk Mon Jun 05 15:48:34 2017 -0400 +++ b/src/units.mk Tue Jun 06 12:56:33 2017 -0400 @@ -3,8 +3,8 @@ PKG := units $(PKG)_IGNORE := -$(PKG)_VERSION := 2.02 -$(PKG)_CHECKSUM := e460371dc97034d17ce452e6b64991f7fd2d1409 +$(PKG)_VERSION := 2.14 +$(PKG)_CHECKSUM := de240d52855094ae2b64071ffc55ae1c3fc459f0 $(PKG)_SUBDIR := $(PKG)-$($(PKG)_VERSION) $(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.gz $(PKG)_URL := http://ftp.gnu.org/gnu/$(PKG)/$($(PKG)_FILE)