Build a basic shared library on Linux; may not work!

This commit is contained in:
Richard Dawe 2006-03-11 17:15:25 +00:00
parent d7fe11594f
commit 3f0a4a4e9b
12 changed files with 217 additions and 3 deletions

0
AUTHORS Normal file
View file

2
COPYING Normal file
View file

@ -0,0 +1,2 @@
Please see COPYRIGHT and OPENSOLARIS.LICENSE for the copyright
and license details.

0
ChangeLog Normal file
View file

21
Makefile.am Normal file
View file

@ -0,0 +1,21 @@
lib_LTLIBRARIES = libumem.la
libumem_la_SOURCES = init_lib.c \
umem_agent_support.c \
umem_fail.c \
umem_fork.c \
umem_update_thread.c \
vmem_mmap.c \
vmem_sbrk.c \
envvar.o \
getpcstack.o \
malloc.o \
misc.o \
vmem_base.o \
umem.o \
vmem.o
# XXX: Standalone version?
# See <http://cvs.opensolaris.org/source/xref/on/usr/src/lib/libumem/Makefile.com>
# XXX: Non-i386: SPARC asm. x86_64?
# Convert this to GNU as format: i386_subr_sol.s

0
NEWS Normal file
View file

143
README-alpha Normal file
View file

@ -0,0 +1,143 @@
This is the GNU mailutils package.
This document describes the actions needed to build the pre-release
or CVS version of the package. See end of file for copying conditions.
* Introduction
This is a *pre-release* version, and not ready for production use
yet. If you are taking source from CVS, you will need to have libtool,
automake, and autoconf installed to help contribute. See the chapter
`Building' for the detailed instructions. The script autogen.sh is
provided to help autoconfigure mailutils from the cvs src. After you
run autogen.sh, there should be a file 'INSTALL' with (generic)
installation instructions. Package-specific installation instructions
are set forth in the file README.
Please, note that the accompanying documentation may be inaccurate
or incomplete. The ChangeLog file is the authoritative documentation of
all recent changes.
Report bugs to <bug-mailutils@gnu.org>
* Checking Out the Sources
The following instructions apply if you wish to obtain sources from
the CVS repository:
To checkout the source tree from CVS issue the following command:
CVS_RSH=ssh \
cvs -d :ext:anoncvs@savannah.gnu.org:/cvsroot/mailutils checkout mailutils
Make sure SSHv2 is used.
This will give you read-only access. If you think you need write access,
contact the mailing list.
* Building
In order to build this you will first need to have right versions
of autotools and some auxiliary GNU programs. At the time of this
writing these are:
Package Version (>=)
======== ============
automake 1.8.5
autoconf 2.59
libtool 1.5.8
gettext 0.14.1
gawk 3.1.3
You will also need bison (or yacc) and flex. The grammar sources
were written so that any version of yacc or bison should be able to
handle them, however using recent bison is anyway recommended. The lex
sources could theoretically be compiled with AT&T lex. I have not
tested this, however, so using flex is higly recommended. I use flex
2.5.4.
To prepare the package for building run autogen.sh. Then run
./configure with the desired options (See INSTALL and README for the
detailed instructions). Finally, run make. Notice that the first make
of the package should be made in the source directory. Subsequent
makes can use build directory different from the source one.
* Debugging
To enable additional debugging information, configure the package
with --enable-debug option.
Unless you compile mailutils statically, you will need to run
following command to debug any utility:
libtool --mode execute gdb UTILITY-NAME
Sometimes it is impossible or inconvenient to start a utility from
the debugger. In this case, use --HANG option, which is supported by
any of the mailutils programs. The option instructs the program to
sleep for a given number of seconds (3600 by default) right after
startup. For example, to debug `mimeview' utility, run
mimeview --HANG [OTHER-OPTIONS]
Then switch to another terminal, get the PID of the ivoked utility and
attach to it using gdb:
gdb mimeview PID
Once in gdb, issue the following command
set _argp_hang=0
Now set your breakpoints and proceed as usual.
* Importing gnulib files
Mailutils imports several source files from gnulib. These go
mainly to the conventional library libmuaux (directory lib/), but
several of them are incorporated into the main library libmailutils
(directory mailbox/). The imported sources are kept in the CVS
repository to avoid using eventually unstable versions appearing in
the main gnulib CVS. Once in a time we update the sources. The update
procedure is quite straightforward: change to the root directory of
the mailutils tree and run `gnulib-sync' script:
$ cd mailutils
$ scripts/gnulib-sync $HOME/src/gnulib
The script takes a single argument: name of the directory with the
copy of gnulib source tree (see http://savannah.gnu.org/projects/gnulib
for information on how to obtain gnulib sources). After incorporating
the files, gnulib-sync leaves in the current directory two files named
gnulib.changelog and gnulib.cvs. The file gnulib.changelog contains
an entry to be prepended to ChangeLog, the file gnulib.cvs is a shell
script with the commands necessary to incorporate all the changes into
CVS.
If you need to add more gnulib modules to mailutils, add their
names to gnulib.modules file, following the instructions in its
heading comment. Please avoid placing modules in :mailutils section, as
this may lead to unwanted name clashes when linking user programs with
libmailutils.
* Copyright information:
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Permission is granted to anyone to make or distribute verbatim copies
of this document as received, in any medium, provided that the
copyright notice and this permission notice are preserved,
thus giving the recipient permission to redistribute in turn.
Permission is granted to distribute modified versions
of this document, or of portions of it,
under the above conditions, provided also that they
carry prominent notices stating who last changed them.
Local Variables:
mode: outline
paragraph-separate: "[ ]*$"
version-control: never
End:

17
TODO Normal file
View file

@ -0,0 +1,17 @@
To-do List for the Linux port of umem
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Autconf'ery for <stdint.h> in "sol_compat.h".
* Fix #define wreakage for THR_RETURN, THR_API in "sol_compat.h".
* Replace use of Ecelerity's portable atomic locking header with something
equivalent in "sol_compat.h".
* ec_debug_vprintf -> something else?
* doxygen'ate the headers/code, to produce reference docs.
* rpm spec file.
* test suite.

3
autogen.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
autoreconf -f -i -s

15
configure.ac Normal file
View file

@ -0,0 +1,15 @@
AC_INIT([umem], [1.0], [], [umem])
AM_INIT_AUTOMAKE
AC_PROG_CC
AM_PROG_AS
AC_PROG_LIBTOOL
AC_C_INLINE
AC_CHECK_HEADERS([sys/mman.h sys/sysmacros.h])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

View file

@ -6,6 +6,15 @@
#ifndef _EC_UMEM_SOL_COMPAT_H_
#define _EC_UMEM_SOL_COMPAT_H_
#include "config.h"
#include <stdint.h>
#include <pthread.h>
#define INLINE inline
#define THR_RETURN void *
#define THR_API
#if defined(__MACH__) || defined(_WIN32)
#define NO_WEAK_SYMBOLS
#define _umem_cache_alloc(a,b) umem_cache_alloc(a,b)
@ -89,7 +98,7 @@ static INLINE int thr_create(void *stack_base,
# define RTLD_FIRST 0
#endif
#include "ec_atomic.h"
/*#include "ec_atomic.h"*/
#define P2PHASE(x, align) ((x) & ((align) - 1))
#define P2ALIGN(x, align) ((x) & -(align))

View file

@ -38,9 +38,10 @@
#include <signal.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include "misc.h"
#include "util.h"
/*#include "util.h"*/
static volatile int umem_exiting = 0;
#define UMEM_EXIT_ABORT 1
@ -126,7 +127,8 @@ umem_panic(const char *format, ...)
umem_error_enter("\n");
va_start(va, format);
ec_debug_vprintf(DCRITICAL, DMEM, format, va);
/*ec_debug_vprintf(DCRITICAL, DMEM, format, va);*/
fvprintf(stderr, format, va);
va_end(va);
print_stacktrace();

View file

@ -40,6 +40,8 @@
#include <sys/sysmacros.h>
#endif
#include <unistd.h>
#include "vmem_base.h"
#define ALLOC_PROT PROT_READ | PROT_WRITE | PROT_EXEC