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:
1598
1598
script : |
1599
1599
set -o xtrace
1600
1600
set -o errexit
1601
+ DESTDIR="$(pwd)/dest" sh ./.evergreen/install-uninstall-check.sh
1601
1602
BSON_ONLY=1 sh ./.evergreen/install-uninstall-check.sh
1602
1603
sh ./.evergreen/install-uninstall-check.sh
1603
1604
# }}}
Original file line number Diff line number Diff line change 19
19
20
20
if [ " $BSON_ONLY " ]; then
21
21
BUILD_DIR=$( pwd) /build-dir-bson
22
- INSTALL_DIR =$( pwd) /install-dir-bson
22
+ INSTALL_PREFIX =$( pwd) /install-dir-bson
23
23
else
24
24
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
26
32
fi
27
33
28
34
rm -rf $BUILD_DIR
41
47
fi
42
48
43
49
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 .
45
51
make
46
- make install
52
+ if [ " $DESTDIR " ]; then
53
+ make DESTDIR=$DESTDIR install
54
+ else
55
+ make install
56
+ fi
47
57
touch $INSTALL_DIR /lib/canary.txt
48
58
49
59
ls -l $INSTALL_DIR /share/mongo-c-driver
Original file line number Diff line number Diff line change @@ -341,14 +341,10 @@ if (WIN32)
341
341
else ()
342
342
set (UNINSTALL_PROG "uninstall.sh" )
343
343
endif ()
344
- set (UNINSTALL_PROG_DIR "${CMAKE_INSTALL_FULL_DATADIR } /mongo-c-driver" )
344
+ set (UNINSTALL_PROG_DIR "${CMAKE_INSTALL_DATADIR } /mongo-c-driver" )
345
345
346
346
# Create uninstall program and associated uninstall target
347
347
#
348
348
# This needs to be last (after all other add_subdirectory calls) to ensure that
349
349
# 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
51
51
prefix=" ${prefix} /"
52
52
fi
53
53
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
+
54
63
printf " #!/bin/sh\n"
55
64
printf " # Mongo C Driver uninstall program, generated with CMake"
56
65
printf " \n"
@@ -69,7 +78,7 @@ printf "# See the License for the specific language governing permissions and\n"
69
78
printf " # limitations under the License.\n"
70
79
printf " \n"
71
80
printf " save_pwd=\$ (pwd)\n"
72
- printf " cd %s\n" " ${prefix} "
81
+ printf " cd %s\n" " ${DESTDIR}${ prefix} "
73
82
printf " \n"
74
83
75
84
dirs=
@@ -96,8 +105,8 @@ echo "${dirs}" | sort -ru | while IFS= read -r dir; do
96
105
done
97
106
98
107
printf " 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} "
101
110
printf " \n"
102
111
printf " # Return to the directory from which the program was called\n"
103
112
printf " cd \$ {save_pwd}\n"
Original file line number Diff line number Diff line change 1
1
# Fabricate our own copy of the install manifest, since the installation has not
2
2
# 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)
4
5
5
6
if (WIN32 )
6
7
string (REPLACE "/" "\\\\ " CMAKE_INSTALL_PREFIX_WIN32
@@ -23,13 +24,8 @@ if (WIN32)
23
24
OUTPUT_FILE
24
25
\" ${CMAKE_CURRENT_BINARY_DIR} /${UNINSTALL_PROG} \"
25
26
)
26
- execute_process (
27
- COMMAND
28
- ${CMAKE_COMMAND} -E copy
29
- \" ${CMAKE_CURRENT_BINARY_DIR} /${UNINSTALL_PROG} \"
30
- \" ${UNINSTALL_PROG_DIR} /${UNINSTALL_PROG} \"
31
- )
32
27
" )
28
+ install (FILES "${CMAKE_CURRENT_BINARY_DIR} /${UNINSTALL_PROG} " DESTINATION "${UNINSTALL_PROG_DIR} " PERMISSIONS ${UNINSTALL_PERMISSIONS} )
33
29
else ()
34
30
install (CODE "
35
31
string(REPLACE \" ;\" \"\\ n\" MONGOC_INSTALL_MANIFEST_CONTENT
@@ -45,14 +41,10 @@ else ()
45
41
OUTPUT_FILE
46
42
\" ${CMAKE_CURRENT_BINARY_DIR} /${UNINSTALL_PROG} \"
47
43
)
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
- )
56
44
" )
45
+ install (FILES "${CMAKE_CURRENT_BINARY_DIR} /${UNINSTALL_PROG} " DESTINATION "${UNINSTALL_PROG_DIR} " PERMISSIONS ${UNINSTALL_PERMISSIONS} )
57
46
endif ()
58
47
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