1# * 2# * Copyright (c) 2000-2006 Alberto Reggiori <areggiori@webweaving.org> 3# * Dirk-Willem van Gulik <dirkx@webweaving.org> 4# * 5# * NOTICE 6# * 7# * This product is distributed under a BSD/ASF like license as described in the 'LICENSE' 8# * file you should have received together with this source code. If you did not get a 9# * a copy of such a license agreement you can pick up one at: 10# * 11# * http://rdfstore.sourceforge.net/LICENSE 12# * 13# * 14# * $Id: Makefile.PL,v 1.61 2006/06/19 10:10:21 areggiori Exp $ 15 16use strict; 17use ExtUtils::MakeMaker 5.16 qw(WriteMakefile prompt); 18use Config; 19 20die "RDFStore needs Perl 5.004_05 or better. This is $]\n" 21 if $] <= 5.00404; 22 23$| = 1; 24 25# check required modules 26my %missing_modules=(); 27print "Checking for URI.............."; 28eval { 29 require URI; 30 URI->VERSION(1.09); 31 }; 32if ($@) { 33 print " missing - The URI module is required\n"; 34 $missing_modules{'URI'}=1; 35} else { 36 print " ok\n"; 37 }; 38 39print "Checking for DBI.............."; 40eval { 41 require DBI; 42 }; 43if ($@) { 44 print " missing - You need the DBI module to run RDQL/Squish queries; without it only API based triple-match will be possible\n"; 45 $missing_modules{'DBI'}=1; 46} else { 47 print " ok\n"; 48 }; 49 50# Some of this configurations are coming from the DB_File Makefile.PL extension written by Paul Marquess <Paul.Marquess@btinternet.com> 51print "Checking for XML::Parser......"; 52eval { 53 require XML::Parser; 54 require XML::Parser::Expat; 55 XML::Parser->VERSION(2.00); 56 }; 57if ($@) { 58 print " missing - XML::Parser module version 2 or higher is required\n"; 59 $missing_modules{'XML::Parser'}=1; 60} else { 61 print " ok\n\n"; 62 warn qq|WARNING: 63 64 You have installed a recent version of the XML::Parser (>2.29) with built in expat XML parser support. 65 If you are going to use RDFStore inside the Apache Web server using mod_perl, bear in mind that there 66 is a symbol conflict between XML::Parser and apache when built with expat. To properly use the RDFStore 67 parsing modules you need to rebuilt apache disabling expat (use --disable-rule=EXPAT while building your 68 apache-1.3.xx + mod_perl) 69 70| 71 if($XML::Parser::VERSION gt '2.29'); 72 }; 73 74if( (exists $missing_modules{'XML::Parser'}) || 75 (exists $missing_modules{'DBI'}) || 76 (exists $missing_modules{'URI'}) ) { 77 print "\nSorry, can not build RDFStore :(\nPlease installed the missing modules above and try again.\n\n"; 78 exit; 79 }; 80 81my $PLATFORM = " -DRDFSTORE_PLATFORM_" . uc($^O); 82my ($LIB_DIR,$INC_DIR,$DB_NAME,$LIBS,$COMPAT185,$DB,$DBMS_INSTDIR); 83 84# check BerkeleyDB library locals: read arch_conf.in, pick up any from %ENV if possible otheriwse prompt the user 85# parse configuration file 86my %options = map { $_, 1 } qw( INCLUDE LIB DBNAME DBMS_INSTDIR RDFSTORE_WORD_STEMMING RDFSTORE_MAXRECORDS ); 87my $conf_file = 'arch_conf.in'; 88open(CONF, $conf_file) 89 or die "Cannot open file $conf_file: $!\n" ; 90while (<CONF>) { 91 s/^\s*|\s*$//g; 92 next 93 if /^\s*$/ or /^\s*#/; 94 s/\s*#\s*$//; 95 my ($k, $v) = split(/\s+=\s+/, $_, 2); 96 $k = uc $k; 97 $options{$k} = $v 98 if ($options{$k}); 99 }; 100close(CONF); 101 102# complete the compilation parameters (precedence to %ENV settings) 103$INC_DIR = $ENV{'RDFSTORE_BDB_INCLUDE'} 104 if(defined $ENV{'RDFSTORE_BDB_INCLUDE'} and -e $ENV{'RDFSTORE_BDB_INCLUDE'} and -d _ ); 105$INC_DIR = $options{'INCLUDE'} 106 if(exists $options{'INCLUDE'} and -e $options{'INCLUDE'} and -d _ ); 107$LIB_DIR = $ENV{'RDFSTORE_BDB_LIB'} 108 if(defined $ENV{'RDFSTORE_BDB_LIB'} and -e $ENV{'RDFSTORE_BDB_LIB'} and -d _ ); 109$LIB_DIR = $options{'LIB'} 110 if(exists $options{'LIB'} and -e $options{'LIB'} and -d _ ); 111$DB_NAME = $options{'DBNAME'} 112 if(exists $options{'DBNAME'} and $options{'DBNAME'} ne '1'); 113$COMPAT185 = "-DCOMPAT185 -DDB_LIBRARY_COMPATIBILITY_API" 114 if ( (defined $ENV{'RDFSTORE_BDB_COMPAT185'}) && 115 ($ENV{'RDFSTORE_BDB_COMPAT185'} =~ /^\s*(on|true|1)\s*$/i) ); 116if(exists $options{'DBMS_INSTDIR'} and -e $options{'DBMS_INSTDIR'} and -d _ ) { 117 $DBMS_INSTDIR = $options{'DBMS_INSTDIR'}; 118} else { 119 $DBMS_INSTDIR = '/RDFStore'; 120 }; 121 122#other specific options either from enviornment or arch_conf.in 123my ($RDFSTORE_WORD_STEMMING,$RDFSTORE_MAXRECORDS); 124$RDFSTORE_WORD_STEMMING = $ENV{'RDFSTORE_WORD_STEMMING'} 125 if(defined $ENV{'RDFSTORE_WORD_STEMMING'}); 126$RDFSTORE_WORD_STEMMING = $options{'RDFSTORE_WORD_STEMMING'} 127 if(exists $options{'RDFSTORE_WORD_STEMMING'}); 128 129my $RDFSTORE_DEFAULT_MAXRECORDS=2097152; 130my $RDFSTORE_MIN_MAXRECORDS=128; 131my $RDFSTORE_MAX_MAXRECORDS=60000000; # 60M triples 132$RDFSTORE_MAXRECORDS = ( $ENV{'RDFSTORE_MAXRECORDS'} >= $RDFSTORE_MIN_MAXRECORDS and 133 $ENV{'RDFSTORE_MAXRECORDS'} <= $RDFSTORE_MAX_MAXRECORDS ) ? 134 $ENV{'RDFSTORE_MAXRECORDS'} : 135 $RDFSTORE_DEFAULT_MAXRECORDS 136 if(defined $ENV{'RDFSTORE_MAXRECORDS'}); 137$RDFSTORE_MAXRECORDS = ( $options{'RDFSTORE_MAXRECORDS'} >= $RDFSTORE_MIN_MAXRECORDS and 138 $options{'RDFSTORE_MAXRECORDS'} <= $RDFSTORE_MAX_MAXRECORDS ) ? 139 $options{'RDFSTORE_MAXRECORDS'} : 140 $RDFSTORE_DEFAULT_MAXRECORDS 141 if(exists $options{'RDFSTORE_MAXRECORDS'}); 142 143# eventually go in interactive mode 144if($ARGV[0] =~ m/-(i|interactive)/i) { 145 print <<QUESTION; 146You have chosen the interactive configuration - You will be now asked a few questions about 147your local BerkeleyDB installation and other RDF storage and indexing specific parameters (see arch_conf.in for more info) 148 149QUESTION 150 151 my ($idir,$ldir,$dbn); 152 while ( $idir = prompt( 'Where is the file db.h? '.( (defined $INC_DIR) ? '['.$INC_DIR.']' : '' ) ) ) { 153 $idir =~ s/^\s+//g; 154 $idir =~ s/\s+$//g; 155 last 156 if (-e $idir and -d _ ); 157 print "\nInvalid directory '$idir' - try again\n\n"; 158 }; 159 $INC_DIR = $idir 160 if( (defined $idir) && 161 ($idir ne '') ); 162 while ( $ldir = prompt( 'Where is libdb? '.( (defined $LIB_DIR) ? '['.$LIB_DIR.']' : '' ) ) ) { 163 $ldir =~ s/^\s+//g; 164 $ldir =~ s/\s+$//g; 165 last 166 if (-e $ldir and -d _ ); 167 print "\nInvalid directory '$ldir' - try again\n\n"; 168 }; 169 $LIB_DIR = $ldir 170 if( (defined $ldir) && 171 ($ldir ne '') ); 172 $dbn = prompt( 'Is the library called libdb (e.g. db4 - default value is db ) ? '.( (defined $DB_NAME) ? '['.$DB_NAME.']' : '' ) ); 173 if( (defined $dbn) && 174 ($dbn ne '') ) { 175 $dbn =~ s/^\s+//g; 176 $dbn =~ s/\s+$//g; 177 $dbn = '-l'.$dbn 178 unless( $dbn =~ m/^-l/ ); 179 $DB_NAME = $dbn; 180 }; 181 182 my $ws = prompt( 'How many characters your need word stemming on RDF text literals (an integer - default value is 5 ) ? '.( (defined $RDFSTORE_WORD_STEMMING) ? '['.$RDFSTORE_WORD_STEMMING.']' : '' ) ); 183 if( (defined $ws) && 184 ($ws ne '') && 185 (int($ws)) ) { 186 $RDFSTORE_WORD_STEMMING = $ws; 187 }; 188 189 my $mrs = prompt( 'How many RDF triples your database can contain (an integer in the range '.$RDFSTORE_MIN_MAXRECORDS.' <= X <= '.$RDFSTORE_MAX_MAXRECORDS.') ? '.( (defined $RDFSTORE_MAXRECORDS) ? '['.$RDFSTORE_MAXRECORDS.']' : '' ) ); 190 if( (defined $mrs) && 191 ($mrs ne '') && 192 (int($mrs)) && 193 ( $mrs >= $RDFSTORE_MIN_MAXRECORDS ) && 194 ( $mrs <= $RDFSTORE_MAX_MAXRECORDS ) ) { 195 $RDFSTORE_MAXRECORDS = $mrs; 196 }; 197 198 print "\n"; 199 }; 200 201# force some default settings 202if ( $^O =~ m/linux/ and ($ARGV[0] !~ m/-(i|interactive)/i) ) { 203 # Some modern versions of linux need this. 204 if ( -e '/usr/include/db4/db.h' ) { 205 $DB = '-DDB4_INCLUDE'; 206 unless($DB_NAME) { 207 # let's guess what the bloody Linux installation/distro did! 208 my @dbs = </usr/lib/libdb4.>; 209 if( $#dbs >= 0 ) { 210 $DB_NAME = '-ldb4'; 211 }; 212 @dbs = </usr/lib/libdb-4.0.>; 213 if( $#dbs >= 0 ) { 214 $DB_NAME = '-ldb-4.0'; 215 } else { 216 $DB_NAME = '-ldb'; 217 }; 218 $LIBS = $DB_NAME; 219 }; 220 $INC_DIR = '/usr/include/db4/' unless($INC_DIR); 221 }; 222 if ( -e '/usr/include/db3/db.h' ) { 223 $DB = '-DDB3_INCLUDE'; 224 unless($DB_NAME) { 225 # let's guess what the bloody Linux installation/distro did! 226 my @dbs = </usr/lib/libdb3.>; 227 if( $#dbs >= 0 ) { 228 $DB_NAME = '-ldb3'; 229 }; 230 @dbs = </usr/lib/libdb-3.0.>; 231 if( $#dbs >= 0 ) { 232 $DB_NAME = '-ldb-3.0'; 233 } else { 234 $DB_NAME = '-ldb'; 235 }; 236 $LIBS = $DB_NAME; 237 }; 238 $INC_DIR = '/usr/include/db3/' unless($INC_DIR); 239 }; 240 if ( -e '/usr/include/db2/db.h' ) { 241 $DB = '-DDB2_INCLUDE'; 242 unless($DB_NAME) { 243 # let's guess what the bloody Linux installation/distro did! 244 my @dbs = </usr/lib/libdb2.>; 245 if( $#dbs >= 0 ) { 246 $DB_NAME = '-ldb2'; 247 }; 248 @dbs = </usr/lib/libdb-2.0.>; 249 if( $#dbs >= 0 ) { 250 $DB_NAME = '-ldb-2.0'; 251 } else { 252 $DB_NAME = '-ldb'; 253 }; 254 $LIBS = $DB_NAME; 255 }; 256 $INC_DIR = '/usr/include/db2/' unless($INC_DIR); 257 }; 258 if ( -e '/usr/include/db1/db.h' ) { 259 $DB = '-DDB1_INCLUDE'; 260 unless($DB_NAME) { 261 # let's guess what the bloody Linux installation/distro did! 262 my @dbs = </usr/lib/libdb1.>; 263 if( $#dbs >= 0 ) { 264 $DB_NAME = '-ldb1'; 265 }; 266 @dbs = </usr/lib/libdb-1.0.>; 267 if( $#dbs >= 0 ) { 268 $DB_NAME = '-ldb-1.0'; 269 } else { 270 $DB_NAME = '-ldb'; 271 }; 272 $LIBS = $DB_NAME; 273 }; 274 $INC_DIR = '/usr/include/db1/' unless($INC_DIR); 275 }; 276 }; 277 278$DB_NAME = '-ldb' 279 if ( (! defined $DB_NAME) && 280 $LIB_DIR ); 281 282if( ($ARGV[0] =~ m/-(v|verbose)/i) || 283 ($ARGV[1] =~ m/-(v|verbose)/i) || 284 ($ARGV[0] =~ m/-(i|interactive)/i) ) { 285 print "Your configuration is the following:\n\n"; 286 print "BerkeleyDB configuration:\n\n"; 287 print "\tinclude directory [".( (defined $INC_DIR) ? $INC_DIR : 'undefined/default to built in' )."]\n"; 288 print "\tlibrary directory [".( (defined $LIB_DIR) ? $LIB_DIR : 'undefined/default to built in' )."]\n"; 289 print "\tlibrary name [".( (defined $DB_NAME) ? $DB_NAME : 'undefined/default to built in' )."]\n\n"; 290 print "RDF storage and indexing configuration:\n\n"; 291 print "\tRDF literal word stemming up to [$RDFSTORE_WORD_STEMMING]\n"; 292 print "\tMax number of RDF statements/triples [$RDFSTORE_MAXRECORDS]\n\n"; 293 }; 294 295my $debug = ($ENV{RDFSTORE_DEBUG} =~ m/1|yes|on|enable/) ? '-DRDFSTORE_DEBUG' : ''; 296my $debug_malloc = ($ENV{RDFSTORE_DEBUG_MALLOC} =~ m/1|yes|on|enable/) ? '-DRDFSTORE_DEBUG_MALLOC' : ''; 297my $dbms_debug = ($ENV{RDFSTORE_DBMS_DEBUG} =~ m/1|yes|on|enable/) ? '-DRDFSTORE_DBMS_DEBUG' : ''; 298my $dbms_debug_malloc = ($ENV{RDFSTORE_DBMS_DEBUG_MALLOC} =~ m/1|yes|on|enable/) ? '-DRDFSTORE_DBMS_DEBUG_MALLOC' : ''; 299my $flat_store_debug = ($ENV{RDFSTORE_FLAT_STORE_DEBUG} =~ m/1|yes|on|enable/) ? '-DRDFSTORE_FLAT_STORE_DEBUG' : ''; 300my $profile = ($ENV{RDFSTORE_PROFILE} =~ m/1|yes|on|enable/) ? 1 : 0; 301 302my $RDFSTORE_OPTIONS = ' -DRDFSTORE_WORD_STEMMING='.$RDFSTORE_WORD_STEMMING 303 if(defined $RDFSTORE_WORD_STEMMING); 304$RDFSTORE_OPTIONS .= ' -DRDFSTORE_MAXRECORDS='.$RDFSTORE_MAXRECORDS 305 if(defined $RDFSTORE_MAXRECORDS); 306 307# generate dbms/arch.conf 308open(ARCH_CONF,">dbms/arch.conf"); #overwrite existing one 309print ARCH_CONF <<EOT; 310# * 311# * Copyright (c) 2000-2006 Alberto Reggiori <areggiori\@webweaving.org> 312# * Dirk-Willem van Gulik <dirkx\@webweaving.org> 313# * 314# * NOTICE 315# * 316# * This product is distributed under a BSD/ASF like license as described in the 'LICENSE' 317# * file you should have received together with this source code. If you did not get a 318# * a copy of such a license agreement you can pick up one at: 319# * 320# * http://rdfstore.sourceforge.net/LICENSE 321# * 322# 323INSTDIR=$DBMS_INSTDIR 324 325TESTDIR=/usr/tmp/test.dbstore 326PIDFILE=/usr/tmp/test.dbstore.pid 327 328#CC = gcc 329RANLIB = ranlib 330LINT = lint 331LINTFLAGS = -chapbx 332 333INCLUDES= -I../include -I../../include 334 335DEFINES += $PLATFORM 336 337###### BEGIN specific confs 338EOT 339 340print ARCH_CONF "\n# add the include directory of your BDB installation is if not found to the bottom line\n"; 341print ARCH_CONF ($INC_DIR) ? 'INCLUDES += -I'.$INC_DIR : '#INCLUDES += -I/usr/local/BerkeleyDB-4.0.14/include'; 342print ARCH_CONF "\n\n# add the library directory of your BDB installation is if not found to the bottom line\n"; 343print ARCH_CONF 'LIBS_DIR = -L../libdbms ' . ( ($LIB_DIR) ? ' -L'.$LIB_DIR : ' # -L/usr/local/BerkeleyDB-4.0.14/lib' ) . "\n"; 344print ARCH_CONF ( ($LIB_DIR) ? 'BDB_LD_LIBS_DIR = '.$LIB_DIR : '#BDB_LD_LIBS_DIR = /usr/local/BerkeleyDB-4.0.14/lib' ) . "\n"; 345print ARCH_CONF <<EOT; 346 347 348# uncomment one the following lines if your BDB library is not found. 349# 350# NOTE: most BSD systems have BDB built in in the 'libc' standard C 351# library and do not need the bottom definition 352# 353EOT 354print ARCH_CONF "\n# anything not built in and linux platforms in general\n"; 355print ARCH_CONF ($DB_NAME) ? 'LIBS = '.$DB_NAME : '#LIBS = -ldb'; 356print ARCH_CONF "\n"; 357if($^O eq 'linux') { 358 print ARCH_CONF "\n# Some linux platforms have diffferent DB versions installed.\n"; 359 if ( $DB ) { 360 print ARCH_CONF 'DEFINES += "'.$DB.'"'."\n"; 361 } else { 362 print ARCH_CONF <<EOT; 363# choose db1 364#DEFINES += "-DDB1_INCLUDE" 365#INCLUDES += -I/usr/include/db1/include 366#LIBS = -ldb1 367# ...or db2 368#DEFINES += "-DDB2_INCLUDE" 369#INCLUDES += -I/usr/include/db2/include 370#LIBS = -ldb2 371# ...or db3 372#DEFINES += "-DDB3_INCLUDE" 373#INCLUDES += -I/usr/include/db3/include 374#LIBS = -ldb3 375# ...or db4 376#DEFINES += "-DDB4_INCLUDE" 377#INCLUDES += -I/usr/include/db4/include 378#LIBS = -ldb4 379 380EOT 381 }; 382 }; 383 384if($^O eq 'darwin') { 385 print ARCH_CONF "UID=root\n"; 386 print ARCH_CONF "GID=wheel\n"; 387} else { 388 print ARCH_CONF "UID=bin\n"; 389 print ARCH_CONF "GID=bin\n"; 390} 391 392print ARCH_CONF "\n\n# uncomment the following line to use BDB 1.85 compatibility code\n"; 393print ARCH_CONF ($COMPAT185) ? 'DEFINES += "'.$COMPAT185.'"' : '#DEFINES += " -DCOMPAT185 -DDB_LIBRARY_COMPATIBILITY_API "'; 394print ARCH_CONF "\n"; 395 396if($^O eq 'solaris') { 397 print ARCH_CONF <<EOT; 398 399# for SOLARIS 400LIBS += -lsocket -lnsl 401 402EOT 403 }; 404 405print ARCH_CONF <<EOT; 406 407###### END specific confs 408 409LFLAGS = -g3 410CFLAGS = -g3 411 412EOT 413print "# For profiling..\nCFLAGS += -pg\n" if($profile); 414print ARCH_CONF <<EOT; 415 416# 417# Whether to fork(on BSD) or multitread(on Irix) 418# or not at all. You propably want to leave this 419# in as the non-tread/non-fork versions have not 420# been used in a long time... 421# 422DEFINES += -DFORKING 423# 424# General debugging; also, some asserts present 425# so should use -NDEBUG :-) 426# 427EOT 428print ARCH_CONF ( ($ENV{RDFSTORE_DBMS_DEBUG} =~ m/1|yes|on|enable/) ? '' : '# ')."DEFINES += -DRDFSTORE_DBMS_DEBUG\n"; 429print ARCH_CONF <<EOT; 430# 431# Bit of malloc tracing, basically a 432# free check on termination 433# 434EOT 435print ARCH_CONF ( ($ENV{RDFSTORE_DBMS_DEBUG_MALLOC} =~ m/1|yes|on|enable/) ? '' : '# ')."DEFINES += -DRDFSTORE_DBMS_DEBUG_MALLOC\n"; 436print ARCH_CONF <<EOT; 437# 438# Wether to malloc once; and keep it on 439# a linked list; or contineously malloc/free 440# for dbase/child/connect structs, i.e. the 441# 'long' lived things (i.e. >= session time) 442# 443DEFINES += -DSTATIC_BUFF 444# 445# Same for short (per transact) buffers 446# 447DEFINES += -DSTATIC_CS_BUFF 448DEFINES += -DSTATIC_SC_BUFF 449# 450# If your kernel allows it.. *implies a 451# kernel recompile normally* 452# 453# DEFINES += -DFD_SETSIZE=4048 454# 455 456EOT 457close(ARCH_CONF); 458 459# generate dbms/utils/dbmsd.sh 460open(DBMSDSH,">dbms/utils/dbmsd.sh"); #overwrite existing one 461print DBMSDSH <<EOT; 462#!/bin/sh 463############################################################################## 464# Copyright (c) 2000-2006 All rights reserved 465# Alberto Reggiori <areggiori\@webweaving.org> 466# Dirk-Willem van Gulik <dirkx\@webweaving.org> 467# 468# Redistribution and use in source and binary forms, with or without 469# modification, are permitted provided that the following conditions 470# are met: 471# 472# 1. Redistributions of source code must retain the above copyright 473# notice, this list of conditions and the following disclaimer. 474# 475# 2. Redistributions in binary form must reproduce the above copyright 476# notice, this list of conditions and the following disclaimer in 477# the documentation and/or other materials provided with the 478# distribution. 479# 480# 3. The end-user documentation included with the redistribution, 481# if any, must include the following acknowledgment: 482# "This product includes software developed by 483# Alberto Reggiori <areggiori\@webweaving.org> and 484# Dirk-Willem van Gulik <dirkx\@webweaving.org>." 485# Alternately, this acknowledgment may appear in the software itself, 486# if and wherever such third-party acknowledgments normally appear. 487# 488# 4. All advertising materials mentioning features or use of this software 489# must display the following acknowledgement: 490# This product includes software developed by the University of 491# California, Berkeley and its contributors. 492# 493# 5. Neither the name of the University nor the names of its contributors 494# may be used to endorse or promote products derived from this software 495# without specific prior written permission. 496# 497# 6. Products derived from this software may not be called "RDFStore" 498# nor may "RDFStore" appear in their names without prior written 499# permission. 500# 501# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 502# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 503# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 504# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 505# FOR ANY DIRECT, INDIRECT, INCIDENTAL, 506# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 507# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 508# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 509# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 510# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 511# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 512# OF THE POSSIBILITY OF SUCH DAMAGE. 513# 514# ==================================================================== 515# 516# This software consists of work developed by Alberto Reggiori and 517# Dirk-Willem van Gulik. The RDF specific part is based on public 518# domain software written at the Stanford University Database Group by 519# Sergey Melnik. For more information on the RDF API Draft work, 520# please see <http://www-db.stanford.edu/~melnik/rdf/api.html> 521# The DBMS TCP/IP server part is based on software originally written 522# by Dirk-Willem van Gulik for Web Weaving Internet Engineering m/v Enschede, 523# The Netherlands. 524# 525############################################################################## 526DIR=$DBMS_INSTDIR 527 528# 529# WARNING: the following "ulimit" commands are generally *BIG* server machines 530# enable them to your own risk! :-) 531# 532#ulimit -d 65000 533#ulimit -n 2048 534#ulimit -u 256 535#ulimit -m 64000 536 537RUNDIR=\$DIR/run 538LOGDIR=\$DIR/logs 539 540test -d \$RUNDIR || exit 1 541test -d \$LOGDIR || exit 1 542 543PIDFILE=\$RUNDIR/dbmsd.pid 544LOGFILE=\$DIR/logs/dbmsd_errorlog 545 546# Make sure cores are collected in the right place. 547# 548cd \$RUNDIR || exit 1 549 550EOT 551print DBMSDSH ( ($LIB_DIR) ? 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:'.$LIB_DIR : '#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/BerkeleyDB-4.0.14/lib' )."\n\n"; 552print DBMSDSH '[ -f $DIR/bin/dbmsd ] && $DIR/bin/dbmsd -e $LOGFILE -U -P $PIDFILE -d $DIR/dbms && echo -n dbmsd'."\n\n"; 553close(DBMSDSH); 554 555# generate dbms/utils/start_dbserver 556open(DBMSDSTART,">dbms/utils/start_dbserver"); 557print DBMSDSTART <<EOT; 558#!/bin/sh 559############################################################################## 560# Copyright (c) 2000-2006 All rights reserved 561# Alberto Reggiori <areggiori\@webweaving.org> 562# Dirk-Willem van Gulik <dirkx\@webweaving.org> 563# 564# Redistribution and use in source and binary forms, with or without 565# modification, are permitted provided that the following conditions 566# are met: 567# 568# 1. Redistributions of source code must retain the above copyright 569# notice, this list of conditions and the following disclaimer. 570# 571# 2. Redistributions in binary form must reproduce the above copyright 572# notice, this list of conditions and the following disclaimer in 573# the documentation and/or other materials provided with the 574# distribution. 575# 576# 3. The end-user documentation included with the redistribution, 577# if any, must include the following acknowledgment: 578# "This product includes software developed by 579# Alberto Reggiori <areggiori\@webweaving.org> and 580# Dirk-Willem van Gulik <dirkx\@webweaving.org>." 581# Alternately, this acknowledgment may appear in the software itself, 582# if and wherever such third-party acknowledgments normally appear. 583# 584# 4. All advertising materials mentioning features or use of this software 585# must display the following acknowledgement: 586# This product includes software developed by the University of 587# California, Berkeley and its contributors. 588# 589# 5. Neither the name of the University nor the names of its contributors 590# may be used to endorse or promote products derived from this software 591# without specific prior written permission. 592# 593# 6. Products derived from this software may not be called "RDFStore" 594# nor may "RDFStore" appear in their names without prior written 595# permission. 596# 597# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 598# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 599# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 600# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 601# FOR ANY DIRECT, INDIRECT, INCIDENTAL, 602# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 603# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 604# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 605# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 606# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 607# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 608# OF THE POSSIBILITY OF SUCH DAMAGE. 609# 610# ==================================================================== 611# 612# This software consists of work developed by Alberto Reggiori and 613# Dirk-Willem van Gulik. The RDF specific part is based on public 614# domain software written at the Stanford University Database Group by 615# Sergey Melnik. For more information on the RDF API Draft work, 616# please see <http://www-db.stanford.edu/~melnik/rdf/api.html> 617# The DBMS TCP/IP server part is based on software originally written 618# by Dirk-Willem van Gulik for Web Weaving Internet Engineering m/v Enschede, 619# The Netherlands. 620# 621############################################################################## 622 623$DBMS_INSTDIR/rc/dbmsd.sh 624 625EOT 626close(DBMSDSTART); 627 628# generate dbms/utils/stop_dbserver 629open(DBMSDSTOP,">dbms/utils/stop_dbserver"); 630print DBMSDSTOP <<EOT; 631#!/bin/sh 632############################################################################## 633# Copyright (c) 2000-2006 All rights reserved 634# Alberto Reggiori <areggiori\@webweaving.org> 635# Dirk-Willem van Gulik <dirkx\@webweaving.org> 636# 637# Redistribution and use in source and binary forms, with or without 638# modification, are permitted provided that the following conditions 639# are met: 640# 641# 1. Redistributions of source code must retain the above copyright 642# notice, this list of conditions and the following disclaimer. 643# 644# 2. Redistributions in binary form must reproduce the above copyright 645# notice, this list of conditions and the following disclaimer in 646# the documentation and/or other materials provided with the 647# distribution. 648# 649# 3. The end-user documentation included with the redistribution, 650# if any, must include the following acknowledgment: 651# "This product includes software developed by 652# Alberto Reggiori <areggiori\@webweaving.org> and 653# Dirk-Willem van Gulik <dirkx\@webweaving.org>." 654# Alternately, this acknowledgment may appear in the software itself, 655# if and wherever such third-party acknowledgments normally appear. 656# 657# 4. All advertising materials mentioning features or use of this software 658# must display the following acknowledgement: 659# This product includes software developed by the University of 660# California, Berkeley and its contributors. 661# 662# 5. Neither the name of the University nor the names of its contributors 663# may be used to endorse or promote products derived from this software 664# without specific prior written permission. 665# 666# 6. Products derived from this software may not be called "RDFStore" 667# nor may "RDFStore" appear in their names without prior written 668# permission. 669# 670# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 671# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 672# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 673# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 674# FOR ANY DIRECT, INDIRECT, INCIDENTAL, 675# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 676# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 677# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 678# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 679# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 680# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 681# OF THE POSSIBILITY OF SUCH DAMAGE. 682# 683# ==================================================================== 684# 685# This software consists of work developed by Alberto Reggiori and 686# Dirk-Willem van Gulik. The RDF specific part is based on public 687# domain software written at the Stanford University Database Group by 688# Sergey Melnik. For more information on the RDF API Draft work, 689# please see <http://www-db.stanford.edu/~melnik/rdf/api.html> 690# The DBMS TCP/IP server part is based on software originally written 691# by Dirk-Willem van Gulik for Web Weaving Internet Engineering m/v Enschede, 692# The Netherlands. 693# 694############################################################################## 695 696DIR=$DBMS_INSTDIR 697 698RUNDIR=\$DIR/run 699 700test -d \$RUNDIR || exit 1 701 702if [ \$# = 0 ]; then 703 PIDFILE=\$RUNDIR/dbmsd.pid 704else 705 PIDFILE=\$1 706fi 707 708echo 'Stoppping DBMS server....' 709echo 'First kills....' 710 711if [ -f \$PIDFILE ] ; then 712 PID=`cat \$PIDFILE` 713 if [ "x\$PID" != "x" ] && kill -0 \$PID 2>/dev/null ; then 714 kill -15 \$PID; 715 else 716 echo not a valid PID=\$PID in \$PIDFILE 717 rm -f \$PID; 718 exit 1 719 fi 720else 721 echo no \$PIDFILE found 722 exit 1 723fi 724 725echo DONE 726exit 0 727 728EOT 729close(DBMSDSTOP); 730 731# generate utils/Makefile 732open(UTILSMAKE,">utils/Makefile"); #overwrite existing one 733print UTILSMAKE <<EOT; 734# * 735# * Copyright (c) 2000-2006 Alberto Reggiori <areggiori\@webweaving.org> 736# * Dirk-Willem van Gulik <dirkx\@webweaving.org> 737# * 738# * NOTICE 739# * 740# * This product is distributed under a BSD/ASF like license as described in the 'LICENSE' 741# * file you should have received together with this source code. If you did not get a 742# * a copy of such a license agreement you can pick up one at: 743# * 744# * http://rdfstore.sourceforge.net/LICENSE 745# * 746# * 747TFILE=`date +%Y-%m-%d` 748 749include ../dbms/arch.conf 750 751OBJS = ../dbms/libdbms/libdbms.o ../rdfstore_flat_store.o ../rdfstore_kernel.o ../rdfstore_bits.o ../rdfstore_utf8.o ../rdfstore_xsd.o ../rdfstore_digest.o ../rdfstore_ap_sha1.o ../rdfstore_compress.o ../rdfstore_log.o ../rdfstore_serializer.o ../rdfstore_iterator.o ../sflcomp.o ../my_compress.o ../fraenkel_compress.o ../backend_bdb_store.o ../backend_dbms_store.o ../backend_caching_store.o 752 753all: db_stats 754 755clean: 756 rm -f db_stats 757 758EOT 759 760print UTILSMAKE "db_stats: db_stats.c Makefile\n\t".'$(CC) $(CFLAGS) $(INCLUDES) -I ../dbms/include -I ../dbms/client $(DEFINES) $(LIBS_DIR) $(OBJS) '.( ($DB_NAME) ? $DB_NAME : '' ).' -o db_stats db_stats.c'; 761close(UTILSMAKE); 762 763# generate test/Makefile 764open(TESTSMAKE,">test/Makefile"); #overwrite existing one 765print TESTSMAKE <<EOT; 766# * 767# * Copyright (c) 2000-2006 Alberto Reggiori <areggiori\@webweaving.org> 768# * Dirk-Willem van Gulik <dirkx\@webweaving.org> 769# * 770# * NOTICE 771# * 772# * This product is distributed under a BSD/ASF like license as described in the 'LICENSE' 773# * file you should have received together with this source code. If you did not get a 774# * a copy of such a license agreement you can pick up one at: 775# * 776# * http://rdfstore.sourceforge.net/LICENSE 777# * 778# * 779TFILE=`date +%Y-%m-%d` 780 781include ../dbms/arch.conf 782 783OBJS = ../dbms/libdbms/libdbms.o ../rdfstore_flat_store.o ../rdfstore_kernel.o ../rdfstore_bits.o ../rdfstore_utf8.o ../rdfstore_xsd.o ../rdfstore_digest.o ../rdfstore_ap_sha1.o ../rdfstore_compress.o ../rdfstore_log.o ../rdfstore_iterator.o ../rdfstore_serializer.o ../sflcomp.o ../my_compress.o ../fraenkel_compress.o ../backend_bdb_store.o ../backend_dbms_store.o ../backend_caching_store.o 784 785 786all: mytest mytest1 myingest 787 788test: all 789 ./mytest || exit 1 790 ./mytest1 || exit 1 791 ./myingest test.triples || exit 1 792 793clean: 794 rm -f mytest mytest1 myingest myingest.core mytest.core mytest1.core mytest.gmon mytest1.gmon 795 796EOT 797 798print TESTSMAKE "mytest: Makefile mytest.c\n\t". 799 '$(CC) $(CFLAGS) $(INCLUDES) -I ../dbms/include -I ../dbms/client $(DEFINES) $(LIBS_DIR) $(OBJS) '.( ($DB_NAME) ? $DB_NAME : '' ).' -o mytest mytest.c'. 800 "\n\n"; 801print TESTSMAKE "mytest1: Makefile mytest1.c\n\t". 802 '$(CC) $(CFLAGS) $(INCLUDES) -I ../dbms/include -I ../dbms/client $(DEFINES) $(LIBS_DIR) $(OBJS) '.( ($DB_NAME) ? $DB_NAME : '' ).' -o mytest1 mytest1.c'. 803 "\n\n"; 804print TESTSMAKE "myingest: Makefile myingest.c\n\t". 805 '$(CC) $(CFLAGS) $(INCLUDES) -I ../dbms/include -I ../dbms/client $(DEFINES) $(LIBS_DIR) $(OBJS) '.( ($DB_NAME) ? $DB_NAME : '' ).' -o myingest myingest.c'. 806 "\n\n"; 807close(TESTSMAKE); 808 809if (defined $DB_NAME) { 810 $LIBS = $DB_NAME; 811} else { 812 if ($^O eq 'MSWin32') { 813 $LIBS = '-llibdb'; 814 } else { 815 $LIBS = '-ldb'; 816 }; 817 }; 818 819 820WriteMakefile( 821 #DIR => [ 'RDFNode' ], 822 NAME => 'RDFStore', 823 VERSION_FROM => 'RDFStore.pm', 824 INC => ( (defined $INC_DIR) ? '-I'.$INC_DIR : '' )." -I dbms/include -I dbms/client -I ./include -I.", 825 LIBS => [ ( (defined $LIB_DIR) ? '-L'.$LIB_DIR : '' ) . " $LIBS -Ldbms/libdbms -ldbms "], 826 XSPROTOARG => '-noprototypes', 827 OPTIMIZE => '-g', 828 DEFINE => ( ($profile) ? '-pg ' : '' )." $PLATFORM $debug $debug_malloc $dbms_debug $dbms_debug_malloc $flat_store_debug -D_NOT_CORE $DB $COMPAT185 -DSTATIC_BUFF -DSTATIC_CS_BUFF -DSTATIC_SC_BUFF $RDFSTORE_OPTIONS", 829 LDFROM => q[RDFStore$(OBJ_EXT) rdfstore_log$(OBJ_EXT) rdfstore_compress$(OBJ_EXT) rdfstore_flat_store$(OBJ_EXT) rdfstore_iterator$(OBJ_EXT) rdfstore_serializer$(OBJ_EXT) rdfstore_kernel$(OBJ_EXT) rdfstore_ap_sha1$(OBJ_EXT) rdfstore_digest$(OBJ_EXT) rdfstore_bits$(OBJ_EXT) rdfstore_utf8$(OBJ_EXT) rdfstore_xsd$(OBJ_EXT) sflcomp$(OBJ_EXT) my_compress$(OBJ_EXT) fraenkel_compress$(OBJ_EXT) backend_bdb_store$(OBJ_EXT) backend_dbms_store$(OBJ_EXT) backend_caching_store$(OBJ_EXT)], 830 OBJECT => q[RDFStore$(OBJ_EXT) rdfstore_log$(OBJ_EXT) rdfstore_compress$(OBJ_EXT) rdfstore_flat_store$(OBJ_EXT) rdfstore_iterator$(OBJ_EXT) rdfstore_serializer$(OBJ_EXT) rdfstore_kernel$(OBJ_EXT) rdfstore_ap_sha1$(OBJ_EXT) rdfstore_digest$(OBJ_EXT) rdfstore_bits$(OBJ_EXT) rdfstore_utf8$(OBJ_EXT) rdfstore_xsd$(OBJ_EXT) my_compress$(OBJ_EXT) sflcomp$(OBJ_EXT) fraenkel_compress$(OBJ_EXT) backend_bdb_store$(OBJ_EXT) backend_dbms_store$(OBJ_EXT) backend_caching_store$(OBJ_EXT) ], 831 'clean' => { FILES => "y.tab.o lex.yy.o *.db" }, 832 EXE_FILES => [ "utils/rdf.pl", "utils/rdfquery.pl", "utils/rdfdump.pl" ], 833 ($] ge '5.005') ? ( 834 'AUTHOR' => 'Alberto Reggiori <areggiori@webweaving.org>, Dirk-Willem van Gulik <dirkx@webweaving.org>', 835 'ABSTRACT' => 'Perl/C RDF storage and API', 836 ) : () 837); 838 839# build client libdbms library first 840chomp(my $_CCCDLFLAGS=`make -VCCCDLFLAGS`); 841chomp(my $_CFLAGS=`make -VCFLAGS`); 842print `cd dbms/libdbms; make clean; make CFLAGS="${_CFLAGS} ${_CCCDLFLAGS}"`; 843 844sub MY::post_initialize { 845 print <<EOT; 846 847In addition, you can install the (optional) DBMS module for TCP/IP remote storage by: 848 849cd dbms 850make 851make test 852make install (by default into $DBMS_INSTDIR directory) 853 854EOT 855 ''; 856 }; 857