[Openvpn-devel] cmocka: use relative paths
Commit Message
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>
---
configure.ac | 11 ++---------
vendor/Makefile.am | 15 +++++++--------
2 files changed, 9 insertions(+), 17 deletions(-)
Comments
On 22/08/18 00:08, Steffan Karger wrote:
> 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>
> ---
> configure.ac | 11 ++---------
> vendor/Makefile.am | 15 +++++++--------
> 2 files changed, 9 insertions(+), 17 deletions(-)
This fails on my system ...
---------------------------------------------------
$ rm -rf vendor/cmocka/
$ mkdir vendor/cmocka/
$ git submodule init
$ git submodule update
Submodule path 'vendor/cmocka': checked out 'b2732b52202ae48f866a024c633466efdbb8e85a'
$ autoreconf -vi
[....]
$ ./configure
[....]
$ make check
[....]
mkdir -p ./cmocka ./dist
(cd cmocka && cmake -DCMAKE_INSTALL_PREFIX=.././dist .././cmocka && make && make install)
-- The C compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Performing Test WITH_FPIC
-- Performing Test WITH_FPIC - Success
-- Performing Test WITH_STACK_PROTECTOR
-- Performing Test WITH_STACK_PROTECTOR - Success
CMake Error at cmake/Modules/MacroEnsureOutOfSourceBuild.cmake:13 (message):
cmocka requires an out of source build. Please create a separate build
directory and run 'cmake /path/to/cmocka [options]' there.
Call Stack (most recent call first):
CMakeLists.txt:41 (macro_ensure_out_of_source_build)
CMake Error at cmake/Modules/MacroEnsureOutOfSourceBuild.cmake:14 (message):
Remove the file CMakeCache.txt in
/home/davids/devel/OpenVPN/openvpn/vendor/cmocka first.
Call Stack (most recent call first):
CMakeLists.txt:41 (macro_ensure_out_of_source_build)
-- Configuring incomplete, errors occurred!
---------------------------------------------------
This patch had to be rebased on top of the latest git master, where the
merge conflict had the additional ${OPTIONAL_CRYPTO/PKCS11..} variables
in TEST_LDFLAGS and TEST_FLAGS which commit b081038c7464f7a916560b4
had brought in. So that shouldn't really be the cause of this error.
And for reference:
$ rpm -q cmake
cmake-2.8.12.2-2.el7.x86_64
--
kind regards,
David Sommerseth
OpenVPN Inc
@@ -1381,15 +1381,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="-lcmocka -L\$(abs_top_builddir)/vendor/dist/lib -Wl,-rpath,\$(abs_top_builddir)/vendor/dist/lib"
-TEST_CFLAGS="-I\$(top_srcdir)/include -I\$(abs_top_builddir)/vendor/dist/include"
+TEST_LDFLAGS="-lcmocka -L\$(top_builddir)/vendor/dist/lib -Wl,-rpath,\$(top_builddir)/vendor/dist/lib"
+TEST_CFLAGS="-I\$(top_srcdir)/include -I\$(top_builddir)/vendor/dist/include"
AC_SUBST([TEST_LDFLAGS])
AC_SUBST([TEST_CFLAGS])
@@ -1,18 +1,17 @@
-# 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
+cmockabuild = $(builddir)/cmocka
+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 cmocka && cmake -DCMAKE_INSTALL_PREFIX=../$(cmockadist) ../$(cmockasrc) && make && make install)
endif
check: libcmocka