Skip to content

Commit

Permalink
build: make RCDB DBMS support optional (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
c-dilks authored Oct 30, 2024
1 parent e31a651 commit 39edef0
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 30 deletions.
17 changes: 11 additions & 6 deletions meson/release/install-cvmfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ fi
buildDir=$1
installDir=$(realpath $2)
testFile=$(realpath $3)
nativeFile=$sourceDir/meson/release/native/release.ini
echo """
sourceDir = $sourceDir
buildDir = $buildDir
installDir = $installDir
testFile = $testFile
nativeFile = $nativeFile"""
testFile = $testFile"""
[ ! -f "$testFile" ] && echo "ERROR: test file does not exist" >&2 && exit 1
print_dep_vars
printf "\nProceed with installation? [y/N] "
Expand All @@ -68,10 +66,17 @@ esac

msg "meson setup"
meson setup $buildDir $sourceDir \
--native-file=$nativeFile \
--prefix=$installDir \
-Drcdb:home=$RCDB_HOME \
-Dtest_data_file=$testFile
-D buildtype=release \
-D bind_fortran=true \
-D bind_python=true \
-D install_examples=true \
-D z_install_envfile=false \
-D z_require_root=true \
-D rcdb:home=$RCDB_HOME \
-D rcdb:use_mariadb=true \
-D rcdb:use_sqlite=true \
-D test_data_file=$testFile
msg "meson install"
meson install -C $buildDir
msg "meson test"
Expand Down
10 changes: 0 additions & 10 deletions meson/release/native/release.ini

This file was deleted.

34 changes: 21 additions & 13 deletions subprojects/rcdb/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,31 @@ else
error(f'RCDB not found; set build option "rcdb:home" to the RCDB installation (e.g., to "$RCDB_HOME"); @require_message@')
endif

# RCDB dependencies: a database management system (DBMS), mysql and/or sqlite
# RCDB dependencies: a database management system (DBMS), mariadb and/or sqlite
dbms_args = []
dbms_deps = []
dbms_dict = {
'mysql': [ 'mariadb', 'mysql', 'mysqlclient' ], # prioritizing mariadb, an open source fork of mysql
'sqlite': [ 'sqlite3' ],
'mariadb': {
'use': get_option('use_mariadb'),
'pkgs': [ 'mariadb', 'mysql', 'mysqlclient' ], # prioritizing mariadb, an open source fork of mysql
},
'sqlite': {
'use': get_option('use_sqlite'),
'pkgs': [ 'sqlite3' ],
},
}
foreach dbms, pkgs : dbms_dict
foreach pkg : pkgs
dep = dependency(pkg, required: false)
if dep.found()
dbms_deps += dep
dbms_args += { 'mysql': '-DRCDB_MYSQL', 'sqlite': '-DRCDB_SQLITE' }[dbms]
message(f'using @pkg@ for RCDB DBMS')
break
endif
endforeach
foreach dbms, info : dbms_dict
if info['use']
foreach pkg : info['pkgs']
dep = dependency(pkg, required: false)
if dep.found()
dbms_deps += dep
dbms_args += { 'mariadb': '-DRCDB_MYSQL', 'sqlite': '-DRCDB_SQLITE' }[dbms]
message(f'using @pkg@ for RCDB DBMS')
break
endif
endforeach
endif
endforeach
if dbms_deps.length() == 0
error('none of the DBMSs (' + ', '.join(dbms_dict.keys()) + ') were found, so RCDB will not be used in this build; ' + require_message)
Expand Down
4 changes: 3 additions & 1 deletion subprojects/rcdb/meson.options
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
option('home', type: 'string', value: '', description: 'Location of RCDB installation; if empty, RCDB-dependent code will not be included')
option('home', type: 'string', value: '', description: 'Location of RCDB installation; if empty, RCDB-dependent code will not be included')
option('use_mariadb', type: 'boolean', value: true, description: 'Use mariadb or mysql, if found on the system; set this to false to disable support for this')
option('use_sqlite', type: 'boolean', value: true, description: 'Use sqlite, if found on the system; set this to false to disable support for this')

0 comments on commit 39edef0

Please sign in to comment.