Skip to content

Commit

Permalink
Refactoring. Updated dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
interkosmos committed Mar 1, 2024
1 parent ca80f71 commit 75f7ff2
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 101 deletions.
70 changes: 35 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ INCHDF5 = `pkg-config --cflags hdf5`
# Shared libraries to link.
LIBCURL = `curl-config --libs`
LIBFASTCGI = -lfcgi
LIBHDF5 = `pkg-config --libs hdf5` -lhdf5_fortran
LIBLAPACK = -llapack -lblas
LIBHDF5 = `pkg-config --libs-only-l hdf5_fortran`
LIBLAPACK = `pkg-config --libs-only-l lapack blas`
LIBLUA54 = `pkg-config --libs-only-l lua-5.4`
LIBPCRE2 = `pkg-config --libs-only-l libpcre2-8`
LIBPTHREAD = -lpthread
Expand Down Expand Up @@ -472,13 +472,13 @@ dmtestcgi: test/dmtestcgi.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestcgi test/dmtestcgi.f90 $(TARGET) $(LDLIBS)

dmtestconfig: test/dmtestconfig.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestconfig test/dmtestconfig.f90 $(TARGET) $(LDLIBS) $(LIBLUA54)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestconfig test/dmtestconfig.f90 $(TARGET) $(LIBLUA54) $(LDLIBS)

dmtestcsv: test/dmtestcsv.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestcsv test/dmtestcsv.f90 $(TARGET) $(LDLIBS)

dmtestdb: test/dmtestdb.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestdb test/dmtestdb.f90 $(TARGET) $(LDLIBS) $(LIBSQLITE3)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestdb test/dmtestdb.f90 $(TARGET) $(LIBSQLITE3) $(LDLIBS)

dmtestdp: test/dmtestdp.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestdp test/dmtestdp.f90 $(TARGET) $(LDLIBS)
Expand All @@ -490,7 +490,7 @@ dmtesthash: test/dmtesthash.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtesthash test/dmtesthash.f90 $(TARGET) $(LDLIBS)

dmtesthdf5: test/dmtesthdf5.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) $(INCHDF5) -o dmtesthdf5 test/dmtesthdf5.f90 $(TARGET) $(LDLIBS) $(LIBHDF5)
$(FC) $(FFLAGS) $(LDFLAGS) $(INCHDF5) -o dmtesthdf5 test/dmtesthdf5.f90 $(TARGET) $(LIBHDF5) $(LDLIBS)

dmtesthtml: test/dmtesthtml.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtesthtml test/dmtesthtml.f90 $(TARGET) $(LDLIBS)
Expand All @@ -499,10 +499,10 @@ dmtestid: test/dmtestid.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestid test/dmtestid.f90 $(TARGET) $(LDLIBS)

dmtestlogger: test/dmtestlogger.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestlogger test/dmtestlogger.f90 $(TARGET) $(LDLIBS) $(LIBRT)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestlogger test/dmtestlogger.f90 $(TARGET) $(LIBRT) $(LDLIBS)

dmtestlua: test/dmtestlua.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestlua test/dmtestlua.f90 $(TARGET) $(LDLIBS) $(LIBLUA54)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestlua test/dmtestlua.f90 $(TARGET) $(LIBLUA54) $(LDLIBS)

dmtestjob: test/dmtestjob.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestjob test/dmtestjob.f90 $(TARGET) $(LDLIBS)
Expand All @@ -511,13 +511,13 @@ dmtestjson: test/dmtestjson.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestjson test/dmtestjson.f90 $(TARGET) $(LDLIBS)

dmtestmail: test/dmtestmail.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestmail test/dmtestmail.f90 $(TARGET) $(LDLIBS) $(LIBCURL)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestmail test/dmtestmail.f90 $(TARGET) $(LIBCURL) $(LDLIBS)

