Skip to content

build: preliminary pkgconf .pc file (WIP) #18881

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
/test-driver
/test-suite.log

/frr.pc
/frr-uninstalled.pc

/Makefile
/Makefile.in

Expand Down
3 changes: 3 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ EXTRA_DIST += \
m4/libtool-whole-archive.patch \
config.version \
\
frr.pc.in \
frr-uninstalled.pc.in \
\
python/clidef.py \
python/clippy/__init__.py \
python/clippy/elf.py \
Expand Down
4 changes: 4 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ fi
AC_SUBST([AC_LDFLAGS])
AC_SUBST([AC_LDFLAGS_EXEC])
AM_CONDITIONAL([STATIC_BIN], [test "$enable_static_bin" = "yes"])
AC_SUBST([LT_OBJDIR], [$lt_cv_objdir])

dnl libtool, the repository of all knowledge related linkers, is too stupid to
dnl correctly tell the linker how to build modules.
Expand Down Expand Up @@ -1065,6 +1066,7 @@ case "${enable_multipath}" in
esac

AC_DEFINE_UNQUOTED([MULTIPATH_NUM], [$MPATH_NUM], [Maximum number of paths for a route])
AC_SUBST([MULTIPATH_NUM], [$MPATH_NUM])

case "${with_log_timestamp_precision}" in
[[0-9]|1[012]])
Expand Down Expand Up @@ -2828,6 +2830,8 @@ AC_CONFIG_FILES([tools/frrinit.sh], [chmod +x tools/frrinit.sh])
AC_CONFIG_FILES([tools/frrcommon.sh])
AC_CONFIG_FILES([tools/frr.service])
AC_CONFIG_FILES([tools/[email protected]])
AC_CONFIG_FILES([frr.pc])
AC_CONFIG_FILES([frr-uninstalled.pc])

# dnl write out a ccls file with our compile configuration
# dnl have to add -Wno-unused-function otherwise foobar_cmd_magic causes
Expand Down
31 changes: 31 additions & 0 deletions frr-uninstalled.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 'root of all evil' path references
#
abs_top_srcdir="@abs_top_srcdir@"
abs_top_builddir="@abs_top_builddir@"
#
# the following are provided so you can line up installation paths.
# note you can access them with e.g. "pkgconf --variable=moduledir"
#
frr_runstatedir="@e_frr_runstatedir@"
frr_libstatedir="@e_frr_libstatedir@"
yangmodelsdir="@e_yangmodelsdir@"
moduledir="@e_moduledir@"
scriptdir="@e_scriptdir@"
frr_sysconfdir="@e_frr_sysconfdir@/"
vtysh_bin="@e_vtysh_bin@"
watchfrr_sh="@e_watchfrr_sh@"
#
# these are needed to make the build work
#
multipath_num="@MULTIPATH_NUM@"
libdir="@libdir@"
# FIXME: this is a relative path
clippy="@CLIPPY@"

Name: @PACKAGE@
Description: FRRouting non-installed build support
URL: @PACKAGE_BUGREPORT@
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -L${abs_top_builddir}/lib -L${abs_top_builddir}/lib/@LT_OBJDIR@ -Wl,-rpath,${libdir} -lfrr
Cflags: -I${abs_top_srcdir} -I${abs_top_builddir} -I${abs_top_srcdir}/lib -I${abs_top_builddir}/lib \
-fms-extensions -DMULTIPATH_NUM=${multipath_num}
30 changes: 30 additions & 0 deletions frr.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# when packaging an FRR source/build tree, fill in the next line
Copy link

Choose a reason for hiding this comment

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

There is no point in installing the whole build tree. Only certain headers are required for compiling dplane plugins: *.h, lib/*.h, zebra/*.h.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah this was just poorly worded, the intention is the header files. I was calling it build because the linux kernel thing is sometimes called kbuild

# (e.g. with /usr/src/frr)
#
abs_top_treedir="FILL_TREEDIR_DURING_PACKAGING"
Copy link

Choose a reason for hiding this comment

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

This file should be installed by make install into @PREFIX@/lib/pkgconfig. Also, you should replace FILL_TREEDIR_DURING_PACKAGING with @PREFIX@/src/frr-@VERSION@ to make downstream packaging easier. Also, all headers required to build dplane plugins should be installed in @PREFIX@/src/frr-@VERSION@ so that out of tree plugins can be compiled.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

autoconf doesn't have a "standard" path specifying command line option for /usr/src and I'm not sure it's a great idea to hardcode @PREFIX@/src/frr…. It probably makes sense to add a --with-headertree= or something, and have it default to @PREFIX@/src/frr-@VERSION@. This is all really just poking around right now, hence draft not PR.

#
# the following are provided so you can line up installation paths.
# note you can access them with e.g. "pkgconf --variable=moduledir"
#
frr_runstatedir="@e_frr_runstatedir@"
frr_libstatedir="@e_frr_libstatedir@"
yangmodelsdir="@e_yangmodelsdir@"
moduledir="@e_moduledir@"
scriptdir="@e_scriptdir@"
frr_sysconfdir="@e_frr_sysconfdir@/"
vtysh_bin="@e_vtysh_bin@"
watchfrr_sh="@e_watchfrr_sh@"
#
# these are needed to make the build work
#
multipath_num="@MULTIPATH_NUM@"
libdir="@libdir@"
clippy="${abs_top_treedir}/lib/clippy"

Name: @PACKAGE@
Description: FRRouting packaged-source-tree build support
URL: @PACKAGE_BUGREPORT@
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -Wl,-rpath,${libdir} -lfrr
Cflags: -I${abs_top_treedir} -I${abs_top_treedir}/lib \
Copy link

Choose a reason for hiding this comment

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

It is missing -I${abs_top_treedir}/zebra to build dplane plugins?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shouldn't be needed as long as you use #include <zebra/whatever.h> in the dplane plugin… the #include statements in the headers will work anyway because it's covered either by the -I{top} or it's same directory…

-fms-extensions -DMULTIPATH_NUM=${multipath_num}
Loading