Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

build-macos-external-list.sh 3.6 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
  1. #!/usr/bin/env bash
  2. #
  3. # Note: Requires coreutils to be installed so grealpath is available
  4. #
  5. # Build include file for cpack to build a complete macOS Bundle.
  6. # List of executables whose shared libraries must also be included
  7. #
  8. # Exceptions:
  9. # For now (6.2.0), need to do a few things manually first, like
  10. # 1. Separate install command to avoid version number in GraphicsMagick directory name
  11. #
  12. # Notes:
  13. # 1. This is tested on macports where gs is a symbolic link to gsc.
  14. if [ $(which cmake) = "/opt/local/bin/cmake" ]; then
  15. distro=MacPorts
  16. top=/opt/local
  17. elif [ $(which cmake) = "/usr/local/bin/cmake" ]; then
  18. distro=HomeBrew
  19. top=/usr/local
  20. else # Requires either MacPorts of HomeBrew
  21. exit 1
  22. fi
  23. # Set temporary directory
  24. TMPDIR=${TMPDIR:-/tmp}
  25. # 1a. List of executables needed and whose shared libraries also are needed.
  26. # Use full path if you need something not in your path
  27. EXEPLUSLIBS="/opt/local/bin/gsc /opt/local/bin/gm /opt/local/bin/ffmpeg /opt/local/bin/ogr2ogr \
  28. /opt/local/bin/gdal_translate /opt/local/lib/libfftw3f_threads.dylib /opt/local/lib/libomp/libomp.dylib"
  29. # 1b. List of any symbolic links needed
  30. # Use full path if you need something not in your path
  31. EXELINKS=/opt/local/bin/gs
  32. # 1c. List of executables whose shared libraries have already been included via other shared libraries
  33. # Use full path if you need something not in your path
  34. EXEONLY=
  35. # 1d. Shared directories to be added
  36. # Use full path if you need something not in your path
  37. EXESHARED="gdal /opt/local/share/ghostscript /opt/local/lib/proj7/share/proj"
  38. #-----------------------------------------
  39. # 2a. Add the executables to the list given their paths
  40. rm -f ${TMPDIR}/raw.lis
  41. for P in ${EXEONLY} ${EXEPLUSLIBS}; do
  42. path=$(which $P)
  43. if [ -L $path ]; then # A symlink
  44. grealpath $path >> ${TMPDIR}/raw.lis
  45. else
  46. echo $path >> ${TMPDIR}/raw.lis
  47. fi
  48. done
  49. # 2b. Add the symbolic links to the list given their paths as is
  50. for P in $EXELINKS; do
  51. which $P >> ${TMPDIR}/raw.lis
  52. done
  53. # 2c. Call otool -L recursively to list shared libraries used but exclude system libraries
  54. cc admin/otoolr.c -o build/otoolr
  55. build/otoolr $(pwd) ${EXEPLUSLIBS} >> ${TMPDIR}/raw.lis
  56. # 4. sort into unique list then separate executables from libraries
  57. sort -u ${TMPDIR}/raw.lis > ${TMPDIR}/final.lis
  58. grep dylib ${TMPDIR}/final.lis > ${TMPDIR}/libraries.lis
  59. grep -v dylib ${TMPDIR}/final.lis > ${TMPDIR}/programs.lis
  60. # 5. Build the include file for cpack
  61. cat << EOF
  62. # List of extra executables and shared libraries to include in the macOS installer
  63. # This file was prepared under $distro and used the installation paths of ${USER}.
  64. install (PROGRAMS
  65. EOF
  66. awk '{printf "\t%s\n", $1}' ${TMPDIR}/programs.lis
  67. cat << EOF
  68. DESTINATION \${GMT_BINDIR}
  69. COMPONENT Runtime)
  70. install (PROGRAMS
  71. EOF
  72. awk '{printf "\t%s\n", $1}' ${TMPDIR}/libraries.lis
  73. cat << EOF
  74. DESTINATION \${GMT_LIBDIR}
  75. COMPONENT Runtime)
  76. EOF
  77. # Optionally add shared resources
  78. if [ ! "X$EXESHARED" = "X" ]; then
  79. echo ""
  80. echo "install (DIRECTORY"
  81. fi
  82. for P in $EXESHARED; do
  83. if [ $P = $(basename $P) ]; then
  84. echo " $top/share/$P"
  85. else
  86. echo " $P"
  87. fi
  88. done
  89. if [ ! "X$EXESHARED" = "X" ]; then
  90. echo " DESTINATION share"
  91. echo " COMPONENT Runtime)"
  92. fi
  93. cat << EOF
  94. # Place the licenses for runtime dependencies
  95. install (DIRECTORY
  96. ../../admin/Licenses
  97. DESTINATION share
  98. COMPONENT Runtime)
  99. # Place the GraphicsMagick config files
  100. install (DIRECTORY
  101. /opt/local/lib/GraphicsMagick-\${GMT_CONFIG_GM_VERSION}/config
  102. DESTINATION \${GMT_LIBDIR}/GraphicsMagick
  103. COMPONENT Runtime)
  104. install (FILES
  105. /opt/local/share/GraphicsMagick-\${GMT_CONFIG_GM_VERSION}/config/log.mgk
  106. DESTINATION \${GMT_LIBDIR}/GraphicsMagick/config
  107. COMPONENT Runtime)
  108. EOF
  109. exit 0
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...