dmtestmqtt: test/dmtestmqtt.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestmqtt test/dmtestmqtt.f90 $(TARGET) $(LDLIBS) $(LIBCURL)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestmqtt test/dmtestmqtt.f90 $(TARGET) $(LIBCURL) $(LDLIBS)

dmtestmqueue: test/dmtestmqueue.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestmqueue test/dmtestmqueue.f90 $(TARGET) $(LDLIBS) $(LIBRT)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestmqueue test/dmtestmqueue.f90 $(TARGET) $(LIBRT) $(LDLIBS)

dmtestnml: test/dmtestnml.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestnml test/dmtestnml.f90 $(TARGET) $(LDLIBS)
Expand All @@ -535,13 +535,13 @@ dmtestplot: test/dmtestplot.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestplot test/dmtestplot.f90 $(TARGET) $(LDLIBS)

dmtestregex: test/dmtestregex.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestregex test/dmtestregex.f90 $(TARGET) $(LDLIBS) $(LIBPCRE2)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestregex test/dmtestregex.f90 $(TARGET) $(LIBPCRE2) $(LDLIBS)

dmtestrts: test/dmtestrts.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestrts test/dmtestrts.f90 $(TARGET) $(LDLIBS)

dmtestrpc: test/dmtestrpc.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestrpc test/dmtestrpc.f90 $(TARGET) $(LDLIBS) $(LIBCURL) $(LIBZ)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestrpc test/dmtestrpc.f90 $(TARGET) $(LIBCURL) $(LIBZ) $(LDLIBS)

dmteststring: test/dmteststring.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmteststring test/dmteststring.f90 $(TARGET) $(LDLIBS)
Expand All @@ -562,7 +562,7 @@ dmtestuuid: test/dmtestuuid.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestuuid test/dmtestuuid.f90 $(TARGET) $(LDLIBS)

dmtestz: test/dmtestz.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestz test/dmtestz.f90 $(TARGET) $(LDLIBS) $(LIBZ)
$(FC) $(FFLAGS) $(LDFLAGS) -o dmtestz test/dmtestz.f90 $(TARGET) $(LIBZ) $(LDLIBS)

# ******************************************************************************
#
Expand All @@ -571,73 +571,73 @@ dmtestz: test/dmtestz.f90 $(TARGET)
# ******************************************************************************

$(DMAPI): app/dmapi.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMAPI) app/dmapi.f90 $(TARGET) $(LDLIBS) $(LIBSQLITE3) $(LIBZ) $(LIBFASTCGI)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMAPI) app/dmapi.f90 $(TARGET) $(LIBSQLITE3) $(LIBZ) $(LIBFASTCGI) $(LDLIBS)

$(DMBACKUP): app/dmbackup.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMBACKUP) app/dmbackup.f90 $(TARGET) $(LDLIBS) $(LIBSQLITE3)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMBACKUP) app/dmbackup.f90 $(TARGET) $(LIBSQLITE3) $(LDLIBS)

$(DMBEAT): app/dmbeat.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMBEAT) app/dmbeat.f90 $(TARGET) $(LDLIBS) $(LIBCURL) $(LIBLUA54) $(LIBZ) $(LIBRT)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMBEAT) app/dmbeat.f90 $(TARGET) $(LIBCURL) $(LIBLUA54) $(LIBZ) $(LIBRT) $(LDLIBS)

$(DMDB): app/dmdb.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMDB) app/dmdb.f90 $(TARGET) $(LDLIBS) $(LIBLUA54) $(LIBSQLITE3) $(LIBPTHREAD) $(LIBRT)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMDB) app/dmdb.f90 $(TARGET) $(LIBLUA54) $(LIBSQLITE3) $(LIBPTHREAD) $(LIBRT) $(LDLIBS)

$(DMDBCTL): app/dmdbctl.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMDBCTL) app/dmdbctl.f90 $(TARGET) $(LDLIBS) $(LIBSQLITE3)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMDBCTL) app/dmdbctl.f90 $(TARGET) $(LIBSQLITE3) $(LDLIBS)

