8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 16:43:03 +01:00

NetBSD port from James K. Lowden

This commit is contained in:
skidder 2004-05-20 23:05:02 +00:00
parent c5765f0bd7
commit 277788de7a
11 changed files with 491 additions and 28 deletions

View File

@ -0,0 +1,74 @@
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# You may obtain a copy of the Licence at
# http://www.gnu.org/licences/lgpl.html
#
# As a special exception this file can also be included in modules
# with other source code as long as that source code has been
# released under an Open Source Initiative certificed licence.
# More information about OSI certification can be found at:
# http://www.opensource.org
#
# This module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public Licence for more details.
#
# This module was created by members of the firebird development
# team. All individual contributions remain the Copyright (C) of
# those individuals and all rights are reserved. Contributors to
# this file are either listed below or can be obtained from a CVS
# history command.
#
# Created by: Mark O'Donohue <mark.odonohue@ludwig.edu.au>
#
# Contributor(s): Chris Knight <chris@e-easy.com.au>
#
#
# $Id: Makefile.in,v 1.1 2004-05-20 23:04:23 skidder Exp $
#
ROOT=..
include $(ROOT)/gen/make.defaults
include $(ROOT)/gen/make.platform
include $(ROOT)/gen/make.rules
include $(ROOT)/gen/make.shared.variables
FirebirdInstallPrefix=@prefix@
@SET_MAKE@
FIREBIRD=$(FirebirdInstallPrefix)
export -n FIREBIRD
export -n INTERBASE
.PHONY: install
# Some of these targets are run from the root tree of the build.
# those need to know where the install subdirectory is kept.
# Others are run locally these need to know the path back to the
# root of the build tree.
BuildRoot=$(GEN_ROOT)
InstallRoot=.
FirebirdBuildPrefix=$(GEN_ROOT)
#export FirebirdBuildPrefix
#export FirebirdInstallPrefix
#export PackageVersion
BuildVersion=$(FirebirdVersion).$(BuildNum)
Version=$(BuildVersion)-$(PackageVersion)
install:
(cd $(GEN_ROOT)/; ./install/install.netbsd.sh)

View File

