Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automake: add include directories from environment variable #2038

Merged
merged 3 commits into from
Jul 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions recipes/automake/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
sources:
"1.16.1":
url: "https://ftp.gnu.org/gnu/automake/automake-1.16.1.tar.gz"
sha256: "608a97523f97db32f1f5d5615c98ca69326ced2054c9f82e65bade7fc4c9dea8"
"1.16.2":
url: "https://ftp.gnu.org/gnu/automake/automake-1.16.2.tar.gz"
sha256: "b2f361094b410b4acbf4efba7337bdb786335ca09eb2518635a09fb7319ca5c1"
patches:
"1.16.1":
- base_path: "source_subfolder"
patch_file: "patches/0001-help2man-no-discard-stderr.patch"
- base_path: "source_subfolder"
patch_file: "patches/0002-no-perl-path-in-shebang.patch"
- base_path: "source_subfolder"
patch_file: "patches/0003-remove-embedded-datadirs.patch"
- base_path: "source_subfolder"
patch_file: "patches/0004-introduce-automake_perllibdir.patch"
url: "https://ftp.gnu.org/gnu/automake/automake-1.16.1.tar.gz"
sha256: "608a97523f97db32f1f5d5615c98ca69326ced2054c9f82e65bade7fc4c9dea8"
patches:
"1.16.2":
- base_path: "source_subfolder"
patch_file: "patches/0001-help2man-no-discard-stderr-0.16.2.patch"
- base_path: "source_subfolder"
patch_file: "patches/0002-no-perl-path-in-shebang-0.16.2.patch"
- base_path: "source_subfolder"
patch_file: "patches/0003-remove-embedded-datadirs-0.16.2.patch"
patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.2.patch"
- base_path: "source_subfolder"
patch_file: "patches/0004-introduce-automake_perllibdir-0.16.2.patch"
"1.16.1":
- base_path: "source_subfolder"
patch_file: "patches/0001-help2man-no-discard-stderr-0.16.1.patch"
- base_path: "source_subfolder"
patch_file: "patches/0002-no-perl-path-in-shebang-0.16.1.patch"
- base_path: "source_subfolder"
patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.1.patch"
- base_path: "source_subfolder"
patch_file: "patches/0004-introduce-automake_perllibdir-0.16.1.patch"
2 changes: 2 additions & 0 deletions recipes/automake/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,7 @@ def package_info(self):
self.output.info("Setting AUTOMAKE to {}".format(automake))
self.env_info.AUTOMAKE = automake

self.output.info("Append M4 include directories to AUTOMAKE_CONAN_INCLUDES environment variable")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something the consumers need to add themselves? Why not populating here that environment variable?

Copy link
Contributor Author

@madebr madebr Jun 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, consumers need to populate this.
pkgconf is an example:

A default autoconf/automake installation provides a few standard macros to generate the configure script.
pkgconf provides a m4 file which extends this list of macros with pkg-config related macros (see pkgconf's test_package for an example).

Please also check out the zbar pull request. There we found out that the default autoconf/automake misses macros related to iconv to which I don't have a good solution yet.

This would also be a good use case of your context concept. It would be nice to require a dependency, but only in the context of running autoreconf.


self.user_info.compile = os.path.join(self._automake_libdir, "compile")
self.user_info.ar_lib = os.path.join(self._automake_libdir, "ar-lib")
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
-my @system_includes = ('@datadir@/aclocal');
+my @automake_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal-' . $APIVERSION);
+my @system_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal');

+my @conan_includes = uniq(split(/:/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || ""));
-
# Whether we should copy M4 file in $user_includes[0].
my $install = 0;
@@ -451,6 +451,6 @@
}
scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes);
scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes);
+ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes);
-
# Construct a new function that does the searching. We use a
# function (instead of just evaluating $search in the loop) so that
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
-my @system_includes = ('@datadir@/aclocal');
+my @automake_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal-' . $APIVERSION);
+my @system_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal');

