Re: [uClinux-dev] out-of-date libgmp / building for M5208

2015-12-11 Thread Andrew Cagney
I came up with the attached.  The existing libgmp configuration in
lib/Kconfig would need removing.

On 9 December 2015 at 17:35, David McCullough  wrote:
>
> Andrew Cagney wrote the following:
>> On 8 December 2015 at 07:03, Greg Ungerer  wrote:
>> > Hi Andrew,
>> >
>> > On 08/12/15 04:23, Andrew Cagney wrote:
>> >>
>> >> The libgmp bundled with uClinux, by default, doesn't build for the
>> >> M5208 - the m68k assembler uses instructions dropped from early
>> >> Coldfires.
>> >> The hack I'm using locally is to configure with --host=none (I got
>> >> this trick second hand from somewhere).
>> >>
>> >> Anyway I noticed that libgmp is, er, a little out-of-date.  The latest
>> >> version has --disable-assembly which looks to be a cleaner way to
>> >> handle the assembler problem.
>> >> (How to decide when to configure with that option is an open question,
>> >> a Kconfig option).
>> >>
>> >> As anyone looked at updating this; or to turn the question round, is
>> >> there anything needed in the existing version that would prevent this?
>> >
>> >
>> > Nothing stopping updating as far as I know.
>> >
>> > Can I suggest that if you do decide to update it that you convert
>> > it to automake building.
>>
>> Yes, that's the plan.  I've noticed that the framework's improved
>> significantly over the years and I've been able to drop some of my
>> local hacks.
>>
>> > The trend over the last couple of years
>> > is that if we are updating a package then convert it. There
>> > are quite a few examples to follow in the lib directory. Just
>> > look for directories that contain a "makefile" and optionally a
>> > patches directory and not much else.
>>
>> Any pointers for how to handle --disable-assembly configure option?
>> For instance, since libreswan requires libgmp, it would have:
>>select LIB_LIBGMP
>> but libreswan doesn't know if --disable-assembly is required, that
>> would be set by a vendor/platform files?
>
> Yep,  make that part of the libgmp setup.  If you switch to automake you
> can add that option to a Kconfig in the libgmp directory,  again,  there
> are quite a few examples in the tree.  some have their own Kconfig files:
>
> grep -l automake lib/*/makefile user/*/makefile
>
> ls lib/*/Kconfig user/*/Kconfig
>
> to find them all.
>
> Cheers,
> Davidm
>
> --
> David McCullough,  dav...@spottygum.com,   Ph: 0410 560 763
> ___
> uClinux-dev mailing list
> uClinux-dev@uclinux.org
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by uclinux-dev@uclinux.org
> To unsubscribe see:
> http://mailman.uclinux.org/mailman/options/uclinux-dev


Kconfig
Description: Binary data


makefile
Description: Binary data
___
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

[uClinux-dev] nspr

2015-12-11 Thread Andrew Cagney
The patch "nspr.diff" adds a standalone and up-to-date NSPR library.
It is always built statically.  For the patches:

nspr-00--done--nspr-configure-in--m68k-is-not-m68020-60.patch I
believe it's been accepted
nspr-02--hold--ifdef-have-dlfcn-h.patch: it's been submitted and
hopefully accepted
nspr-03--todo--barf-fork-call.patch: hack: I don't think s/fork/vfork/
would work here, and since I don't need it to work I took the easy way
out

I should point out that while Mozilla thinks NSPR and NSS should go
hand-in-hand (per the current lib/nss directory which tries to build
both) I found things became much easier when I split those two and
built them separately (NSPR uses autoconf, abet incorrectly; NSS uses
GNU make; NSS+NSPR uses GNU make to invoke autoconf ).   The patch
"wip-nss.diff" (do not apply) hints at how I'm getting lib/nss to use
the previously built NSPR