@ -0,0 +1,328 @@
#!/bin/sh
#
# This library is part of the FirebirdSQL project
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# You may obtain a copy of the Licence at
# http://www.gnu.org/licences/lgpl.html
#
# As a special exception this file can also be included in modules
# with other source code as long as that source code has been
# released under an Open Source Initiative certificed licence.
# More information about OSI certification can be found at:
# http://www.opensource.org
#
# This module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public Licence for more details.
#
# This module was created by members of the firebird development
# team. All individual contributions remain the Copyright (C) of
# those individuals and all rights are reserved. Contributors to
# this file are either listed below or can be obtained from a CVS
# history command.
#
# Created by: Chris Knight <chris@e-easy.com.au>
#
# Contributor(s):
# James K. Lowden <jklowden@schemamania.org>
#
# $Id: install.sh.in,v 1.1 2004-05-20 23:04:23 skidder Exp $
#
# Install script for FirebirdSQL database engine
#------------------------------------------------------------------------
#
# Copy file if it exists
#
copyIfExists() {
OldFile=$1
NewFile=$2
if [ -f $OldFile ]
then
cp $OldFile $NewFile
fi
}
InstallFirebirdPrefix=@prefix@
InstallPrefix=${InstallFirebirdPrefix%/firebird}
unset InstallFirebirdPrefix
if [ -d @prefix@ ]; then
echo Backing up @prefix@ to $InstallPrefix/firebird.old
if [ -d $InstallPrefix/firebird.old ]; then
rm -rf $InstallPrefix/firebird.old
fi
cp -Rp @prefix@ $InstallPrefix/firebird.old
fi
if [ `id -u` -ne 0 ]; then
echo; echo "You must be root to run this step!"; echo; echo
exit 1
fi
#
# Establish the values of the Firebird user and group ids
#
echo Establishing user 'firebird'
fbGID=0
if ! groupinfo -e firebird; then # create the group
fbGID=90
while [ ! -z `id -gn $fbGID 2>/dev/null` ]
do
fbGID=$(($fbGID+1))
done
# Create the Firebird group
groupadd -v -g $fbGID firebird
else
fbGID=$(groupinfo firebird |grep ^gid |awk '{print $2}')
fi
# make sure we have the group
groupinfo -e firebird
if [ $? -eq 0 -a $fbGID -ne 0 ]; then
echo "user 'firebird' has gid $fbGID".
else
echo "Unable to create group 'firebird' - please create it manually."
echo "You might also wish to create the 'firebird' user at this time, as well."
exit 1
fi
#
# Create the Firebird user, if not extant
#
fbUID=0
if ! userinfo -e firebird; then # create the user
fbUID=90
while [ ! -z `id -un $fbUID 2>/dev/null` ]
do
fbUID=$(($fbUID+1))
done
if [ ! -d @prefix@ ]; then
$m=-m
fi
useradd -v -u $fbUID -g $fbGID -s /bin/sh \
$m -d @prefix@ \
-c "Firebird Database Administrator" \
firebird
else
fbUID=`id -u firebird 2>/dev/null`
fi
# Make sure we have the user.
userinfo -e firebird
if [ $? -eq 0 -a $fbUID -ne 0 ]; then
echo "user 'firebird' has uid $fbUID".
else
echo "Unable to create user 'firebird' - please create it manually."
exit 1
fi
# Making an assumption that this program is being run in the gen directory
BuildRootDir=..
BuiltFBDir=./firebird # Location of the just-built fb.
DestDir=@prefix@
# The guts of the tranfer of files and other directories
# (mkdir -p <dirname> does not elicit an error message if the <dirname> exists.)
echo Installing binaries
for D in "bin examples help include intl doc/sql.extensions UDF"
do
mkdir -p $DestDir/$D || exit
done
cp -f $BuiltFBDir/bin/fb_inet_server $DestDir/bin/fb_inet_server || exit
cp $BuiltFBDir/bin/gbak $DestDir/bin/gbak || exit
cp $BuiltFBDir/bin/gdef $DestDir/bin/gdef || exit
cp $BuiltFBDir/bin/gds_drop $DestDir/bin/gds_drop || exit
copyIfExists $BuiltFBDir/bin/fb_lock_mgr $DestDir/bin/fb_lock_mgr || exit
copyIfExists $BuiltFBDir/bin/fb_lock_print $DestDir/bin/fb_lock_print || exit
copyIfExists $BuiltFBDir/bin/gds_pipe $DestDir/bin/gds_pipe || exit
cp $BuiltFBDir/bin/gfix $DestDir/bin/gfix || exit
cp $BuiltFBDir/bin/gpre $DestDir/bin/gpre || exit
cp $BuiltFBDir/bin/gsec $DestDir/bin/gsec || exit
copyIfExists $BuiltFBDir/bin/gsplit $DestDir/bin/gsplit || exit
cp $BuiltFBDir/bin/gstat $DestDir/bin/gstat || exit
copyIfExists $BuiltFBDir/bin/isc4.gbak $DestDir/bin/isc4.gbk || exit
cp $BuiltFBDir/bin/isql $DestDir/bin/isql || exit
cp $BuiltFBDir/bin/qli $DestDir/bin/qli || exit
# Copy examples only if we have them
exampleFiles=`find $BuiltFBDir/examples/ -type f -print`
if [ -z "$exampleFiles" ]; then
echo "Example files have not been built!"
else
echo Installing examples
for i in $exampleFiles
do
cp $i $DestDir/examples || exit
done
fi
copyIfExists $BuiltFBDir/help/help.gbak $DestDir/help || exit
cp $BuiltFBDir/help/help.fdb $DestDir/help || exit
cp $BuiltFBDir/firebird.msg $DestDir/firebird.msg || exit
cp $BuiltFBDir/security.fdb $DestDir/security.fdb.sample || exit
cp $BuiltFBDir/include/*.h $DestDir/include || exit
cp -Rf $BuiltFBDir/lib/libfbembed.so* $DestDir/lib || exit
cp -Rf $BuiltFBDir/lib/libfbclient.so* $DestDir/lib || exit
cp -f $BuiltFBDir/lib/libib_util.so $DestDir/lib/libib_util.so || exit
cp $BuiltFBDir/intl/libfbintl.so $DestDir/intl/fbintl || exit
cp $BuiltFBDir/UDF/ib_udf.so $DestDir/UDF/ || exit
cp $BuiltFBDir/UDF/fbudf.so $DestDir/UDF/ || exit
# Copy the sql-declarations into the UDF-directory
cp $BuildRootDir/src/extlib/ib_udf.sql $DestDir/UDF/ || exit
cp $BuildRootDir/src/extlib/fbudf/fbudf.sql $DestDir/UDF/ || exit
# Note that this copies files from outside the build tree.
echo Installing documentation
cp $BuildRootDir/doc/README.* $DestDir/doc || exit
cp $BuildRootDir/doc/WhatsNew $DestDir || exit
cp $BuildRootDir/doc/README.user $DestDir/README || exit
SQLEXTENSIONS=`find $BuildRootDir/doc/sql.extensions ! -type d | grep -v CVS`
cp ${SQLEXTENSIONS} $DestDir/doc/sql.extensions || exit
cp $BuiltFBDir/misc/firebird.conf $DestDir/firebird.conf.sample || exit
echo "#" >> $DestDir/aliases.conf.sample
echo "# List of known database aliases" >> $DestDir/aliases.conf.sample
echo "# ------------------------------" >> $DestDir/aliases.conf.sample
echo "#" >> $DestDir/aliases.conf.sample
echo "# Examples:" >> $DestDir/aliases.conf.sample
echo "#" >> $DestDir/aliases.conf.sample
echo "# employee = /$DestDir/examples/employee.fdb" >> $DestDir/aliases.conf.sample
echo "#" >> $DestDir/aliases.conf.sample
echo Setting ownership and permissions on installed files
chown -R firebird:firebird @prefix@ || exit
chmod -R o= @prefix@ || exit
# Now fix up the mess.
# fix up directories
for i in `find @prefix@ -print`
do
FileName=$i
if [ -d $FileName ]; then
chmod u=rwx,go=rx $FileName || exit
fi
done
# make lib ldconfig-compatible
chown -R root:wheel @prefix@/lib || exit
# make the following read-only
chmod -R a=r @prefix@/WhatsNew || exit
for i in `find @prefix@/doc -type f -print`
do
chmod a=r $i || exit
done
chmod -R a=r @prefix@/include/* || exit
chmod -R a=r @prefix@/intl/* || exit
chmod -R ug=rx,o= @prefix@/UDF/* || exit
chmod -R ug=rx,o= @prefix@/intl/fbintl || exit
chmod -R a=rx @prefix@/lib/* || exit
cd @prefix@/bin
for i in `ls`
do
chmod ug=rx,o= $i || exit
done
chmod a=rx isql qli
# SUID is needed for running server programs.
for i in fb_lock_mgr gds_drop fb_inet_server
do
if [ -f $i ]; then
chmod ug=rx,o= $i || exit
chmod ug+s $i || exit
fi
done
cd @prefix@
# Lock files
for i in isc_init1 isc_lock1 isc_event1
do
FileName=$i.`hostname`
touch $FileName
chmod ug=rw,o= $FileName || exit
chown firebird:firebird $FileName || exit
done
touch firebird.log
chown firebird:firebird firebird.log || exit
chmod ug=rw,o= firebird.log || exit
chmod a=r firebird.msg README || exit
chown root:wheel *.sample || exit
chmod ug=r,o= *.sample || exit
# make databases writable by firebird only
# local database connections are not a good idea
chmod ug=rw,o= examples/*.fdb || exit
chmod ug=rw,o= help/*.fdb || exit
# install the samples if they don't exist
[ -f aliases.conf ] || install -o firebird -g firebird -m 440 aliases.conf.sample aliases.conf
[ -f firebird.conf ] || install -o firebird -g firebird -m 440 firebird.conf.sample firebird.conf
[ -f security.fdb ] || install -o firebird -g firebird -m 660 security.fdb.sample security.fdb
#
# add the gds service, if need be, and restart inetd
#
if ! grep ^gds_db /etc/services
then
echo Adding InterBase Database Remote Protocol to /etc/services
cat >>/etc/services <<EOF
gds_db 3050/tcp #InterBase Database Remote Protocol
EOF
fi
if ! grep ^gds_db /etc/inetd.conf
then
echo Adding firebird to /etc/inetd.conf
cat >>/etc/inetd.conf <<EOF
gds_db stream tcp nowait firebird @prefix@/bin/fb_inet_server fb_inet_server
EOF
fi
if [ -f /var/run/inetd.pid ]
then
echo Reloading inetd
/etc/rc.d/inetd reload
fi
# shared lib startup script
if [ -d $InstallPrefix/etc/rc.d ]
then
echo Installing $InstallPrefix/etc/rc.d/000.firebird.sh
(
echo "#! /bin/sh"; echo "[ -d @prefix@/lib ] && /sbin/ldconfig -m @prefix@/lib"
) > $InstallPrefix/etc/rc.d/000.firebird.sh
chmod a=rx $InstallPrefix/etc/rc.d/000.firebird.sh
fi
echo Done installing Firebird

View File

@ -0,0 +1,36 @@
# The contents of this file are subject to the Interbase Public
# License Version 1.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy
# of the License at http://www.Inprise.com/IPL.html
#
# Software distributed under the License is distributed on an
# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
# or implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code was created by Inprise Corporation
# and its predecessors. Portions created by Inprise Corporation are
#
# Copyright (C) 2000 Inprise Corporation
# All Rights Reserved.
# Contributor(s): ______________________________________.
# Start of file prefix.netbsd: $(VERSION) @PLATFORM@
#$Id: prefix.netbsd,v 1.1 2004-05-20 23:04:27 skidder Exp $
# 2 Oct 2002, Nickolay Samofatov - Major Cleanup
OS_ServerFiles=inet_server.cpp
LINK_OPTS=-Wl,--rpath -Wl,@prefix@/lib
PROD_FLAGS=-O -fno-builtin -DNDEBUG -pipe -MMD -fPIC
DEV_FLAGS=-g -DDEBUG_GDS_ALLOC -pipe -MMD -p -fPIC -Wall -Wno-switch -Wno-parentheses
LIB_LINK_OPTIONS:=-shared
## LIB_LINK_RPATH:=-Wl,-rpath,
LIB_LINK_RPATH:=-Wl,--rpath -Wl,
LIB_LINK_SONAME:=-Wl,-soname,
EMBED_UTIL_TARGETS=gstat gds_drop gds_relay gsec nbackup fb_lock_print
CLIENT_UTIL_TARGETS=gds_drop gds_delay gstat gsec fbguard fbmgr_bin nbackup fb_lock_print
Physical_IO_Module=os/posix/unix.cpp

View File

@ -6,29 +6,34 @@ rm -Rf temp 2>/dev/null
echo Removing files in this directory
rm aclocal.m4 2>/dev/null
rm -f aclocal.m4 2>/dev/null
rm config.log 2>/dev/null
rm config.status 2>/dev/null
rm configure 2>/dev/null
rm libtool 2>/dev/null
rm Makefile 2>/dev/null
rm -f Makefile 2>/dev/null
echo Removing files in builds directory
rm builds/make.new/config/config.guess 2>/dev/null
rm builds/make.new/config/config.sub 2>/dev/null
rm builds/make.new/config/ltmain.sh 2>/dev/null
rm -f builds/make.new/config/config.guess 2>/dev/null
rm -f builds/make.new/config/config.sub 2>/dev/null
rm -f builds/make.new/config/ltmain.sh 2>/dev/null
rm -f builds/make.new/config/ltconfig 2>/dev/null
rm -f builds/make.new/config/ltcf-c.sh 2>/dev/null
rm -f builds/make.new/config/ltcf-cxx.sh 2>/dev/null
rm -f builds/make.new/config/config.h.in 2>/dev/null
echo Removing files in src directory
rm src/include/gen/autoconfig.h 2>/dev/null
rm src/include/gen/blrtable.h 2>/dev/null
rm src/v5_examples/Makefile 2>/dev/null
rm -f src/v5_examples/Makefile 2>/dev/null
# Cpp from epp files
rm src/alice/alice_meta.cpp 2>/dev/null
rm src/burp/backup.cpp 2>/dev/null
rm src/burp/restore.cpp 2>/dev/null
rm src/dsql/dsql.tab.c 2>/dev/null
rm src/dsql/array.cpp 2>/dev/null
rm src/dsql/blob.cpp 2>/dev/null
rm src/dsql/metd.cpp 2>/dev/null

View File

@ -1,4 +1,4 @@
dnl $Id: configure.in,v 1.199 2004-05-13 14:04:47 kkuznetsov Exp $
dnl $Id: configure.in,v 1.200 2004-05-20 23:04:19 skidder Exp $
dnl ############################# INITIALISATION ###############################
@ -89,7 +89,7 @@ case "$target" in
PLATFORM=NETBSD
AC_DEFINE(NETBSD, 1, [Define this if OS is NetBSD])
LOCK_MANAGER_FLG=Y
EDITLINE_FLG=N
EDITLINE_FLG=Y
SHRLIB_EXT=so
;;
@ -180,6 +180,19 @@ AC_ARG_ENABLE(debug,
esac])
AC_SUBST(PROD_BUILD_FLG)
HAVE_MULTI_THREAD_FLG=Y
AC_ARG_ENABLE(threads,
[ --enable-threads build threads version (default=yes)],
[case "$enableval" in
yes) HAVE_MULTI_THREAD_FLG=Y;;
no) HAVE_MULTI_THREAD_FLG=N;;
*) AC_MSG_ERROR(bad value '${enableval}' for --enable-threads);;
esac])
if test "$HAVE_MULTI_THREAD_FLG" = "Y"; then
AC_DEFINE(HAVE_MULTI_THREAD, 1,
[Define this if multi-threading should be supported])
fi
AC_ARG_ENABLE(raw-devices,
[ --enable-raw-devices enable databases on raw devices (default on POSIX)],
[case "$enableval" in
@ -839,6 +852,12 @@ case "$PLATFORM" in
;;
NETBSD)
AC_CONFIG_FILES([gen/install/install.netbsd.sh:builds/install/arch-specific/netbsd/install.sh.in
],[chmod a+x gen/install/install.netbsd.sh 2>/dev/null])
;;
SINIX-Z)
AC_CONFIG_FILES([gen/install/pkginfo:builds/install/arch-specific/sinixz/pkginfo.in
gen/install/prototype:builds/install/arch-specific/sinixz/prototype.in

View File

@ -32,7 +32,7 @@
* Contributor(s):
*
*
* $Id: locks.h,v 1.13 2004-05-02 23:03:47 skidder Exp $
* $Id: locks.h,v 1.14 2004-05-20 23:04:30 skidder Exp $
*
*/
@ -90,7 +90,7 @@ public:
/* Process-local spinlock. Used to manage memory heaps in threaded environment. */
// Pthreads version of the class
#if !defined(SOLARIS) && !defined(DARWIN) && !defined(FREEBSD)
#if !defined(SOLARIS) && !defined(DARWIN) && !defined(FREEBSD) && !defined(NETBSD)
class Mutex {
private:
pthread_spinlock_t spinlock;
@ -137,7 +137,7 @@ public:
system_call_failed::raise("mutex_unlock");
}
};
#else // DARWIN and FREEBSD
#else // DARWIN and FREEBSD and NETBSD
class Mutex {
private:
pthread_mutex_t mlock;

View File

@ -70,7 +70,7 @@ const ConfigImpl::ConfigEntry ConfigImpl::entries[] =
#else
{TYPE_INTEGER, "LockMemSize", (ConfigValue) 262144}, // bytes
#endif
#ifdef SINIXZ
#if defined(SINIXZ) || defined(FREEBSD) || defined(NETBSD)
{TYPE_INTEGER, "LockSemCount", (ConfigValue) 25}, // semaphores
#else
{TYPE_INTEGER, "LockSemCount", (ConfigValue) 32}, // semaphores

View File

@ -30,7 +30,7 @@
* John Bellardo <bellardo@cs.ucsd.edu>
*
*
* $Id: firebird.h,v 1.21 2004-05-18 23:27:06 brodsom Exp $
* $Id: firebird.h,v 1.22 2004-05-20 23:04:36 skidder Exp $
*
*/
@ -68,9 +68,11 @@
#endif
// Check if we need thread synchronization
#if defined(HAVE_MULTI_THREAD)
# if defined(SUPERSERVER) || defined(SUPERCLIENT) || \
defined(WIN_NT) || defined(SOLARIS_MT) || defined (VMS)
#define MULTI_THREAD
# define MULTI_THREAD 1
# endif
#endif
#ifndef NULL

View File

@ -225,6 +225,9 @@
/* Maximum allowed pathname length */
#define MAXPATHLEN 260 // should correspond to MAX_PATH define in windef.h
/* Windows platforms support threads */
#define HAVE_MULTI_THREAD 1
/* CPU types */
#undef PowerPC
#undef sparc

View File

@ -49,7 +49,7 @@
*
*/
/*
$Id: common.h,v 1.116 2004-05-18 23:38:37 brodsom Exp $
$Id: common.h,v 1.117 2004-05-20 23:04:44 skidder Exp $
*/
#ifndef JRD_COMMON_H
@ -341,10 +341,10 @@ static inline int sinixz_sigaction(int sig, const struct sinixz_sigaction *act,
#define KILLER_SIGNALS
#define NO_NFS /* no MTAB_OPEN or MTAB_CLOSE in isc_file.c */
#define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t) length)
#define MOVE_FAST(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
#define MEMMOVE(from,to,length) memmove ((void *)(to), (void *)(from), (size_t) length)
#define MOVE_FAST(from,to,length) memcpy ((to), (from), (int) (length))
#define MOVE_FASTER(from,to,length) memcpy ((to), (from), (int) (length))
#define MOVE_CLEAR(to,length) memset ((to), 0, (int) (length))
#endif /* NETBSD */

View File

@ -41,7 +41,7 @@
*
*/
/*
$Id: inet.cpp,v 1.110 2004-05-18 22:01:52 brodsom Exp $
$Id: inet.cpp,v 1.111 2004-05-20 23:05:02 skidder Exp $
*/
#include "firebird.h"
#include <stdio.h>
@ -2237,14 +2237,12 @@ static int parse_line(
/* if we don't have a host_name match, don't bother */
if (strcmp(entry1, host_name))
#ifdef UNIX
#if !(defined SINIXZ)
#if (defined UNIX) && !(defined SINIXZ) && !(defined NETBSD)
if (entry1[1] == '@') {
if (!innetgr(&entry1[2], host_name, 0, 0))
return -1;
}
else
#endif
#endif
return -1;
@ -2266,8 +2264,7 @@ static int parse_line(
/* if they're in the user group: + they're in, - they're out */
#ifdef UNIX
#if !(defined SINIXZ)
#if (defined UNIX) && !(defined SINIXZ) && !(defined NETBSD)
if (entry2[1] == '@') {
if (innetgr(&entry2[2], 0, user_name, 0)) {
if (entry2[0] == '+')
@ -2284,7 +2281,6 @@ static int parse_line(
}
}
#endif
#endif
/* if we get here - we matched machine but not user - maybe next line ... */