+my @conan_includes = uniq(split(/:/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || ""));
-
# Whether we should copy M4 file in $user_includes[0].
my $install = 0;
@@ -445,6 +445,6 @@
}
scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes);
scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes);
+ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes);
-
# Construct a new function that does the searching. We use a
# function (instead of just evaluating $search in the loop) so that
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--- bin/aclocal.in
+++ bin/aclocal.in
@@ -64,6 +64,6 @@
my @user_includes = ();
my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION);
my @system_includes = ('@datadir@/aclocal');
+my @conan_includes = uniq(strip(/:/, $ENV{'AUTOMAKE_CONAN_INCLUDES'}))
-
# Whether we should copy M4 file in $user_includes[0].
my $install = 0;
@@ -445,6 +445,6 @@ sub scan_m4_files ()
}
scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes);
scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes);
+ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes);
-
# Construct a new function that does the searching. We use a
# function (instead of just evaluating $search in the loop) so that
4 changes: 3 additions & 1 deletion recipes/automake/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
exports_sources = "configure.ac", "Makefile.am", "test_package_1.c", "test_package.cpp"
# DON'T COPY extra.m4 TO BUILD FOLDER!!!

def build_requirements(self):
if tools.os_info.is_windows and "CONAN_BASH_PATH" not in os.environ \
Expand Down Expand Up @@ -49,7 +50,8 @@ def _build_scripts(self):

def _build_autotools(self):
"""Test autoreconf + configure + make"""
self.run("{} --verbose --install".format(os.environ["AUTORECONF"]), win_bash=tools.os_info.is_windows)
with tools.environment_append({"AUTOMAKE_CONAN_INCLUDES": [tools.unix_path(self.source_folder)]}):
self.run("{} --verbose --install".format(os.environ["AUTORECONF"]), win_bash=tools.os_info.is_windows)
self.run("{} --help".format(os.path.join(self.build_folder, "configure").replace("\\", "/")), win_bash=tools.os_info.is_windows)
autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
with self._build_context():
Expand Down
11 changes: 8 additions & 3 deletions recipes/automake/all/test_package/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,23 @@ AC_INIT([test_package], [1.0])
# Safety checks in case user overwritten --srcdir
AC_CONFIG_SRCDIR([test_package.cpp])


# Store the auxiliary build tools (e.g., install-sh, config.sub, config.guess)
# in this dir (build-aux)
AC_CONFIG_AUX_DIR([build-aux])

AC_CONFIG_HEADER([config.h])
AC_OUTPUT

# Init automake, and specify this program use relaxed structures.
# i.e. this program doesn't follow the gnu coding standards, and doesn't have
# ChangeLog, COPYING, AUTHORS, INSTALL, README etc. files.
AM_INIT_AUTOMAKE([-Wall -Werror foreign])

# Test includes of extra including directories using conan
AUTOMAKE_TEST_PACKAGE_PREREQ([1.0])
AUTOMAKE_TEST_PACKAGE_HELLO([argument1], [argument2], [...], [last argument])

AC_CONFIG_HEADER([config.h])


# Check for CC and CXX compiler
AC_PROG_CC
AC_PROG_CXX
Expand Down
14 changes: 14 additions & 0 deletions recipes/automake/all/test_package/extra.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
dnl This file contains a macro to test adding extra include dirs using conan

AC_DEFUN([AUTOMAKE_TEST_PACKAGE_PREREQ],[
m4_define([CONAN_MACRO_VERSION], [1.3])
m4_if(m4_version_compare(CONAN_MACRO_VERSION, [$1]),
-1,
[m4_fatal([extra.m4 version $1 or higher is required, but ]CONAN_MACRO_VERSION[ found])]
)
])dnl AUTOMAKE_TEST_PACKAGE_PREREQ

AC_DEFUN([AUTOMAKE_TEST_PACKAGE_HELLO],[
echo "Hello world from the extra.m4 script!"
echo "My args were: $*"
])dnl