New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #19425 (closed submission: fixed)

Opened 4 years ago

Last modified 4 years ago

Add libdbi port

Reported by: mta@… Owned by: snc@…
Priority: Normal Milestone:
Component: ports Version: 1.7.1
Keywords: Cc:
Port: libdbi-drivers

Description

I wanted to build GnuCash with the database backend which requires libdbi. I couldn't find a port for this so I created one. Actually I created two, one for libdbi and one for its drivers. The libdbi-drivers port has a variant for each of the drivers that I thought might be useful. The only one I've tested much is mysql.

Attachments

Portfile (762 bytes) - added by mta@… 4 years ago.
libdbi Portfile
Portfile.2 (1.5 KB) - added by mta@… 4 years ago.
libdbi-drivers Portfile
Portfile.3 (1.6 KB) - added by mta@… 4 years ago.
Corrected libdbi-drivers Portfile
Portfile.4 (918 bytes) - added by mta@… 4 years ago.
libdbi Portfile which fixes endian bug on PPC machines
Portfile.5 (1.8 KB) - added by mta@… 4 years ago.
libdbi-drivers Portfile that works for mysql and postgresql
endian.patch (1.4 KB) - added by mta@… 4 years ago.
Corrected patch to fix endian problem in libdbi

Change History

Changed 4 years ago by mta@…

libdbi Portfile

Changed 4 years ago by mta@…

libdbi-drivers Portfile

comment:1 follow-up: ↓ 4 Changed 4 years ago by blb@…

  • Port changed from libdbi to libdbi libdbi-drivers

libdbi added in r50096, thanks; two changes made to the port:

  • removed :libdbi from master_sites since the port's name is the default
  • used obfuscated form of maintainers

libdbi-drivers needs some changes first:

  • don't hardcode /opt/local, use ${prefix} instead
  • the database variants will need to have a dependency on the proper database, and they should be named for the version to use; for example, instead of postgresql call it postgresql83 and add the following to it:
    depends_lib-append   port:postgresql83
    

then do the same for the other variants.

  • since building the port without any variants selected causes this to install nothing, which would causes issues and confusion, you should select a default if none is selected; I suggest sqlite3 since it's lightweight, so added the following:
    if {![variant_isset mysql5] && ![variant_isset postgresql83] && ![variant_isset sqlite] && ![variant_isset sqlite3]} {
       default_variants     +sqlite3
    }
    

Obviously add other variants you add if you want to also have support for other databases.

  • There is no port for msql currently, so that should be removed

Changed 4 years ago by mta@…

Corrected libdbi-drivers Portfile

comment:2 Changed 4 years ago by jmr@…

  • Type changed from enhancement to submission

comment:3 Changed 4 years ago by anonymous

  • Milestone Port Submissions deleted

Milestone Port Submissions deleted

comment:4 in reply to: ↑ 1 Changed 4 years ago by mta@…

Replying to blb@…:

libdbi-drivers needs some changes first:

I submitted a new version of this port which I think fixed these problems, but it hasn't been committed yet. Are there further problems that I need to fix?

comment:5 follow-up: ↓ 6 Changed 4 years ago by blb@…

+sqlite3 looks good, but trying +postgresql83 appears to need to be told how to find the headers:

 /usr/bin/gcc-4.0 -DHAVE_CONFIG_H -I. -I. -I../.. -I../.. -I../../include -I/mp/include -I/mp/include -I/mp/include -O20 -D__NO_MATH_INLINES -fsigned-char -MT dbd_pgsql.lo -MD -MP -MF .deps/dbd_pgsql.Tpo -c dbd_pgsql.c  -fno-common -DPIC -o .libs/dbd_pgsql.o
dbd_pgsql.c:56:22: error: libpq-fe.h: No such file or directory
dbd_pgsql.c: In function '_dbd_real_connect':
dbd_pgsql.c:156: error: 'PGconn' undeclared (first use in this function)
dbd_pgsql.c:156: error: (Each undeclared identifier is reported only once
dbd_pgsql.c:156: error: for each function it appears in.)
dbd_pgsql.c:156: error: 'pgconn' undeclared (first use in this function)
dbd_pgsql.c:217: error: 'CONNECTION_BAD' undeclared (first use in this function)
...

Similar issue with +mysql5:

 /usr/bin/gcc-4.0 -DHAVE_CONFIG_H -I. -I. -I../.. -I../.. -I../../include -I/mp/include -I/mp/include -I/mp/include -O20 -D__NO_MATH_INLINES -fsigned-char -MT dbd_mysql.lo -MD -MP -MF .deps/dbd_mysql.Tpo -c dbd_mysql.c  -fno-common -DPIC -o .libs/dbd_mysql.o
dbd_mysql.c:54:25: error: mysql/mysql.h: No such file or directory
dbd_mysql.c:111: error: syntax error before '*' token
dbd_mysql.c: In function 'dbd_connect':
dbd_mysql.c:134: error: 'MYSQL' undeclared (first use in this function)
dbd_mysql.c:134: error: (Each undeclared identifier is reported only once
dbd_mysql.c:134: error: for each function it appears in.)
dbd_mysql.c:134: error: 'mycon' undeclared (first use in this function)
dbd_mysql.c:149: error: 'CLIENT_COMPRESS' undeclared (first use in this function)

Changed 4 years ago by mta@…

libdbi Portfile which fixes endian bug on PPC machines

Changed 4 years ago by mta@…

libdbi-drivers Portfile that works for mysql and postgresql

comment:6 in reply to: ↑ 5 Changed 4 years ago by mta@…

I just attached a new Portfile that I think fixes the libdbi-driver problems.

I also attached a new Portfile and associated patch file for libdbi since I discovered an endian bug in it today. I'm still running on a PPC machine and libdbi didn't return integer values correctly on that architecture.

Both of these new Portfiles have a +debug variant that builds the library with debug symbols. If you don't like that, you can remove it. I find it useful for finding problems like this one.

Changed 4 years ago by mta@…

Corrected patch to fix endian problem in libdbi

comment:7 Changed 4 years ago by mta@…

I just replaced the patch which fixes the endian problem in libdbi. The libdbi driver API supports 3 byte integers which are a rather unusual data type and my patch didn't handle them consistently with the rest of the code.

comment:8 Changed 4 years ago by blb@…

  • Status changed from new to closed
  • Resolution set to fixed

libdbi updated in r52205, with a bump in revision since it modifies what is installed.

libdbi-drivers added in r52206, thanks.

comment:9 follow-up: ↓ 11 Changed 4 years ago by snc@…

  • Status changed from closed to reopened
  • Resolution fixed deleted

Reopening to track the MySQL dependency's need to be fixed (should use path: instead of port:).

comment:10 Changed 4 years ago by snc@…

  • Status changed from reopened to new
  • Owner changed from macports-tickets@… to snc@…
  • Port changed from libdbi libdbi-drivers to libdbi-drivers

comment:11 in reply to: ↑ 9 Changed 4 years ago by ryandesign@…

  • Status changed from new to closed
  • Resolution set to fixed

Replying to snc@…:

Reopening to track the MySQL dependency's need to be fixed (should use path: instead of port:).

Done in r52353.

Note: See TracTickets for help on using tickets.