packages: crossnacl-newlib/crossnacl-newlib.spec (NEW), crossnacl-newlib/ne...

glen glen at pld-linux.org
Fri Jul 6 16:12:44 CEST 2012


Author: glen                         Date: Fri Jul  6 14:12:44 2012 GMT
Module: packages                      Tag: HEAD
---- Log message:
- new, based on spot's src.rpm:
  http://repos.fedorapeople.org/repos/spot/chromium-stable/fedora-16/SRPMS/nacl-newlib-1.18.0-1.gitf5185a57.fc16.src.rpm

---- Files affected:
packages/crossnacl-newlib:
   crossnacl-newlib.spec (NONE -> 1.1)  (NEW), newlib-libc-script (NONE -> 1.1)  (NEW), pthread.h (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/crossnacl-newlib/crossnacl-newlib.spec
diff -u /dev/null packages/crossnacl-newlib/crossnacl-newlib.spec:1.1
--- /dev/null	Fri Jul  6 16:12:44 2012
+++ packages/crossnacl-newlib/crossnacl-newlib.spec	Fri Jul  6 16:12:39 2012
@@ -0,0 +1,109 @@
+# $Revision$, $Date$
+%define		gitver f5185a57
+Summary:	C library intended for use on embedded systems
+Name:		crossnacl-newlib
+Version:	1.18.0
+Release:	0.git%{gitver}
+# Generated from git
+# git clone http://git.chromium.org/native_client/nacl-newlib.git
+# (Checkout ID taken from chromium-15.0.874.106/native_client/tools/REVISIONS)
+# cd nacl-newlib
+# git checkout f5185a5726155efb578d4d0f6537bc15ee5edb7d
+# cd ..
+# For newlib version, grep PACKAGE_VERSION newlib/libm/configure
+# mv nacl-newlib nacl-newlib-1.18.0-gitf5185a57
+# tar cfj nacl-newlib-1.18.0-gitf5185a57.tar.bz2 nacl-newlib-1.18.0-gitf5185a57
+License:	BSD and MIT and LGPL v2+
+Group:		Libraries
+Source0:	nacl-newlib-%{version}-git%{gitver}.tar.bz2
+# Source0-md5:	50a832085a39ef0fcbdbd5cd30dbbb04
+# We need to copy some missing header files from chromium
+# mkdir ~/nacl-headers-15.0.874.106
+# cd chromium-15.0.874.106/native_client/
+# ./src/trusted/service_runtime/export_header.py src/trusted/service_runtime/include ~/nacl-headers-15.0.874.106/
+# cd ~/nacl-headers-15.0.874.106
+# tar cfj ~/nacl-headers-15.0.874.106.tar.bz2 .
+Source1:	nacl-headers-15.0.874.106.tar.bz2
+# Source1-md5:	8331aab055dc22b9de70d35c203845f7
+# Taken from chromium-15.0.874.106/native_client/tools/newlib-libc-script
+Source2:	newlib-libc-script
+# Taken from chromium-15.0.874.106/native_client/src/untrusted/pthread/pthread.h
+Source3:	pthread.h
+URL:		http://sourceware.org/newlib/
+BuildRequires:	crossnacl-binutils
+BuildRequires:	crossnacl-gcc
+ExclusiveArch:	%{ix86} %{x8664}
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%define		target		x86_64-nacl
+
+%description
+Newlib is a C library intended for use on embedded systems. It is a
+conglomeration of several library parts, all under free software
+licenses that make them easily usable on embedded products.
+
+This is the nacl fork.
+
+%prep
+%setup -q -n nacl-newlib-%{version}-git%{?gitver}
+cd newlib/libc/sys/nacl
+tar xf %{SOURCE1}
+cd -
+cp -p %{SOURCE2} .
+
+%build
+export NEWLIB_CFLAGS="-O2 -D_I386MACH_ALLOW_HW_INTERRUPTS -DSIGNAL_PROVIDED -mtls-use-call"
+%configure \
+	--disable-libgloss \
+	--enable-newlib-iconv \
+	--enable-newlib-io-long-long \
+	--enable-newlib-io-long-double \
+	--enable-newlib-io-c99-formats \
+	--enable-newlib-mb \
+	libc_cv_initfinit_array=yes \
+	CFLAGS="-O2" \
+	CFLAGS_FOR_TARGET="$NEWLIB_CFLAGS" \
+	CXXFLAGS_FOR_TARGET="$NEWLIB_CFLAGS" \
+	--target=%{target}
+
+%{__make}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%{__make} install \
+	DESTDIR=$RPM_BUILD_ROOT
+
+# Conflicts with binutils
+%{__rm} -r $RPM_BUILD_ROOT%{_infodir}
+
+# The default pthread.h doesn't work right?
+%{__rm} $RPM_BUILD_ROOT%{_prefix}/%{target}/include/pthread.h
+cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_prefix}/%{target}/include/
+
+# We have to hack up libc.a to get things working.
+# 32bit
+mv $RPM_BUILD_ROOT%{_prefix}/%{target}/lib/32/libc.a $RPM_BUILD_ROOT%{_prefix}/%{target}/lib/32/libcrt_common.a
+sed "s/@OBJFORMAT@/elf32-nacl/" newlib-libc-script > $RPM_BUILD_ROOT%{_prefix}/%{target}/lib/32/libc.a
+
+# 64bit (default)
+mv $RPM_BUILD_ROOT%{_prefix}/%{target}/lib/libc.a $RPM_BUILD_ROOT%{_prefix}/%{target}/lib/libcrt_common.a
+sed "s/@OBJFORMAT@/elf64-nacl/" newlib-libc-script > $RPM_BUILD_ROOT%{_prefix}/%{target}/lib/libc.a
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%{_datadir}/iconv_data
+%{_prefix}/%{target}/include
+%{_prefix}/%{target}/lib
+
+%define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
+%changelog
+* %{date} PLD Team <feedback at pld-linux.org>
+All persons listed below can be reached at <cvs_login>@pld-linux.org
+
+$Log$
+Revision 1.1  2012/07/06 14:12:39  glen
+- new, based on spot's src.rpm:
+  http://repos.fedorapeople.org/repos/spot/chromium-stable/fedora-16/SRPMS/nacl-newlib-1.18.0-1.gitf5185a57.fc16.src.rpm