$(DMEXPORT): app/dmexport.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMEXPORT) app/dmexport.f90 $(TARGET) $(LDLIBS) $(LIBSQLITE3)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMEXPORT) app/dmexport.f90 $(TARGET) $(LIBSQLITE3) $(LDLIBS)

$(DMFEED): app/dmfeed.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMFEED) app/dmfeed.f90 $(TARGET) $(LDLIBS) $(LIBLUA54) $(LIBSQLITE3)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMFEED) app/dmfeed.f90 $(TARGET) $(LIBLUA54) $(LIBSQLITE3) $(LDLIBS)

$(DMFS): app/dmfs.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMFS) app/dmfs.f90 $(TARGET) $(LDLIBS) $(LIBLUA54) $(LIBPCRE2) $(LIBRT)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMFS) app/dmfs.f90 $(TARGET) $(LIBLUA54) $(LIBPCRE2) $(LIBRT) $(LDLIBS)

$(DMIMPORT): app/dmimport.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMIMPORT) app/dmimport.f90 $(TARGET) $(LDLIBS) $(LIBSQLITE3)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMIMPORT) app/dmimport.f90 $(TARGET) $(LIBSQLITE3) $(LDLIBS)

$(DMINFO): app/dminfo.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMINFO) app/dminfo.f90 $(TARGET) $(LDLIBS) $(LIBSQLITE3)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMINFO) app/dminfo.f90 $(TARGET) $(LIBSQLITE3) $(LDLIBS)

$(DMINIT): app/dminit.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMINIT) app/dminit.f90 $(TARGET) $(LDLIBS) $(LIBSQLITE3)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMINIT) app/dminit.f90 $(TARGET) $(LIBSQLITE3) $(LDLIBS)

$(DMLOG): app/dmlog.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMLOG) app/dmlog.f90 $(TARGET) $(LDLIBS) $(LIBRT)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMLOG) app/dmlog.f90 $(TARGET) $(LIBRT) $(LDLIBS)

$(DMLOGGER): app/dmlogger.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMLOGGER) app/dmlogger.f90 $(TARGET) $(LDLIBS) $(LIBLUA54) $(LIBSQLITE3) $(LIBPTHREAD) $(LIBRT)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMLOGGER) app/dmlogger.f90 $(TARGET) $(LIBLUA54) $(LIBSQLITE3) $(LIBPTHREAD) $(LIBRT) $(LDLIBS)

$(DMLUA): app/dmlua.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMLUA) app/dmlua.f90 $(TARGET) $(LDLIBS) $(LIBLUA54) $(LIBRT)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMLUA) app/dmlua.f90 $(TARGET) $(LIBLUA54) $(LIBRT) $(LDLIBS)

$(DMPIPE): app/dmpipe.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMPIPE) app/dmpipe.f90 $(TARGET) $(LDLIBS) $(LIBLUA54) $(LIBPCRE2) $(LIBRT)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMPIPE) app/dmpipe.f90 $(TARGET) $(LIBLUA54) $(LIBPCRE2) $(LIBRT) $(LDLIBS)

$(DMPLOT): app/dmplot.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMPLOT) app/dmplot.f90 $(TARGET) $(LDLIBS) $(LIBLUA54) $(LIBSQLITE3)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMPLOT) app/dmplot.f90 $(TARGET) $(LIBLUA54) $(LIBSQLITE3) $(LDLIBS)

$(DMRECV): app/dmrecv.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMRECV) app/dmrecv.f90 $(TARGET) $(LDLIBS) $(LIBLUA54) $(LIBRT)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMRECV) app/dmrecv.f90 $(TARGET) $(LIBLUA54) $(LIBRT) $(LDLIBS)

