* Apply some fixes for kFreeBSD debugger and OS detection

* Add --with-libversion flag to configure
  - Make OpenBSD version numbering system happy
* Force -ldl for HURD
* Fix off by one bug in grub/fs/fat.c
This commit is contained in:
pancake 2011-04-20 13:56:58 +02:00
parent 78209c2d43
commit 205a9285a4
10 changed files with 41 additions and 14 deletions

View File

@ -6,3 +6,7 @@
#
# -- pancake
acr -p
if [ -n "$1" ]; then
echo "./configure $@"
./configure $@
fi

View File

@ -19,6 +19,8 @@ INSTALL_MAN=@INSTALL_MAN@
INSTALL_LIB=@INSTALL_LIB@
VERSION=@VERSION@
LIBVERSION=@LIBVERSION@
# ./configure --with-ostype=[linux,osx,solaris,windows] # TODO: rename to w32, w64?
OSTYPE=@USEROSTYPE@
HOST_OS=@HOST_OS@

15
configure vendored
View File

@ -26,6 +26,7 @@ HAVE_OPENSSL=1
[ -z "${USEROSTYPE}" ] && USEROSTYPE="auto"
WITHPIC=1
WITHNONPIC=0
[ -z "${LIBVERSION}" ] && LIBVERSION="?"
split_host() {
S="$"
while : ; do
@ -153,7 +154,8 @@ printf "\nOptional Features:
--with-compiler Define compiler to use (see mk/) (USERCC=gcc)
--with-ostype Choose OS type ( gnulinux windows darwin ) (USEROSTYPE=auto)
--without-pic do not build libr as a program independent location
--with-nonpic build the library archives .a \n"
--with-nonpic build the library archives .a
--with-libversion specify different libversion (LIBVERSION=?)\n"
printf "\nSome influential environment variables:
CC C compiler command
CFLAGS C compiler flags
@ -197,7 +199,7 @@ echo "VERSION: 0.7.1"
echo "LANGS: c"
echo "REQUIRED: libdl"
echo "OPTIONAL: libewf"
echo "FLAGS: --without-debugger --without-ewf --without-gmp --without-magic --without-ssl --with-compiler=gcc --with-ostype=auto --without-pic --with-nonpic"
echo "FLAGS: --without-debugger --without-ewf --without-gmp --without-magic --without-ssl --with-compiler=gcc --with-ostype=auto --without-pic --with-nonpic --with-libversion=?"
exit 0
;;
"--cache-file")
@ -248,6 +250,7 @@ echo "FLAGS: --without-debugger --without-ewf --without-gmp --without-magic
--with-ostype) if [ -z "${value}" ]; then USEROSTYPE="auto"; else USEROSTYPE="${value}" ; fi ;;
"--without-pic") WITHPIC="0"; ;;
"--with-nonpic") WITHNONPIC="1"; ;;
--with-libversion) if [ -z "${value}" ]; then LIBVERSION="?"; else LIBVERSION="${value}" ; fi ;;
*) if [ "$value" ]; then eval "`echo $flag2=$value`" ;
else echo ; echo "WARNING: Unknown flag '$flag'." >&2 ; echo ; fi ;;
esac
@ -265,7 +268,7 @@ parse_options $1
shift
done
ENVWORDS="MANDIR INFODIR LIBDIR INCLUDEDIR LOCALSTATEDIR SYSCONFDIR DATADIR LIBEXECDIR SBINDIR BINDIR EPREFIX PREFIX SPREFIX TARGET HOST BUILD INSTALL INSTALL_LIB INSTALL_MAN INSTALL_PROGRAM INSTALL_DIR INSTALL_SCRIPT INSTALL_DATA HOST_OS HOST_CPU BUILD_OS BUILD_CPU TARGET_OS TARGET_CPU PKGNAME VPATH VERSION CONTACT CONTACT_NAME CONTACT_MAIL CC CFLAGS LDFLAGS HAVE_LANG_C DEBUGGER HAVE_LIB_DL DL_LIBS LIL_ENDIAN BIG_ENDIAN BYTEORDER HAVE_LIB_EWF HAVE_EWF HAVE_LIB_GMP HAVE_GMP HAVE_LIB_MAGIC HAVE_MAGIC HAVE_LIB_SSL HAVE_OPENSSL HAVE_LIB_LUA5_1 HAVE_LIB_TCC USERCC USEROSTYPE WITHPIC WITHNONPIC"
ENVWORDS="MANDIR INFODIR LIBDIR INCLUDEDIR LOCALSTATEDIR SYSCONFDIR DATADIR LIBEXECDIR SBINDIR BINDIR EPREFIX PREFIX SPREFIX TARGET HOST BUILD INSTALL INSTALL_LIB INSTALL_MAN INSTALL_PROGRAM INSTALL_DIR INSTALL_SCRIPT INSTALL_DATA HOST_OS HOST_CPU BUILD_OS BUILD_CPU TARGET_OS TARGET_CPU PKGNAME VPATH VERSION CONTACT CONTACT_NAME CONTACT_MAIL CC CFLAGS LDFLAGS HAVE_LANG_C DEBUGGER HAVE_LIB_DL DL_LIBS LIL_ENDIAN BIG_ENDIAN BYTEORDER HAVE_LIB_EWF HAVE_EWF HAVE_LIB_GMP HAVE_GMP HAVE_LIB_MAGIC HAVE_MAGIC HAVE_LIB_SSL HAVE_OPENSSL HAVE_LIB_LUA5_1 HAVE_LIB_TCC USERCC USEROSTYPE WITHPIC WITHNONPIC LIBVERSION"
create_environ
@ -367,6 +370,8 @@ USEROSTYPE="gnulinux"
else
if [ "$HOST_OS" = "gnu" ]; then
USEROSTYPE="gnulinux"
HAVE_LIB_DL="1"
DL_LIBS="-ldl"
else
if [ "$HOST_OS" = "gnu/kfreebsd" ]; then
USEROSTYPE="gnulinux"
@ -382,6 +387,8 @@ USEROSTYPE="gnulinux"
else
if [ "$HOST_OS" = "darwin" ]; then
USEROSTYPE="darwin"; fi; fi; fi; fi; fi; fi; fi; fi
if [ "$LIBVERSION" = "?" ]; then
LIBVERSION="$VERSION"; fi
SEDFLAGS=" -e '"
COUNT=0
for A in ${ENVWORDS} ; do
@ -428,7 +435,7 @@ done
do_remove
echo
echo "Final report:"
for A in PREFIX HAVE_LIB_EWF HAVE_LIB_GMP HAVE_LIB_SSL HAVE_LIB_TCC DEBUGGER USERCC USEROSTYPE ; do # REPORT
for A in PREFIX HAVE_LIB_EWF HAVE_LIB_GMP HAVE_LIB_SSL HAVE_LIB_TCC DEBUGGER USERCC USEROSTYPE VERSION LIBVERSION ; do # REPORT
eval VAL="\$${A}"
[ -z "${VAL}" ] && VAL="(null)"
echo " - ${A} = ${VAL}"