================================================================
Index: packages/crossnacl-newlib/newlib-libc-script
diff -u /dev/null packages/crossnacl-newlib/newlib-libc-script:1.1
--- /dev/null	Fri Jul  6 16:12:44 2012
+++ packages/crossnacl-newlib/newlib-libc-script	Fri Jul  6 16:12:39 2012
@@ -0,0 +1,7 @@
+/*
+ * This is a linker script that gets installed as libc.a for the
+ * newlib-based NaCl toolchain.  It brings in the constituent
+ * libraries that make up what -lc means semantically.
+ */
+OUTPUT_FORMAT(@OBJFORMAT@)
+GROUP ( libcrt_common.a libnacl.a libcrt_platform.a )

================================================================
Index: packages/crossnacl-newlib/pthread.h
diff -u /dev/null packages/crossnacl-newlib/pthread.h:1.1
--- /dev/null	Fri Jul  6 16:12:44 2012
+++ packages/crossnacl-newlib/pthread.h	Fri Jul  6 16:12:39 2012
@@ -0,0 +1,693 @@
+/*
+ * Copyright (c) 2011 The Native Client Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/** @file
+ * Defines the API in the
+ * <a href="group___pthread.html">Pthread library</a>
+ *
+ * @addtogroup Pthread
+ * @{
+ */
+
+#ifndef _PTHREAD_H
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+#define _PTHREAD_H 1
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+#include <stdint.h>
+#include <sched.h>
+#include <time.h>
+#include <sys/nacl_nice.h>
+#include <sys/queue.h>
+#include <sys/types.h>
+
+/*
+ * Signed 32-bit integer supporting CompareAndSwap and AtomicIncrement
+ * (see implementations), as well as atomic loads and stores.
+ * Instances must be naturally aligned.
+ */
+typedef int AtomicInt32;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct timespec;
+
+/** Mutex type attributes */
+enum {
+  /** Fast mutex type; for use with pthread_mutexattr_settype() */
+  PTHREAD_MUTEX_FAST_NP,
+  /** Recursive mutex type; for use with pthread_mutexattr_settype() */
+  PTHREAD_MUTEX_RECURSIVE_NP,
+  /** Error-checking mutex type; for use with pthread_mutexattr_settype() */
+  PTHREAD_MUTEX_ERRORCHECK_NP,
+  PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_FAST_NP,
+  PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
+  PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP,
+
+  PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
+};
+
+/*
+ * The layout of pthread_mutex_t and the static initializers are redefined
+ * in newlib's sys/lock.h file (including this file from sys/lock.h will
+ * cause include conflicts). When changing one of the definitions, make sure to
+ * change the second one.
+ */
+/**
+ * A structure representing a thread mutex. It should be considered an
+ * opaque record; the names of the fields can change anytime.
+ */
+typedef struct {
+  /** Initialization token **/
+  int token;
+
+  /**
+   * The kind of mutex:
+   * PTHREAD_MUTEX_FAST_NP, PTHREAD_MUTEX_RECURSIVE_NP,
+   * or PTHREAD_MUTEX_ERRORCHECK_NP
+   */
+  int mutex_type;
+
+  /** ID of the thread that owns the mutex */
+  uint32_t owner_thread_id;
+
+  /** Recursion depth counter for recursive mutexes */
+  uint32_t recursion_counter;
+
+  /** Handle to the system-side mutex */
+  int mutex_handle;
+} pthread_mutex_t;
+
+/**
+ * A structure representing mutex attributes. It should be considered an
+ * opaque record and accessed only using pthread_mutexattr_settype().
+ */
+typedef struct {
+  /**
+   * The kind of mutex:
+   * PTHREAD_MUTEX_FAST_NP, PTHREAD_MUTEX_RECURSIVE_NP,
+   * or PTHREAD_MUTEX_ERRORCHECK_NP
+   */
+  int kind;
+} pthread_mutexattr_t;
+
+/**
+ * A structure representing a condition variable. It should be considered an
+ * opaque record; the names of the fields can change anytime.
+ */
+typedef struct {
+  /** Initialization token **/
+  int token;
+
+  /**< Handle to the system-side condition variable */
+  int handle;
+} pthread_cond_t;
+
+/**
+ * A structure representing condition variable attributes. Currently
+ * Native Client condition variables have no attributes.
+ */
+typedef struct {
+  int dummy; /**< Reserved; condition variables don't have attributes */
+} pthread_condattr_t;
+
+/** A value that represents an uninitialized handle. */
+#define NC_INVALID_HANDLE -1
+
+/** Maximum valid thread ID value. */
+#define MAX_THREAD_ID (0xfffffffe)
+
+/** Illegal thread ID value. */
+#define NACL_PTHREAD_ILLEGAL_THREAD_ID (0xffffffff)
+
+/** Statically initializes a pthread_mutex_t representing a recursive mutex. */
+#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
+    {0, 1, NACL_PTHREAD_ILLEGAL_THREAD_ID, 0, NC_INVALID_HANDLE}
+/** Statically initializes a pthread_mutex_t representing a fast mutex. */
+#define PTHREAD_MUTEX_INITIALIZER \
+    {0, 0, NACL_PTHREAD_ILLEGAL_THREAD_ID, 0, NC_INVALID_HANDLE}
+/**
+ * Statically initializes a pthread_mutex_t representing an
+ * error-checking mutex.
+ */
+#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
+    {0, 2, NACL_PTHREAD_ILLEGAL_THREAD_ID, 0, NC_INVALID_HANDLE}
+/** Statically initializes a condition variable (pthread_cond_t). */
+#define PTHREAD_COND_INITIALIZER {0, NC_INVALID_HANDLE}
+
+
+
+/* Functions for mutex handling.  */
+
+/** @nqPosix
+ * Initializes a mutex using attributes in mutex_attr, or using the
+ * default values if the latter is NULL.
+ *
+ * @linkPthread
+ *
+ * @param mutex The address of the mutex structure to be initialized.
+ * @param mutex_attr The address of the attributes structure.
+ *
+ * @return 0 upon success, 1 otherwise
+ */
+extern int pthread_mutex_init(pthread_mutex_t *mutex,
+                              pthread_mutexattr_t *mutex_attr);
+
+/** @nqPosix
+* Destroys a mutex.
+*
+* @linkPthread
+*
+* @param mutex The address of the mutex structure to be destroyed.
+*
+* @return 0 upon success, non-zero error code otherwise
+*/
+extern int pthread_mutex_destroy(pthread_mutex_t *mutex);
+
+/** @nqPosix
+* Tries to lock a mutex.
+*
+* @linkPthread
+*
+* @param mutex The address of the mutex structure to be locked.
+*
+* @return 0 upon success, EBUSY if the mutex is locked by another thread,
+* non-zero error code otherwise.
+*/
+extern int pthread_mutex_trylock(pthread_mutex_t *mutex);
+
+/** @nqPosix
+* Locks a mutex.
+*
+* @linkPthread
+*
+* @param mutex The address of the mutex structure to be locked.
+*
+* @return 0 upon success, non-zero error code otherwise.
+*/
+extern int pthread_mutex_lock(pthread_mutex_t *mutex);
+
+/* TODO(gregoryd) - depends on implementation */
+#if 0
+/* Wait until lock becomes available, or specified time passes. */
+/* TODO(gregoryd): consider implementing this function. */
+extern int pthread_mutex_timedlock(pthread_mutex_t *mutex,
+                                   struct timespec *abstime);
+#endif
+
+/** @nqPosix
+* Unlocks a mutex.
+*
+* @linkPthread
+*
+* @param mutex The address of the mutex structure to be unlocked.
+*
+* @return 0 upon success, non-zero error code otherwise.
+*/
+extern int pthread_mutex_unlock(pthread_mutex_t *mutex);
+
+/* Mutex attributes manipulation */
+
+/** @nqPosix
+* Initializes mutex attributes.
+*
+* @linkPthread
+*
+* @param attr The address of the attributes structure to be initialized.
+*
+* @return 0.
+*/
+extern int pthread_mutexattr_init(pthread_mutexattr_t *attr);
+
+/** @nqPosix
+* Destroys mutex attributes structure.
+*
+* @linkPthread
+*
+* @param attr The address of the attributes structure to be destroyed.
+*
+* @return 0.
+*/
+extern int pthread_mutexattr_destroy(pthread_mutexattr_t *attr);
+
+/** @nqPosix
+* Sets the mutex type: fast, recursive or error-checking.
+*
+* @linkPthread
+*
+* @param attr The address of the attributes structure.
+* @param kind PTHREAD_MUTEX_FAST_NP, PTHREAD_MUTEX_RECURSIVE_NP or
+* PTHREAD_MUTEX_ERRORCHECK_NP.
+*
+* @return 0 on success, -1 for illegal values of kind.
+*/
+extern int pthread_mutexattr_settype(pthread_mutexattr_t *attr,
+                                     int kind);
+
+/** @nqPosix
+* Gets the mutex type: fast, recursive or error-checking.
+*
+* @linkPthread
+*
+* @param attr The address of the attributes structure.
+* @param kind Pointer to the location where the mutex kind value is copied.
+*
+* @return 0.
+*/
+extern int pthread_mutexattr_gettype(const pthread_mutexattr_t *attr,
+                                     int *kind);
+
+/* Functions for handling conditional variables.  */
+
+/** @nqPosix
+* Initializes a condition variable.
+*
+* @linkPthread
+*
+* @param cond Pointer to the condition variable structure.
+* @param cond_attr Pointer to the attributes structure, should be NULL as
+* Native Client does not support any attributes for a condition variable at
+* this stage.
+*
+* @return 0 for success, 1 otherwise.
+*/
+extern int pthread_cond_init(pthread_cond_t *cond,
+                             pthread_condattr_t *cond_attr);
+
+/** @nqPosix
+* Destroys a condition variable.
+*
+* @linkPthread
+*
+* @param cond Pointer to the condition variable structure.
+*
+* @return 0 for success, non-zero error code otherwise.
+*/
+extern int pthread_cond_destroy(pthread_cond_t *cond);
+
+/** @nqPosix
+* Signals a condition variable, waking up one of the threads waiting on it.
+*
+* @linkPthread
+*
+* @param cond Pointer to the condition variable structure.
+*
+* @return 0 for success, non-zero error code otherwise.
+*/
+extern int pthread_cond_signal(pthread_cond_t *cond);
+
+/** @nqPosix
+* Wakes up all threads waiting on a condition variable.
+*
+* @linkPthread
+*
+* @param cond Pointer to the condition variable structure.
+*
+* @return 0 for success, non-zero error code otherwise.
+*/
+extern int pthread_cond_broadcast(pthread_cond_t *cond);
+
+/** @nqPosix
+* Waits for a condition variable to be signaled or broadcast.
+*
+* @linkPthread
+*
+* @param cond Pointer to the condition variable structure.
+* @param mutex Pointer to the mutex structure. The mutex is assumed to be locked
+* when this function is called.
+*
+* @return 0 for success, non-zero error code otherwise.
+*/
+extern int pthread_cond_wait(pthread_cond_t *cond,
+                             pthread_mutex_t *mutex);
+
+/** @nqPosix
+* Waits for condition variable cond to be signaled or broadcast until
+* abstime.
+*
+* @linkPthread
+*
+* @param cond Pointer to the condition variable structure.
+* @param mutex Pointer to the mutex structure. The mutex is assumed to be locked
+* when this function is called.
+* @param abstime Absolute time specification; zero is the beginning of the epoch
+* (00:00:00 GMT, January 1, 1970).
+*
+* @return 0 for success, non-zero error code otherwise.
+*/
+int pthread_cond_timedwait_abs(pthread_cond_t *cond,
+                               pthread_mutex_t *mutex,
+                               struct timespec *abstime);
+
+ /** @nqPosix
+* Waits for condition variable cond to be signaled or broadcast; wait time is
+* limited by reltime.
+*
+* @linkPthread
+*
+* @param cond Pointer to the condition variable structure.
+* @param mutex Pointer to the mutex structure. The mutex is assumed to be locked
+* when this function is called.
+* @param reltime Time specification, relative to the current time.
+*
+* @return 0 for success, non-zero error code otherwise.
+*/
+int pthread_cond_timedwait_rel(pthread_cond_t *cond,
+                               pthread_mutex_t *mutex,
+                               struct timespec *reltime);
+
+/**
+ * Defined for POSIX compatibility; pthread_cond_timedwait() is actually
+ * a macro calling pthread_cond_timedwait_abs().
+ */
+#define pthread_cond_timedwait pthread_cond_timedwait_abs
+
+
+/* Threads */
+/** Thread entry function type. */
+typedef void *(*nc_thread_function)(void *p);
+/** Thread identifier type. */
+typedef uint32_t pthread_t;
+
+/** A structure representing thread attributes. */
+typedef struct {
+  int joinable; /**< 1 if the thread is joinable, 0 otherwise */
+  size_t stacksize; /**< The requested thread stack size in bytes. */
+} pthread_attr_t;
+
+
+/** Joinable thread type; for use with pthread_attr_setdetachstate(). */
+#define PTHREAD_CREATE_JOINABLE 1
+/** Detached thread type; for use with pthread_attr_setdetachstate(). */
+#define PTHREAD_CREATE_DETACHED 0
+
+/** Minimum stack size; for use with pthread_attr_setstacksize(). */
+#define PTHREAD_STACK_MIN     (1024)
+
+/* default stack size */
+#define PTHREAD_STACK_DEFAULT (512 * 1024)
+
+/* Thread functions  */
+
+/** @nqPosix
+* Creates a thread.
+*
+* @linkPthread
+*
+* @param[out] thread_id A pointer to the location where the identifier of the
+* newly created thread is stored on success.
+* @param attr Thread attributes structure.
+* @param start_routine Thread function.
+* @param arg A single argument that is passed to the thread function.
+*
+* @return 0 for success, non-zero error code otherwise.
+*/
+extern int pthread_create(pthread_t *thread_id,
+                          const pthread_attr_t *attr,
+                          void *(*start_routine) (void *p),
+                          void *arg);
+
+/** @nqPosix
+* Obtains the identifier of the current thread.
+*
+* @linkPthread
+*
+* @return Thread ID of the current thread.
+*/
+extern pthread_t pthread_self(void);
+
+/** @nqPosix
+* Compares two thread identifiers.
+*
+* @linkPthread
+*
+* @param thread1 Thread ID of thread A.
+* @param thread2 Thread ID of thread B.
+*
+* @return 1 if both identifiers belong to the same thread, 0 otherwise.
+*/
+extern int pthread_equal(pthread_t thread1, pthread_t thread2);
+
+/** @nqPosix
+* Terminates the calling thread.
+*
+* @linkPthread
+*
+* @param retval Return value of the thread.
+*
+* @return The function never returns.
+*/
+extern void pthread_exit(void *retval);
+
+/** @nqPosix
+* Makes the calling thread wait for termination of another thread.
+*
+* @linkPthread
+*
+* @param th The identifier of the thread to wait for.
+* @param thread_return If not NULL, points to the location where the return
+* value of the terminated thread is stored upon completion.
+*
+* @return 0 on success, non-zero error code otherwise.
+*/
+extern int pthread_join(pthread_t th, void **thread_return);
+
+/** @nqPosix
+* Indicates that the specified thread is never to be joined with pthread_join().
+* The resources of that thread will therefore be freed immediately when it
+* terminates, instead of waiting for another thread to perform pthread_join()
<<Diff was trimmed, longer than 597 lines>>


More information about the pld-cvs-commit mailing list