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

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

Comments

Loading...