Blame project/config/cfgdefs.sh

38a7e3
# in projects where [ $mb_use_custom_cfgdefs = yes ],
38a7e3
# cfgdefs.sh is invoked from within ./configure via
38a7e3
# . $mb_project_dir/project/cfgdefs.sh
38a7e3
38a7e3
# this file is covered by COPYING.BAUTOMAKE.
38a7e3
38a7e3
# a successful return from cfgdefs.sh will be followed
38a7e3
# by a second invocation of the config_copy() function,
38a7e3
# reflecting any changes to common config variables
38a7e3
# made by cfgdefs.sh.
38a7e3
38a7e3
# finally, cfgdefs.sh may update the contents of the
38a7e3
# config-time generated cfgdefs.mk.
38a7e3
5ed842
mb_manifest=MANIFEST.rawball
38a7e3
38a7e3
for arg ; do
38a7e3
	case "$arg" in
eeb091
		--with-host-perl=*)
eeb091
			mb_host_perl=${arg#*=}
eeb091
			;;
eeb091
eeb091
		--with-host-sh=*)
eeb091
			mb_host_sh=${arg#*=}
eeb091
			;;
eeb091
38a7e3
		*)
38a7e3
			error_msg ${arg#}: "unsupported config argument."
38a7e3
			exit 2
38a7e3
	esac
38a7e3
done
38a7e3
38a7e3
38a7e3
cfgdefs_detect_automake_version()
38a7e3
{
38a7e3
	automake_ver=$(grep 'VERSION' "$mb_source_dir/doc/version.texi")
38a7e3
	automake_ver=${automake_ver##* }
38a7e3
38a7e3
	automake_year=$(grep 'UPDATED-MONTH' "$mb_source_dir/doc/version.texi")
38a7e3
	automake_year=${automake_year##* }
38a7e3
38a7e3
	automake_major=$(printf '%s' "$automake_ver" | cut -d'.' -f1)
38a7e3
	automake_minor=$(printf '%s' "$automake_ver" | cut -d'.' -f2)
38a7e3
	automake_micro=$(printf '%s' "$automake_ver" | cut -d'.' -f3)
38a7e3
38a7e3
	if [ -z "$automake_major" ] || [ -z "$automake_minor" ]; then
38a7e3
		error_msg "Could not properly parse automake's version.texi"
38a7e3
		exit 2
38a7e3
	fi
38a7e3
}
38a7e3
38a7e3
38a7e3
cfgdefs_output_custom_defs()
38a7e3
{
eeb091
	mb_host_perl=${mb_host_perl:-/usr/bin/perl}
eeb091
	mb_host_sh=${mb_host_sh:-/usr/bin/sh}
01ddc0
	mb_makeinfo=$(command -v makeinfo || true)
01ddc0
01ddc0
	if [ -n "$mb_makeinfo" ]; then
01ddc0
		mb_all_info='all-info-docs'
01ddc0
		mb_install_info='install-info-docs'
01ddc0
	else
01ddc0
		mb_all_info=
01ddc0
		mb_install_info=
01ddc0
	fi
eeb091
38a7e3
	sed \
38a7e3
			-e 's/@automake_ver@/'"$automake_ver"'/g'       \
38a7e3
			-e 's/@automake_year@/'"$automake_year"'/g'     \
38a7e3
			-e 's/@automake_major@/'"$automake_major"'/g'   \
38a7e3
			-e 's/@automake_minor@/'"$automake_minor"'/g'   \
38a7e3
			-e 's/@automake_micro@/'"$automake_micro"'/g'   \
eeb091
			-e 's!@host_perl@!'"$mb_host_perl"'!g'          \
eeb091
			-e 's!@host_sh@!'"$mb_host_sh"'!g'              \
01ddc0
			-e 's!@makeinfo@!'"$mb_makeinfo"'!g'            \
01ddc0
			-e 's!@all_info@!'"$mb_all_info"'!g'            \
01ddc0
			-e 's!@install_info@!'"$mb_install_info"'!g'    \
38a7e3
		"$mb_project_dir/project/config/cfgdefs.in"         \
38a7e3
	| sed -e 's/[ \t]*$//g'                                     \
38a7e3
			>> "$mb_pwd/cfgdefs.mk"
38a7e3
}
38a7e3
38a7e3
f20401
cfgdefs_output_source_lists()
f20401
{
f20401
	# raw m4 macros
f20401
	printf '\n\nAUTOMAKE_M4_SOURCE_FILES = \\\n' \
f20401
			>> "$mb_pwd/cfgdefs.mk"
f20401
f20401
	printf '\t$(SOURCE_DIR)/%s \\\n'                       \
5ed842
		$(grep '/m4/' "$mb_source_dir/$mb_manifest"     \
f20401
			| grep -v -e '/acdir/' -e '/internal/'   \
f20401
			| grep -v -e '/amversion.in'              \
f20401
			| cut -d' ' -f3)                           \
f20401
			>> "$mb_pwd/cfgdefs.mk"
f20401
f20401
f20401
	# raw am snippets
f20401
	printf '\n\nAUTOMAKE_AM_SOURCE_FILES = \\\n' \
f20401
			>> "$mb_pwd/cfgdefs.mk"
f20401
5ed842
	printf '\t$(SOURCE_DIR)/%s \\\n'                    \
5ed842
		$(grep '/am/' "$mb_source_dir/$mb_manifest"  \
5ed842
			| cut -d' ' -f3)                      \
f20401
			>> "$mb_pwd/cfgdefs.mk"
f20401
f20401
f20401
	# raw perl scripts
f20401
	printf '\n\nAUTOMAKE_PM_SOURCE_FILES = \\\n' \
f20401
			>> "$mb_pwd/cfgdefs.mk"
f20401
f20401
	printf '\t$(SOURCE_DIR)/%s \\\n'                             \
5ed842
		$(grep '/Automake/' "$mb_source_dir/$mb_manifest"     \
f20401
			| cut -d' ' -f3)                               \
f20401
			>> "$mb_pwd/cfgdefs.mk"
f20401
f20401
f20401
	# raw automake scripts
f20401
	printf '\n\nAUTOMAKE_LIB_SOURCE_FILES = \\\n' \
f20401
			>> "$mb_pwd/cfgdefs.mk"
f20401
f20401
	printf '\t$(SOURCE_DIR)/%s \\\n'                        \
5ed842
		$(grep '/lib/' "$mb_source_dir/$mb_manifest"     \
f20401
			| grep -v -e '/am/' -e '/Automake/'       \
f20401
			| cut -d' ' -f3)                           \
f20401
			>> "$mb_pwd/cfgdefs.mk"
f20401
f20401
	printf '\n\n'   >> "$mb_pwd/cfgdefs.mk"
1697f4
1697f4
1697f4
	# m4 config files
1697f4
	printf '\n\nAUTOMAKE_CFG_SOURCE_FILES = \\\n' \
1697f4
			>> "$mb_pwd/cfgdefs.mk"
1697f4
1697f4
	printf '\t$(SOURCE_DIR)/%s \\\n'                             \
1697f4
		$(grep '/m4/internal/' "$mb_source_dir/$mb_manifest"  \
1697f4
			| cut -d' ' -f3)                               \
1697f4
			>> "$mb_pwd/cfgdefs.mk"
1697f4
f20401
}
f20401
f20401
38a7e3
# automake version info
38a7e3
cfgdefs_detect_automake_version
38a7e3
38a7e3
# cfgdefs.in --> cfgdefs.mk
38a7e3
cfgdefs_output_custom_defs
38a7e3
f20401
# create a list of raw files to install
f20401
cfgdefs_output_source_lists
f20401
38a7e3
# all done
38a7e3
return 0