Skip to content

Commit

Permalink
cmocka: use relative paths
Browse files Browse the repository at this point in the history
Simplifies the build scripts, and fixes my CI, where paths on the test
slave can be different from paths on the build slave.

Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <20181028145449.12676-1-steffan@karger.me>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg17849.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
  • Loading branch information
syzzer authored and dsommers committed Apr 17, 2019
1 parent 6206316 commit 4ded2de
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ doc/openvpn.8.html
/doc/doxygen/openvpn.doxyfile
distro/systemd/*.service
sample/sample-keys/sample-ca/
vendor/.build
vendor/cmocka_build
vendor/dist
build/msvc/msvc-generate/version.m4

Expand Down
11 changes: 2 additions & 9 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1353,15 +1353,8 @@ AC_SUBST([sampledir])
AC_SUBST([systemdunitdir])
AC_SUBST([tmpfilesdir])

VENDOR_SRC_ROOT="\$(abs_top_srcdir)/vendor/"
VENDOR_DIST_ROOT="\$(abs_top_builddir)/vendor/dist"
VENDOR_BUILD_ROOT="\$(abs_top_builddir)/vendor/.build"
AC_SUBST([VENDOR_SRC_ROOT])
AC_SUBST([VENDOR_BUILD_ROOT])
AC_SUBST([VENDOR_DIST_ROOT])

TEST_LDFLAGS="${OPTIONAL_CRYPTO_LIBS} ${OPTIONAL_PKCS11_LIBS} ${OPTIONAL_LZO_LIBS} -lcmocka -L\$(abs_top_builddir)/vendor/dist/lib -Wl,-rpath,\$(abs_top_builddir)/vendor/dist/lib"
TEST_CFLAGS="${OPTIONAL_CRYPTO_CFLAGS} ${OPTIONAL_PKCS11_CFLAGS} ${OPTIONAL_LZO_CFLAGS} -I\$(top_srcdir)/include -I\$(abs_top_builddir)/vendor/dist/include"
TEST_LDFLAGS="${OPTIONAL_CRYPTO_LIBS} ${OPTIONAL_PKCS11_HELPER_LIBS} -lcmocka -L\$(top_builddir)/vendor/dist/lib -Wl,-rpath,\$(top_builddir)/vendor/dist/lib"
TEST_CFLAGS="${OPTIONAL_CRYPTO_CFLAGS} ${OPTIONAL_PKCS11_HELPER_CFLAGS} -I\$(top_srcdir)/include -I\$(top_builddir)/vendor/dist/include"

AC_SUBST([TEST_LDFLAGS])
AC_SUBST([TEST_CFLAGS])
Expand Down
16 changes: 8 additions & 8 deletions vendor/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# needs an absolute path bc. of the cmake invocation
cmockasrc = "@VENDOR_SRC_ROOT@/cmocka"
cmockabuild = "@VENDOR_BUILD_ROOT@/cmocka"
cmockainstall = "@VENDOR_DIST_ROOT@"
cmockasrc = $(srcdir)/cmocka
# Not just '$(builddir)/cmocka', because cmocka requires an out-of-source build
cmockabuild = $(builddir)/cmocka_build
cmockadist = $(builddir)/dist

MAINTAINERCLEANFILES = \
$(srcdir)/Makefile.in \
"$(cmockabuild)" \
"$(cmockainstall)" \
"@VENDOR_BUILD_ROOT@"
"$(cmockadist)"

libcmocka:
if CMOCKA_INITIALIZED
mkdir -p $(cmockabuild) $(cmockainstall)
(cd $(cmockabuild) && cmake -DCMAKE_INSTALL_PREFIX=$(cmockainstall) $(cmockasrc) && make && make install)
mkdir -p $(cmockabuild) $(cmockadist)
## Compensate for the cd in the paths
(cd $(cmockabuild) && cmake -DCMAKE_INSTALL_PREFIX=../$(cmockadist) ../$(cmockasrc) && make && make install)
endif

check: libcmocka
Expand Down

0 comments on commit 4ded2de

Please sign in to comment.