File tree Expand file tree Collapse file tree 5 files changed +36
-28
lines changed Expand file tree Collapse file tree 5 files changed +36
-28
lines changed Original file line number Diff line number Diff line change @@ -1598,6 +1598,7 @@ tasks:
15981598 script : |
15991599 set -o xtrace
16001600 set -o errexit
1601+ DESTDIR="$(pwd)/dest" sh ./.evergreen/install-uninstall-check.sh
16011602 BSON_ONLY=1 sh ./.evergreen/install-uninstall-check.sh
16021603 sh ./.evergreen/install-uninstall-check.sh
16031604# }}}
Original file line number Diff line number Diff line change 1919
2020if [ " $BSON_ONLY " ]; then
2121 BUILD_DIR=$( pwd) /build-dir-bson
22- INSTALL_DIR =$( pwd) /install-dir-bson
22+ INSTALL_PREFIX =$( pwd) /install-dir-bson
2323else
2424 BUILD_DIR=$( pwd) /build-dir-mongoc
25- INSTALL_DIR=$( pwd) /install-dir-mongoc
25+ INSTALL_PREFIX=$( pwd) /install-dir-mongoc
26+ fi
27+
28+ if [ " $DESTDIR " ]; then
29+ INSTALL_DIR=" ${DESTDIR} /${INSTALL_PREFIX} "
30+ else
31+ INSTALL_DIR=$INSTALL_PREFIX
2632fi
2733
2834rm -rf $BUILD_DIR
4147fi
4248
4349
44- $CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DCMAKE_PREFIX_PATH=$INSTALL_DIR /lib/cmake $BSON_ONLY_OPTION .
50+ $CMAKE -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX -DCMAKE_PREFIX_PATH=$INSTALL_DIR /lib/cmake $BSON_ONLY_OPTION .
4551make
46- make install
52+ if [ " $DESTDIR " ]; then
53+ make DESTDIR=$DESTDIR install
54+ else
55+ make install
56+ fi
4757touch $INSTALL_DIR /lib/canary.txt
4858
4959ls -l $INSTALL_DIR /share/mongo-c-driver
Original file line number Diff line number Diff line change @@ -341,14 +341,10 @@ if (WIN32)
341341else ()
342342 set (UNINSTALL_PROG "uninstall.sh" )
343343endif ()
344- set (UNINSTALL_PROG_DIR "${CMAKE_INSTALL_FULL_DATADIR } /mongo-c-driver" )
344+ set (UNINSTALL_PROG_DIR "${CMAKE_INSTALL_DATADIR } /mongo-c-driver" )
345345
346346# Create uninstall program and associated uninstall target
347347#
348348# This needs to be last (after all other add_subdirectory calls) to ensure that
349349# the generated uninstall program is complete and correct
350- add_subdirectory (generate_uninstall)
351-
352- add_custom_target (uninstall
353- COMMAND "${UNINSTALL_PROG_DIR} /${UNINSTALL_PROG} "
354- )
350+ add_subdirectory (generate_uninstall)
Original file line number Diff line number Diff line change @@ -51,6 +51,15 @@ if [ "${prefix}" = "${prefix%/}" ]; then
5151 prefix=" ${prefix} /"
5252fi
5353
54+ # If a DESTDIR is specified, ensure it ends with a trailing slash.
55+ if [ " ${DESTDIR} " ]; then
56+ if [ " ${DESTDIR} " = " ${DESTDIR%/ } " ]; then
57+ # Trailing slash was omitted, so add it here
58+ DESTDIR=" ${DESTDIR} /"
59+ fi
60+ fi
61+
62+
5463printf " #!/bin/sh\n"
5564printf " # Mongo C Driver uninstall program, generated with CMake"
5665printf " \n"
@@ -69,7 +78,7 @@ printf "# See the License for the specific language governing permissions and\n"
6978printf " # limitations under the License.\n"
7079printf " \n"
7180printf " save_pwd=\$ (pwd)\n"
72- printf " cd %s\n" " ${prefix} "
81+ printf " cd %s\n" " ${DESTDIR}${ prefix} "
7382printf " \n"
7483
7584dirs=
@@ -96,8 +105,8 @@ echo "${dirs}" | sort -ru | while IFS= read -r dir; do
96105done
97106
98107printf " cd ..\n"
99- printf " printf \" Removing top-level installation directory: \\\" %s\\\"\" \n" " ${prefix} "
100- printf " (rmdir \" %s\" 2>/dev/null && printf \"\\ \n\" ) || printf \" ... not removed (probably not empty)\\ \n\" \n" " ${prefix} "
108+ printf " printf \" Removing top-level installation directory: \\\" %s\\\"\" \n" " ${DESTDIR}${ prefix} "
109+ printf " (rmdir \" %s\" 2>/dev/null && printf \"\\ \n\" ) || printf \" ... not removed (probably not empty)\\ \n\" \n" " ${DESTDIR}${ prefix} "
101110printf " \n"
102111printf " # Return to the directory from which the program was called\n"
103112printf " cd \$ {save_pwd}\n"
Original file line number Diff line number Diff line change 11# Fabricate our own copy of the install manifest, since the installation has not
22# generated the final version yet at this point
3- install (CODE "file (MAKE_DIRECTORY \" ${UNINSTALL_PROG_DIR} \" )" )
3+
4+ set (UNINSTALL_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
45
56if (WIN32 )
67 string (REPLACE "/" "\\\\ " CMAKE_INSTALL_PREFIX_WIN32
@@ -23,13 +24,8 @@ if (WIN32)
2324 OUTPUT_FILE
2425 \" ${CMAKE_CURRENT_BINARY_DIR} /${UNINSTALL_PROG} \"
2526 )
26- execute_process (
27- COMMAND
28- ${CMAKE_COMMAND} -E copy
29- \" ${CMAKE_CURRENT_BINARY_DIR} /${UNINSTALL_PROG} \"
30- \" ${UNINSTALL_PROG_DIR} /${UNINSTALL_PROG} \"
31- )
3227 " )
28+ install (FILES "${CMAKE_CURRENT_BINARY_DIR} /${UNINSTALL_PROG} " DESTINATION "${UNINSTALL_PROG_DIR} " PERMISSIONS ${UNINSTALL_PERMISSIONS} )
3329else ()
3430 install (CODE "
3531 string(REPLACE \" ;\" \"\\ n\" MONGOC_INSTALL_MANIFEST_CONTENT
@@ -45,14 +41,10 @@ else ()
4541 OUTPUT_FILE
4642 \" ${CMAKE_CURRENT_BINARY_DIR} /${UNINSTALL_PROG} \"
4743 )
48- execute_process (
49- COMMAND
50- chmod a+x \" ${CMAKE_CURRENT_BINARY_DIR} /${UNINSTALL_PROG} \"
51- COMMAND
52- cp
53- \" ${CMAKE_CURRENT_BINARY_DIR} /${UNINSTALL_PROG} \"
54- \" ${UNINSTALL_PROG_DIR} /${UNINSTALL_PROG} \"
55- )
5644 " )
45+ install (FILES "${CMAKE_CURRENT_BINARY_DIR} /${UNINSTALL_PROG} " DESTINATION "${UNINSTALL_PROG_DIR} " PERMISSIONS ${UNINSTALL_PERMISSIONS} )
5746endif ()
5847
48+ add_custom_target (uninstall
49+ COMMAND "${CMAKE_CURRENT_BINARY_DIR} /${UNINSTALL_PROG} "
50+ )
You can’t perform that action at this time.
0 commit comments