$(DMREPORT): app/dmreport.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMREPORT) app/dmreport.f90 $(TARGET) $(LDLIBS) $(LIBLUA54) $(LIBSQLITE3)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMREPORT) app/dmreport.f90 $(TARGET) $(LIBLUA54) $(LIBSQLITE3) $(LDLIBS)

$(DMSEND): app/dmsend.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMSEND) app/dmsend.f90 $(TARGET) $(LDLIBS) $(LIBLUA54) $(LIBRT)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMSEND) app/dmsend.f90 $(TARGET) $(LIBLUA54) $(LIBRT) $(LDLIBS)

$(DMSERIAL): app/dmserial.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMSERIAL) app/dmserial.f90 $(TARGET) $(LDLIBS) $(LIBLUA54) $(LIBPCRE2) $(LIBRT)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMSERIAL) app/dmserial.f90 $(TARGET) $(LIBLUA54) $(LIBPCRE2) $(LIBRT) $(LDLIBS)

$(DMSYNC): app/dmsync.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMSYNC) app/dmsync.f90 $(TARGET) $(LDLIBS) $(LIBCURL) $(LIBLUA54) $(LIBSQLITE3) $(LIBZ) $(LIBPTHREAD) $(LIBRT)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMSYNC) app/dmsync.f90 $(TARGET) $(LIBCURL) $(LIBLUA54) $(LIBSQLITE3) $(LIBZ) $(LIBPTHREAD) $(LIBRT) $(LDLIBS)

$(DMUUID): app/dmuuid.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMUUID) app/dmuuid.f90 $(TARGET) $(LDLIBS)

$(DMWEB): app/dmweb.f90 $(TARGET)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMWEB) app/dmweb.f90 $(TARGET) $(LDLIBS) $(LIBSQLITE3)
$(FC) $(FFLAGS) $(LDFLAGS) -o $(DMWEB) app/dmweb.f90 $(TARGET) $(LIBSQLITE3) $(LDLIBS)

# ******************************************************************************
#
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ containing the DMPACK module files is passed through argument `-I`.
| `dm_config` | Lua 5.4 | `pkg-config --libs lua-5.4` |
| `dm_db` | SQLite 3 | `pkg-config --libs sqlite3` |
| `dm_fcgi` | FastCGI | `-lfcgi` |
| `dm_hdf5` | HDF5 | `pkg-config --libs hdf5`, `-lhdf5_fortran` |
| `dm_la` | BLAS, LAPACK | `-llapack`, `-lblas` |
| `dm_hdf5` | HDF5 | `pkg-config --libs hdf5_fortran` |
| `dm_la` | BLAS, LAPACK | `pkg-config --libs lapack blas` |
| `dm_lua` | Lua 5.4 | `pkg-config --libs lua-5.4` |
| `dm_lua_api` | Lua 5.4 | `pkg-config --libs lua-5.4` |
| `dm_lua_geocom` | Lua 5.4 | `pkg-config --libs lua-5.4` |
Expand All @@ -268,7 +268,7 @@ containing the DMPACK module files is passed through argument `-I`.
| `dm_regex` | PCRE2 | `pkg-config --libs libpcre2-8` |
| `dm_rpc` | libcurl, zlib | `curl-config --libs`, `pkg-config --libs zlib` |
| `dm_sem` | POSIX | `-lpthread` |
| `dm_transform` | BLAS, LAPACK | `-llapack`, `-lblas` |
| `dm_transform` | BLAS, LAPACK | `pkg-config --libs lapack blas` |
| `dm_z` | zlib | `pkg-config --libs zlib` |

## Source Code Structure
Expand Down
56 changes: 33 additions & 23 deletions guide/guide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,8 @@ $ doas pkg install databases/sqlite3 devel/git devel/pcre2 devel/pkgconf ftp/cur
....

Instead of `math/gnuplot`, you may want to install `math/gnuplot-lite` which
does not depend on X11 (but lacks the raster graphic terminals).

