Closed scottfurry closed 8 years ago
Several years ago I was asked by someone from the Fedora project to add the file wxsqlite3.pc.in
. So I did them the favor. They use it to build a wxSQLite3 package for Fedora. That's the story behind this file.
I'm open to modify or add files, if this helps users of wxSQLite3. However, currently I do most of the development under Windows, and I don't have much experience with different Linux systems.
Fair enough. Oddly enough, it was that bug report that led me here.
From what I understand, the problem was over a music program called guayadeque, I've forked this project - musicqueue home page . Working with Martin, Fedora maintainer, on packaging I noticed that Fedora configuration file removes the bundled wxsqlite3 code in my project.
Some digging on my part and I've discovered that both Debian and Fedora will automagically manipulate the pc.in
file then install it. Sad part is that in the Arch package, the pc.in
file is not manipulated and not installed. This makes packaging autoconfig difficult.
My goal here is consistency...if to make my own packaging needs easier. I would prefer not to make work for you. I would be happy to help you on this front.
It was Martin, who contacted me back then. Maybe he could help to sort things out, so that your use case is covered and things for Fedora not broken.
I myself am a bit in a dilemma. Up to now I mostly used bakefile
to generate all build files, especially for the autoconf/automake toolchain. However, bakefile
is heavily outdated and generating the autoconf files with bakefile has always been a pain. For my own Windows-based projects I switched to premake
, but premake
is not able to generate autoconf files.
As said I'm open to modify or add files to wxSQLite3 to make things easier for wxSQLite3 users. However, I don't know unfortunately what has to be done so that wxSQLite3 fulfills the requirements of your project.
A couple of lines need to be added to configure.ac for autotools to populate a working pkg-config file. ( see here ). That's the easy part actually.
From my own experience with the wxWidgets build tree, yeah...it can be a bit daunting dealing with bakefiles. I keep a pair of bash files to build wxW natively and cross-compile. Every time I dig into the wxW/samples folder I see the numerous build files and cringe.
As for wxSqlite3 - Fedora manually manipulates the pc.in to make a pkg-config file (see link just above). Debain maintains their own but it looks like a duplicate to what you have created. The distribution I use, Arch, does nothing with that file. I have filed a bug report to change the packaging to create and install the wxsqlite3.pc file.
What I would like to help with is making the above go away. Autotools just needs the commands/instructions to take the template file ( .in ) and create the pkg-config file ( .pc ). No more manual manipulation of text files during build/install - autotools does the heavy lifting for us. This is what I would like to help with - change the configure with the needed instructions.
From the link you provided I get the impression that adding just 2 lines to configure.ac
should be sufficient:
AC_CONFIG_FILES([wxsqlite3.pc])
AC_OUTPUT
Would it be ok to simply append those lines? Or is there a certain sequence required? Could you test this on your system and provide a patch? Or how should we proceed otherwise?
That sounds about right. Modify the file build/configure.ac
. I'll try that here on my end (I have a clone of the repo). I'll test, report back the results and if successful throw up a diff (or pull request). Does that sound fair to you?
Well, I modified build/configure.ac
, executed acregen.sh
to regenerate the configure
file, and finally executed configure
. No error messages. A file wxsqlite3.pc
was generated as a result. However, it was an exact copy of wxsqlite3.pc.in
. I doubt that this is the expected behaviour.
As I said I'm not familiar with the autoconf/automake toolchain. If you have more luck, let me know.
The following changes at the end of the configure.ac file will populate wxsqlite3.pc.in
WXCODE_END_PART2
AC_SUBST( WXVERSION, "3.0" )
AC_SUBST( LIBDIR, "lib" )
AC_SUBST( VERSION, "3.3.1" )
AC_CONFIG_FILES([wxsqlite3.pc])
AC_OUTPUT
Now we just need to derive or copy over the variables that go into the .pc.in
file.
Small steps.
Ok, adding these AC_SUBST
lines populates the corresponding fields of wxsqlite3.pc
. However, I would like to avoid redundancy and potential mismatches. The value for the wxSQLite3 VERSION
is already defined in the AC_INIT
line at the beginning of configure.ac
, and WXVERSION
is determined on executing configure
where the version of the installed default wxWidgets version is detected.
For the wxSQLite3 VERSION
this can be solved by specifying
AC_SUBST( VERSION, $PACKAGE_VERSION )
However, I have no idea, how to reference the wxWidgets version number detected by configure
.
Inspecting the autoconf utility files coming from wxCode I found that accessing the wxWidgets version detected by configure
can be done as follows:
AC_SUBST( WXVERSION, "$WX_VERSION_MAJOR.$WX_VERSION_MINOR" )
That is, we have now the following modification to configure.ac
:
WXCODE_END_PART2
AC_SUBST( WXVERSION, "$WX_VERSION_MAJOR.$WX_VERSION_MINOR" )
AC_SUBST( LIBDIR, "lib" )
AC_SUBST( VERSION, $PACKAGE_VERSION )
AC_CONFIG_FILES([wxsqlite3.pc])
AC_OUTPUT
Anything else that needs to be adjusted?
I think you've pretty much nailed it!
This change, made to both configure.ac
files (build and build28 folders) , as well as marking the build/acregen.sh
file as executable ( file is missing "executable" permission flag) and I'm good with closing the bug.
I applied the changes. Please check. Reopen the issue if necessary.
Everything works perfectly as expected. git clean, reset, and merge of repo looks good.
There is just one problem that I didn't realize...
The library name used: the .pc.in
file is hardcoded. A unicode build will make the output library -lwxcode_gtk2u_wxsqlite3-3.0
.
Suggest these changes... In configure.ac
AC_SUBST( VERSION, $PACKAGE_VERSION )
if test "$UNICODE" = "1"; then
AC_SUBST( LIBMOD, "u" )
else
AC_SUBST( LIBMOD, "" )
fi
AC_CONFIG_FILES([wxsqlite3.pc])
AC_OUTPUT
In wxsqlite3.pc.in
Libs: -L${libdir} -lwxcode_gtk2@LIBMOD@_wxsqlite3-@WXVERSION@
I applied the proposed changes. Please recheck. Thanks.
Looks good. I hate this "just one more...". Martin from Fedora just tweaked me to the port version used in the library name. One more addition...
diff --git a/wxsqlite3.pc.in b/wxsqlite3.pc.in
index 9c88398..c08f279 100644
--- a/wxsqlite3.pc.in
+++ b/wxsqlite3.pc.in
@@ -9,6 +9,6 @@ Name: wxsqlite3-@WXVERSION@
Description: SQLite3 C++ wrapper for use in programs based on the wxWidgets
Version: @VERSION@
#Requires: sqlite3
-Libs: -L${libdir} -lwxcode_gtk2@LIBMOD@_wxsqlite3-@WXVERSION@
+Libs: -L${libdir} -lwxcode_@PORT@@LIBMOD@_wxsqlite3-@WXVERSION@
Libs.private: -lpthread
Cflags: -I${includedir}
diff --git a/build/configure.ac b/build/configure.ac
index f0aa29f..b365830 100644
--- a/build/configure.ac
+++ b/build/configure.ac
@@ -121,6 +121,7 @@ WXCODE_END_PART2
AC_SUBST( WXVERSION, "$WX_VERSION_MAJOR.$WX_VERSION_MINOR" )
AC_SUBST( LIBDIR, "lib" )
AC_SUBST( VERSION, $PACKAGE_VERSION )
+AC_SUBST( PORT, $WX_PORT )
if test "$UNICODE" = "1"; then
AC_SUBST( LIBMOD, "u" )
else
diff --git a/build28/configure.ac b/build28/configure.ac
index f0aa29f..b365830 100644
--- a/build28/configure.ac
+++ b/build28/configure.ac
@@ -121,6 +121,7 @@ WXCODE_END_PART2
AC_SUBST( WXVERSION, "$WX_VERSION_MAJOR.$WX_VERSION_MINOR" )
AC_SUBST( LIBDIR, "lib" )
AC_SUBST( VERSION, $PACKAGE_VERSION )
+AC_SUBST( PORT, $WX_PORT )
if test "$UNICODE" = "1"; then
AC_SUBST( LIBMOD, "u" )
else
Changes applied. Hopefully this now makes everybody happy.
Thank You.
seems strange to find a pkg-config template file in the stream but not have that file populated for install.
My experience with other packages, .pc.in files are processed to become .pc and available for install. This is not done here.