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

man: allow man pages to be built when not in a ./build dir #572

Merged
merged 1 commit into from
Jul 23, 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
5 changes: 4 additions & 1 deletion man/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ if (WITH_MAN)
execute_process(
COMMAND ${DATE_EXECUTABLE} "+%d %B %Y"
OUTPUT_VARIABLE CMAKE_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/make_man.sh.in
${CMAKE_CURRENT_BINARY_DIR}/make_man.sh @ONLY)
execute_process(
COMMAND ${BASH_EXECUTABLE} "-c" "${CMAKE_CURRENT_SOURCE_DIR}/make_man.sh > ${CMAKE_BINARY_DIR}/libiio.3.in"
COMMAND ${BASH_EXECUTABLE} "-c" "${CMAKE_CURRENT_BINARY_DIR}/make_man.sh > ${CMAKE_BINARY_DIR}/libiio.3.in"
)
configure_file(
${CMAKE_BINARY_DIR}/libiio.3.in
Expand Down
11 changes: 6 additions & 5 deletions man/make_man.sh → man/make_man.sh.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/bin/bash -e

if [ -z "$TRAVIS_BUILD_DIR" ] ; then
header="../iio.h"
else
header="$TRAVIS_BUILD_DIR/iio.h"
header="@CMAKE_SOURCE_DIR@/iio.h"

if [ ! -f "${header}" ] ; then
echo "Can not find iio.h at ${header}"
exit
fi

cat <<EOF
Expand Down Expand Up @@ -90,7 +91,7 @@ EOF
tmp=$(grep @struct "${header}" | sed 's:^[[:space:]]*\*[[:space:]]*@::g' | awk '{print length($0)}' | sort -n | tail -1)
echo .TP $((tmp - 5))

grep @struct ../iio.h -A 1 | \
grep @struct ${header} -A 1 | \
sed -e 's:^[[:space:]]*\*[[:space:]]*@::g' \
-e 's:struct[[:space:]]*:.TP\n.B :' \
-e 's:brief[[:space:]]*::' \
Expand Down