Optionally, install Pygments and AsciiDoctor to generate the man pages and the
User’s Guide:
does not depend on X11 (but lacks the raster graphic terminals). Optionally,
install Pygments and AsciiDoctor to generate the man pages and the User’s Guide:

....
$ doas pkg install devel/rubygem-pygments.rb textproc/rubygem-asciidoctor
Expand Down Expand Up @@ -261,7 +259,9 @@ Then, run:

....
$ cd dmpack/
$ fpm build --profile release --flag "-D__FreeBSD__ -I/usr/local/include"
$ export FFLAGS="-D__FreeBSD__ -I/usr/local/include -ffree-line-length-0"
$ fpm build --profile release --flag "${FFLAGS}"
$ fpm test --flag "${FFLAGS}"
$ fpm install
....

Expand Down Expand Up @@ -307,46 +307,56 @@ $ cd dmpack/
$ make linux
....

If the SQLite 3 library has been built from source and installed to
`/usr/local/lib`, overwrite the variable `LIBSQLITE3` to pass the path of shared
library `libsqlite3.so`:
Install the DMPACK libraries and programs system-wide to `/usr`:

....
$ make OS=linux PREFIX=/usr LIBSQLITE3="-L/usr/local/lib -Wl,-rpath,/usr/local/lib -lsqlite3"
$ sudo make install_linux
....

For Intel oneAPI compilers, run instead:
To install to directory `/opt`, run:

....
$ make CC=icx FC=ifx FFLAGS="-mtune=native -O2 -fpic" CFLAGS="-mtune=native -O2 -fpic" \
LDFLAGS="-I./include -module ./include -L/usr/lib -L/opt/lib" PPFLAGS= \
INCHDF5="-I/opt/include/hdf5/mod/shared" LDLIBS="-Wl,-rpath,/opt/lib"
$ sudo make install PREFIX=/opt
....

In this case, the HDF5 libraries are installed to `/opt/lib`, and the modules
files to `/opt/include/hdf5/mod/shared`. Change the paths to the actual
locations.

Install the DMPACK libraries and programs system-wide to `/usr`:
[NOTE]
.Custom SQLite 3
====
If the SQLite 3 library has been built from source and installed to
`/usr/local/lib`, overwrite the variable `LIBSQLITE3` to pass the path of shared
library `libsqlite3.so`:
....
$ sudo make install_linux
$ make OS=linux PREFIX=/usr LIBSQLITE3="-L/usr/local/lib -lsqlite3"
....
====

To install to directory `/opt`, run:

[NOTE]
.Intel oneAPI Compilers
====
If Intel oneAPI is used instead of GCC, run:
....
$ sudo make install PREFIX=/opt
$ make CC=icx FC=ifx CFLAGS="-mtune=native -O2 -fpic" \
FFLAGS="-mtune=native -O2 -fpic" PPFLAGS= \
LDFLAGS="-I./include -module ./include -L/usr/lib -L/opt/lib" \
INCHDF5="-I/opt/include/hdf5/mod/shared"
....
In this case, the HDF5 libraries are installed to `/opt/lib`, and the modules
files to `/opt/include/hdf5/mod/shared`. Change the paths to the actual
locations.
====

==== Fortran Package Manager [[linux-fpm]]

To build DMPACK with the Fortran Package Manager, change to the cloned or
fetched repository, then run:

....
$ cd dmpack/
$ fpm build --profile release --flag "-D__linux__ `pkg-config --cflags hdf5`"
$ export FFLAGS="-D__linux__ `pkg-config --cflags hdf5` -ffree-line-length-0"
$ fpm build --profile release --flag "${FFLAGS}"
$ fpm test --flag "${FFLAGS}"
$ fpm install
....

Expand Down
2 changes: 1 addition & 1 deletion src/dm_db.f90
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ integer function dm_db_close(db, optimize) result(rc)
if (optimize_) rc = dm_db_optimize(db)

