Skip to content

Commit

Permalink
Merge pull request #5524 from rouault/cmake_manpages_adjust_mkgdaldist
Browse files Browse the repository at this point in the history
CMake / mkgdaldist.sh: adjustments related to man pages and extraneous directories
  • Loading branch information
rouault committed Mar 28, 2022
2 parents c9b1b85 + 2e75326 commit 6321ff8
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 20 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/cmake_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ jobs:
find $GITHUB_WORKSPACE/install-gdal || /bin/true
- name: install
run: |
touch $GITHUB_WORKSPACE/man/man1/gdalinfo.1
touch $GITHUB_WORKSPACE/man/man1/gdaladdo.1
(cd $GITHUB_WORKSPACE/superbuild/build; cmake ..)
cmake --build $GITHUB_WORKSPACE/superbuild/build --target install -- -j$(nproc)
test -f $GITHUB_WORKSPACE/install-gdal/share/man/man1/gdalinfo.1
test -f $GITHUB_WORKSPACE/install-gdal/share/man/man1/gdaladdo.1
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/install-gdal/lib
$GITHUB_WORKSPACE/install-gdal/bin/gdalinfo --version
PYTHONPATH=$GITHUB_WORKSPACE/install-gdal/lib/python3/dist-packages python3 -c "from osgeo import gdal;print(gdal.VersionInfo(None))"
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ fuzzers/tests/test_ogr_fuzzer
fuzzers/tests/test_osr_set_from_user_input_fuzzer
fuzzers/tests/test_wkb_import_fuzzer
fuzzers/tests/test_wkt_import_fuzzer
man/
html/
nmake.local*
*~
Expand Down
5 changes: 3 additions & 2 deletions gdal.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
option(ENABLE_GNM "Build GNM (Geography Network Model) component" ON)
option(ENABLE_PAM "Set ON to enable Persistent Auxiliary Metadata (.aux.xml)" ON)
option(BUILD_APPS "Build command line utilities" ON)
if (NOT "${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doc" AND NOT "${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
# In-tree builds do not support Doc building because Sphinx requires (at least
# at first sight) a Makefile file which conflicts with the CMake generated one
option(BUILD_DOCS "Build documentation" ON)
Expand Down Expand Up @@ -474,9 +474,10 @@ get_property(GDAL_PRIVATE_LINK_LIBRARIES GLOBAL PROPERTY gdal_private_link_libra
target_link_libraries(${GDAL_LIB_TARGET_NAME} PRIVATE ${GDAL_PRIVATE_LINK_LIBRARIES})

# Document/Manuals
if (BUILD_DOCS)
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doc" AND BUILD_DOCS)
add_subdirectory(doc)
endif ()
add_subdirectory(man)

# GDAL 4.0 ? Install headers in ${CMAKE_INSTALL_INCLUDEDIR}/gdal ?
set(GDAL_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR})
Expand Down
8 changes: 8 additions & 0 deletions man/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Man pages are not not present in the git repository. They are generated
# at release preparation time by the mkgdaldist.sh script

if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/man1/gdalinfo.1)
install(DIRECTORY man1/ DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
FILES_MATCHING PATTERN "*.1")
endif()

2 changes: 2 additions & 0 deletions man/man1/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Man pages are not not present in the git repository. They are generated
at release preparation time by the mkgdaldist.sh script
26 changes: 9 additions & 17 deletions mkgdaldist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

set -eu

if [ "$MAKE" = "" ]; then
if [ -z ${MAKE+x} ]; then
MAKE="make"
fi

if [ "$PYTHON" = "" ]; then
if [ -z ${PYTHON+x} ]; then
PYTHON="python3"
fi

Expand Down Expand Up @@ -128,20 +128,11 @@ if test "$forcedate" != "no" ; then
mv gcore/gdal_new.h gcore/gdal.h
fi

echo "* Cleaning .git and .gitignore under $PWD..."
echo "* Cleaning .git, .github .gitignore, ci under $PWD..."
rm -rf .git
rm -f .gitignore

echo "* Substituting \$Id\$..."
find . -name "*.h" -o -name "*.c" -o -name "*.cpp" -o -name "*.dox" \
-o -name "*.py" -o -name "*.i" -o -name "*.sh" -o -name "*.cs" \
-o -name "*.java" -o -name "*.m4" -o -name "*.xml" \
-o -name "*.xsd" | while read -r i ; do
ID=$(basename "$i")
ID="$ID $(git log -1 --format='%H %ai %aN' "$i" | sed 's/ +0000/Z/')"
sed -i "s/\\\$Id\\\$/\\\$Id: ${ID} \\\$/" "$i"
done

rm -rf .github
rm -rf ci

CWD=${PWD}

Expand All @@ -156,9 +147,6 @@ rm -rf autom4te.cache
# Generate man pages
#
echo "* Generating man pages..."
if test -d "man"; then
rm -rf man
fi

if test -f "doc/Makefile"; then
(cd doc; make man)
Expand All @@ -178,6 +166,10 @@ fi

cd "$CWD"

echo "* Cleaning doc/ and perftests/ under $CWD..."
rm -rf doc
rm -rf perftests

# They currently require SWIG 1.3.X, which is not convenient as we need
# newer SWIG for newer Python versions
echo "SWIG C# interfaces *NOT* generated !"
Expand Down

0 comments on commit 6321ff8

Please sign in to comment.