View File

@ -42,6 +42,8 @@ IFEQ USEROSTYPE auto ; {
IFEQ HOST_OS gnu ; {
(( GNU / HURD ))
USEROSTYPE = gnulinux ;
HAVE_LIB_DL = 1 ;
DL_LIBS = -ldl ;
}{
IFEQ HOST_OS gnu/kfreebsd ; {
USEROSTYPE = gnulinux ;
@ -62,8 +64,14 @@ IFEQ USEROSTYPE auto ; {
ARG_WITHOUT WITHPIC pic do not build libr as a program independent location ;
ARG_WITH WITHNONPIC nonpic build the library archives .a ;
ARG_WITH LIBVERSION=? libversion specify different libversion ;
REPORT PREFIX HAVE_LIB_EWF HAVE_LIB_GMP HAVE_LIB_SSL HAVE_LIB_TCC DEBUGGER USERCC USEROSTYPE ;
IFEQ LIBVERSION ? ; {
LIBVERSION = $VERSION ;
}
REPORT PREFIX HAVE_LIB_EWF HAVE_LIB_GMP HAVE_LIB_SSL HAVE_LIB_TCC
DEBUGGER USERCC USEROSTYPE VERSION LIBVERSION ;
(( TODO: Add the rest of .pc files here.. add a rule for acr? ))
SUBDIRS ./config-user.mk libr/include/r_userconf.h

View File

@ -46,7 +46,7 @@ install-symlink:
done
for a in ${LIBLIST} ; do \
ln -fs ${PWD}/$${a}/libr_$${a}.${EXT_SO} ${PFX}/lib/libr_$${a}.${EXT_SO} ; \
ln -fs ${PWD}/$${a}/libr_$${a}.${EXT_SO} ${PFX}/lib/libr_$${a}.${EXT_SO}.${VERSION} ; \
ln -fs ${PWD}/$${a}/libr_$${a}.${EXT_SO} ${PFX}/lib/libr_$${a}.${EXT_SO}.${LIBVERSION} ; \
ln -fs ${PWD}/$${a}/libr_$${a}.${EXT_AR} ${PFX}/lib/libr_$${a}.${EXT_AR} ; \
for b in $${a}/p/*.${EXT_SO} ; do \
if [ -e ${PWD}/$${b} ] ; then \
@ -61,9 +61,9 @@ install: install-includes install-pkgconfig
@${INSTALL_DIR} ${PFX}/lib
@for a in `find * -type f | grep -e '\.${EXT_SO}$$' | grep -v lib/t | grep lib | grep -v /p/` ; do \
b=`echo $$a|cut -d / -f 2`; \
echo " ${PFX}/lib/$$b.${VERSION}"; \
${INSTALL_LIB} $$a ${PFX}/lib/$$b.${VERSION} ; \
( cd ${PFX}/lib ; ln -fs $$b.${VERSION} $$b.0 ; ln -fs $$b.0 $$b ); \
echo " ${PFX}/lib/$$b.${LIBVERSION}"; \
${INSTALL_LIB} $$a ${PFX}/lib/$$b.${LIBVERSION} ; \
( cd ${PFX}/lib ; ln -fs $$b.${LIBVERSION} $$b.0 ; ln -fs $$b.0 $$b ); \
done
# object archives
@for a in `find * -type f | grep -e '\.a$$' | grep -v fs/p` ; do \
@ -102,7 +102,7 @@ deinstall uninstall:
rm -rf ${PFX}/bin/libr-test
# TODO: use for a in LIBLIST (like in binr/Makefile)
rm -rf ${PFX}/include/libr
rm -rf ${PFX}/lib/libr_*.so.${VERSION}
rm -rf ${PFX}/lib/libr_*.so.${LIBVERSION}
rm -rf ${PFX}/lib/libr_*.so.0
rm -rf ${PFX}/lib/libr_*.so
rm -rf ${PFX}/lib/libr_*.a

View File

@ -68,7 +68,7 @@ static int FSP(_mount)(RFSRoot *root) {
grubfs_bind_io (&root->iob, root->delta);
// XXX: null hook seems to be problematic on some filesystems
//return gfs->file->fs->dir (gfs->file->device, "/", NULL, 0)? R_FALSE:R_TRUE;
return gfs->file->fs->dir (gfs->file->device, "", do_nothing, 0)? R_FALSE:R_TRUE;
return gfs->file->fs->dir (gfs->file->device, "/", do_nothing, 0)? R_FALSE:R_TRUE;
}
static void FSP(_umount)(RFSRoot *root) {

View File

@ -730,7 +730,7 @@ grub_fat_dir (grub_device_t device, const char *path,
goto fail;
grub_memcpy (dirname, path, len);
p = dirname + len;
if (path[len - 1] != '/')
if (len>0 && path[len - 1] != '/')
*p++ = '/';
*p = '\0';
p = dirname;

View File

@ -1,6 +1,12 @@
#ifndef _INCLUDE_R_TYPES_BASE_H_
#define _INCLUDE_R_TYPES_BASE_H_
/* hack to make kfreebsd port simple */
#if __FreeBSD_kernel__
#undef __FreeBSD__
#define __FreeBSD__ 1
#endif
#define ut64 unsigned long long
#define st64 long long
#define ut32 unsigned int

View File

@ -188,7 +188,7 @@ R_API void r_file_mmap_free (RMmap *m);
#define R_SYS_OS "netbsd"
#elif __OpenBSD__
#define R_SYS_OS "openbsd"
#elif __FreeBSD__
#elif __FreeBSD__ || __FreeBSD_kernel__
#define R_SYS_OS "freebsd"
#else
#define R_SYS_OS "unknown"

View File

@ -23,7 +23,7 @@ real_all: ${EXTRA_TARGETS} ${LIBSO} ${LIBAR}
SRC=$(subst .o,.c,$(OBJ))
ifeq (${OSTYPE},gnulinux)
LIBNAME=${LDFLAGS_SONAME}${LIBSO}.${VERSION}
LIBNAME=${LDFLAGS_SONAME}${LIBSO}.${LIBVERSION}
else
LIBNAME=${LDFLAGS_SONAME}${LIBSO}
endif