rc = E_DB
if (sqlite3_close(db%ptr) /= SQLITE_OK) return
if (sqlite3_close_v2(db%ptr) /= SQLITE_OK) return

db%ptr = c_null_ptr
rc = E_NONE
Expand Down
41 changes: 20 additions & 21 deletions src/dm_mqtt.f90
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ integer function dm_mqtt_publish(url, message, timeout, error_message, error_cur
character(len=:), allocatable, intent(out), optional :: error_message !! cURL error message.
integer, intent(out), optional :: error_curl !! cURL error code.

integer :: er
integer :: stat
type(c_ptr) :: curl_ptr

rc = E_IO
Expand All @@ -93,48 +93,47 @@ integer function dm_mqtt_publish(url, message, timeout, error_message, error_cur
rc = E_INVALID

! Set URL.
er = curl_easy_setopt(curl_ptr, CURLOPT_URL, url)
if (er /= CURLE_OK) exit curl_block
stat = curl_easy_setopt(curl_ptr, CURLOPT_URL, url)
if (stat /= CURLE_OK) exit curl_block

! Enable POST.
er = curl_easy_setopt(curl_ptr, CURLOPT_POST, 1)
if (er /= CURLE_OK) exit curl_block
stat = curl_easy_setopt(curl_ptr, CURLOPT_POST, 1)
if (stat /= CURLE_OK) exit curl_block

! Pass POST data directly.
er = curl_easy_setopt(curl_ptr, CURLOPT_POSTFIELDSIZE, len(message, kind=i8))
if (er /= CURLE_OK) exit curl_block
stat = curl_easy_setopt(curl_ptr, CURLOPT_POSTFIELDSIZE, len(message, kind=i8))
if (stat /= CURLE_OK) exit curl_block

er = curl_easy_setopt(curl_ptr, CURLOPT_POSTFIELDS, c_loc(message))
if (er /= CURLE_OK) exit curl_block
stat = curl_easy_setopt(curl_ptr, CURLOPT_POSTFIELDS, c_loc(message))
if (stat /= CURLE_OK) exit curl_block

! Set connection timeout.
if (present(timeout)) then
er = curl_easy_setopt(curl_ptr, CURLOPT_CONNECTTIMEOUT, timeout)
if (er /= CURLE_OK) exit curl_block
stat = curl_easy_setopt(curl_ptr, CURLOPT_CONNECTTIMEOUT, timeout)
if (stat /= CURLE_OK) exit curl_block
end if

! No output.
er = curl_easy_setopt(curl_ptr, CURLOPT_NOSIGNAL, 1)
if (er /= CURLE_OK) exit curl_block
stat = curl_easy_setopt(curl_ptr, CURLOPT_NOSIGNAL, 1)
if (stat /= CURLE_OK) exit curl_block

er = curl_easy_setopt(curl_ptr, CURLOPT_NOPROGRESS, 1)
if (er /= CURLE_OK) exit curl_block
stat = curl_easy_setopt(curl_ptr, CURLOPT_NOPROGRESS, 1)
if (stat /= CURLE_OK) exit curl_block

! Send request.
rc = E_MQTT
er = curl_easy_perform(curl_ptr)
if (er /= CURLE_OK) exit curl_block
stat = curl_easy_perform(curl_ptr)
if (stat /= CURLE_OK) exit curl_block

rc = E_NONE
end block curl_block

! Get error message.
if (present(error_message) .and. er /= CURLE_OK) then
error_message = curl_easy_strerror(er)
if (present(error_message) .and. stat /= CURLE_OK) then
error_message = curl_easy_strerror(stat)
end if

if (present(error_curl)) error_curl = er

if (present(error_curl)) error_curl = stat
call curl_easy_cleanup(curl_ptr)
end function dm_mqtt_publish

Expand Down
Loading

0 comments on commit 75f7ff2

Please sign in to comment.