Andrew
diff --git a/lib/nspr/.gitignore b/lib/nspr/.gitignore
new file mode 100644
index 000..dc3f997
--- /dev/null
+++ b/lib/nspr/.gitignore
@@ -0,0 +1,2 @@
+/build
+/downloads
diff --git a/lib/nspr/makefile b/lib/nspr/makefile
new file mode 100644
index 000..e195237
--- /dev/null
+++ b/lib/nspr/makefile
@@ -0,0 +1,20 @@
+URL = https://ftp.mozilla.org/pub/nspr/releases/v4.11/src/nspr-4.11.tar.gz
+
+NVR = $(subst -, , $(patsubst %.tar.gz,%,$(notdir $(URL
+PKG = $(word 1,$(NVR))
+VERSION = $(word 2,$(NVR))
+SRCDIR = $(PKG)-$(VERSION)
+BUILDDIR = $(SRCDIR)/nspr
+
+# $(AUTORECONF) is run from $(SRCDIR), not $(BUILDDIR)
+AUTORECONF = cd nspr ; autoconf
+
+include $(ROOTDIR)/tools/automake.inc
+
+# Disable build of shared library.  Should this be controled by
+# automake.mk somehow?
+MAKEVARS = 'SHARED_LIBRARY='
+
+# When it comes to the definition of build, host, and target, Mozilla
+# are still living in the 90's: target->[] build->host host->target.
+CONFIGURE_OPTS:=$(patsubst --build=%,--host=%,$(patsubst 
--host=%,--target=%,$(patsubst --target=%,,$(CONFIGURE_OPTS
diff --git 
a/lib/nspr/patches/nspr-00--done--nspr-configure-in--m68k-is-not-m68020-60.patch
 
b/lib/nspr/patches/nspr-00--done--nspr-configure-in--m68k-is-not-m68020-60.patch
new file mode 100644
index 000..bbdced2
--- /dev/null
+++ 
b/lib/nspr/patches/nspr-00--done--nspr-configure-in--m68k-is-not-m68020-60.patch
@@ -0,0 +1,11 @@
+--- nspr-4.10.9/nspr/configure.in.orig 2015-11-25 15:17:14.732725317 -0500
 nspr-4.10.9/nspr/configure.in  2015-11-25 20:09:38.299725384 -0500
+@@ -1857,8 +1865,4 @@
+ fi
+ ;;
+-m68k)
+-CFLAGS="$CFLAGS -m68020-60"
+-CXXFLAGS="$CXXFLAGS -m68020-60"
+-;;
+ esac
+ ;;
diff --git a/lib/nspr/patches/nspr-02--hold--ifdef-have-dlfcn-h.patch 
b/lib/nspr/patches/nspr-02--hold--ifdef-have-dlfcn-h.patch
new file mode 100644
index 000..7f80842
--- /dev/null
+++ b/lib/nspr/patches/nspr-02--hold--ifdef-have-dlfcn-h.patch
@@ -0,0 +1,57 @@
+--- nspr-4.11/nspr/configure.in.orig   2015-12-02 12:38:53.626997958 -0500
 nspr-4.11/nspr/configure.in2015-12-02 13:55:03.438024691 -0500
+@@ -2518,8 +2518,9 @@
+ *-darwin*|*-beos*|*-os2*)
+ ;;
+ *)
++dnl define HAVE_DLFCN_H when present
+ AC_CHECK_LIB(dl, dlopen,
+-[AC_CHECK_HEADER(dlfcn.h,
++[AC_CHECK_HEADERS(dlfcn.h,
+ OS_LIBS="-ldl $OS_LIBS")])
+ ;;
+ esac
+--- nspr-4.11/nspr/pr/include/md/_linux.h.orig 2015-12-02 14:06:23.694020882 
-0500
 nspr-4.11/nspr/pr/include/md/_linux.h  2015-12-02 14:07:37.706046831 
-0500
+@@ -74,10 +74,12 @@
+ #undefHAVE_STACK_GROWING_UP
+ 
+ /*
+- * Elf linux supports dl* functions
++ * Elf linux supports dl* functions but uClinux may not.
+  */
++#if defined(HAVE_DLFCN_H)
+ #define HAVE_DLL
+ #define USE_DLFCN
++#endif
+ #if defined(ANDROID)
+ #define NO_DLOPEN_NULL
+ #endif
+--- nspr-4.11/nspr/pr/src/pthreads/ptthread.c.orig 2015-11-18 
07:36:52.0 -0500
 nspr-4.11/nspr/pr/src/pthreads/ptthread.c  2015-12-02 14:15:10.850057366 
-0500
+@@ -19,7 +19,9 @@
+ #include 
+ #include 
+ #include 
++#ifdef HAVE_DLFCN_H
+ #include 
++#endif
+ 
+ #ifdef SYMBIAN
+ /* In Open C sched_get_priority_min/max do not work properly, so we undefine
+@@ -1764,6 +1766,7 @@
+ int (*dynamic_pthread_setname_np)(pthread_t, const char*);
+ #endif
+ 
++#if defined(HAVE_DLL)
+ *(void**)(_pthread_setname_np) =
+ dlsym(RTLD_DEFAULT, "pthread_setname_np");
+ if (!dynamic_pthread_setname_np)
+@@ -1801,6 +1804,7 @@
+ PR_SetError(PR_UNKNOWN_ERROR, result);
+ return PR_FAILURE;
+ }
++#endif /* HAVE_DLL */
+ return PR_SUCCESS;
+ }
+ 
diff --git a/lib/nspr/patches/nspr-03--todo--barf-fork-call.patch 
b/lib/nspr/patches/nspr-03--todo--barf-fork-call.patch
new file mode 100644
index 000..5c17255
--- /dev/null
+++ b/lib/nspr/patches/nspr-03--todo--barf-fork-call.patch
@@ -0,0 +1,31 @@
+For moment, when no fork() replace the call with a barf.
+Should, perhaps, eventually look at changing the code to
+be vfork proof.
+