| 4 | |
| 5 | |
| 6 | {{{ |
| 7 | |
| 8 | |
| 9 | sudo -H -i |
| 10 | |
| 11 | # cf. https://trac.macports.org/wiki/Scripts/testport_script |
| 12 | /usr/local/bin/testport -p -l /opt/macports-test-universal |
| 13 | export PATH="/opt/macports-test-universal/bin:/opt/macports-test-universal/sbin:/usr/bin:/bin:/usr/sbin:/sbin" |
| 14 | alias testport='/usr/local/bin/testport' |
| 15 | |
| 16 | export LC_ALL=C |
| 17 | |
| 18 | # clang-3.2 +universal |
| 19 | testport -l /opt/macports-test-universal clang-3.2 +universal configure.cc='/usr/bin/llvm-gcc-4.2' configure.cxx='/usr/bin/llvm-g++-4.2' |
| 20 | |
| 21 | |
| 22 | # MacPorts: tar: Write error: Broken pipe |
| 23 | # ---> Installing llvm-3.0 @3.0_4+universal |
| 24 | # Error: Target org.macports.install returned: shell command failed (see log for details) |
| 25 | # Error: Failed to install llvm-3.0 |
| 26 | # Log for llvm-3.0 is at: /opt/macports-test-universal/var/macports/logs/_opt_macports-test-universal_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_llvm-3.0/llvm-3.0/main.log |
| 27 | # |
| 28 | # port log llvm-3.0 |
| 29 | # ... |
| 30 | # :info:install bzip2/libbzip2: internal error number 1007. |
| 31 | # ... |
| 32 | # :info:install *** A special note about internal error number 1007 *** |
| 33 | # ... |
| 34 | # :info:install tar: Write error: Broken pipe |
| 35 | # :info:install shell command " cd "/opt/macports-test-universal/var/macports/build/_opt_macports-test-universal_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_llvm-3.0/llvm-3.0/work/destroot" && /usr/bin/tar -cvf - . | /usr/bin/bzip2 -c9 > /opt/macports-test-universal/var/macports/software/llvm-3.0/llvm-3.0-3.0_4+universal.darwin_10.i386-x86_64.tbz2 " returned error 3 |
| 36 | # :error:install Target org.macports.install returned: shell command failed (see log for details) |
| 37 | # ... |
| 38 | |
| 39 | cd "$(port dir llvm-3.0)"/work/destroot |
| 40 | /usr/bin/tar -cvf - . | /usr/bin/bzip2 -c9 > /opt/macports-test-universal/var/macports/software/llvm-3.0/llvm-3.0-3.0_4+universal.darwin_10.i386-x86_64.tbz2 |
| 41 | |
| 42 | # redo: clang-3.2 +universal |
| 43 | testport -l /opt/macports-test-universal clang-3.2 +universal configure.cc='/usr/bin/llvm-gcc-4.2' configure.cxx='/usr/bin/llvm-g++-4.2' |
| 44 | |
| 45 | |
| 46 | |
| 47 | # glib2 +universal |
| 48 | testport -l /opt/macports-test-universal glib2 +universal configure.cc='/usr/bin/llvm-gcc-4.2' configure.cxx='/usr/bin/llvm-g++-4.2' |
| 49 | |
| 50 | |
| 51 | # apple-gcc42 +universal |
| 52 | # gcc47 +universal |
| 53 | # gcc48 +universal |
| 54 | [[ -L '/usr/include/malloc.h' ]] && sudo mv -iv /usr/include/malloc.h /usr/include/malloc.h.moved |
| 55 | testport -l /opt/macports-test-universal apple-gcc42 +universal configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2' |
| 56 | testport -l /opt/macports-test-universal gcc47 +universal configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2' |
| 57 | testport -l /opt/macports-test-universal gcc48 +universal configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2' |
| 58 | |
| 59 | |
| 60 | |
| 61 | # cmake +universal |
| 62 | testport -l /opt/macports-test-universal cmake +universal configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2' |
| 63 | |
| 64 | # boost +universal |
| 65 | testport -l /opt/macports-test-universal boost +universal configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2' |
| 66 | |
| 67 | |
| 68 | # doxygen +universal |
| 69 | testport -l /opt/macports-test-universal doxygen +universal configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2' |
| 70 | |
| 71 | |
| 72 | # Error: You cannot install gd2 for the architecture(s) x86_64 i386 because |
| 73 | # Error: its dependency fontconfig only contains the architecture(s) x86_64. |
| 74 | # cf. "Error: Failed to install fontconfig", https://trac.macports.org/ticket/30329 |
| 75 | # Non-fat file: /opt/macports-test-universal/lib/libfontconfig.dylib is architecture: x86_64 |
| 76 | # Architectures in the fat file: /opt/macports-test-universal/lib/libfontconfig.dylib are: i386 x86_64 |
| 77 | # lipo -info /opt/macports-test-universal/lib/*.dylib | grep -i 'Non-fat file' |
| 78 | port -v installed pkgconfig libiconv expat freetype libiconv fontconfig |
| 79 | lipo -info /opt/macports-test-universal/lib/libfontconfig.dylib |
| 80 | port -n upgrade --force fontconfig +universal |
| 81 | |
| 82 | |
| 83 | # gd2 +universal |
| 84 | port clean --all gd2 |
| 85 | testport -l /opt/macports-test-universal gd2 +universal configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2' |
| 86 | |
| 87 | # netpbm +universal |
| 88 | testport -l /opt/macports-test-universal netpbm +universal configure.cc='/usr/bin/llvm-gcc-4.2' configure.cxx='/usr/bin/llvm-g++-4.2' |
| 89 | |
| 90 | # graphviz +universal |
| 91 | port clean --all graphviz |
| 92 | testport -l /opt/macports-test-universal graphviz +universal configure.cc='/usr/bin/gcc-4.2' configure.cxx='/usr/bin/g++-4.2' |
| 93 | |
| 94 | |
| 95 | # redo: doxygen +universal |
| 96 | #testport -c -l /opt/macports-test-universal doxygen +universal configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2' |
| 97 | testport -l /opt/macports-test-universal doxygen +universal configure.cc='/usr/bin/llvm-gcc-4.2' configure.cxx='/usr/bin/llvm-g++-4.2' |
| 98 | |
| 99 | |
| 100 | |
| 101 | # flann (not universal!) |
| 102 | testport -l /opt/macports-test-universal flann configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2' |
| 103 | |
| 104 | |
| 105 | # py27-sphinx +universal |
| 106 | testport -l /opt/macports-test-universal py27-sphinx +universal configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2' |
| 107 | |
| 108 | |
| 109 | # google-test +universal |
| 110 | # port info google-test |
| 111 | # google-test @1.5.0 (devel) (May 2012) |
| 112 | # googletest version >= 1.6.0 (http://code.google.com/p/googletest/) |
| 113 | # Google's framework for writing C++ tests on a variety of platforms. Used to build test units. |
| 114 | # testport -l /opt/macports-test-universal google-test +universal configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2' |
| 115 | |
| 116 | |
| 117 | # eigen3 +universal |
| 118 | # qhull +universal |
| 119 | # libusb-devel +universal |
| 120 | |
| 121 | export IFS=$' \t\n' |
| 122 | for portname in eigen3 qhull libusb-devel; do |
| 123 | printf '\n\n%s\n\n' "testport -l /opt/macports-test-universal ${portname} +universal configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2'" |
| 124 | testport -l /opt/macports-test-universal "${portname}" +universal configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2' |
| 125 | done |
| 126 | |
| 127 | |
| 128 | |
| 129 | # vtk5 +universal+x11 |
| 130 | port variants vtk5 |
| 131 | testport -l /opt/macports-test-universal vtk5 +universal+x11 configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2' |
| 132 | |
| 133 | # sudo port select --set python python27 |
| 134 | # sudo port load rsync |
| 135 | |
| 136 | |
| 137 | |
| 138 | # opencv +universal+python27 |
| 139 | testport -l /opt/macports-test-universal opencv +universal+python27 configure.cc='/opt/macports-test-universal/bin/clang-mp-3.2' configure.cxx='/opt/macports-test-universal/bin/clang++-mp-3.2' |
| 140 | |
| 141 | |
| 142 | |
| 143 | # OpenNI |
| 144 | # install OpenNI in /usr/local-pcl |
| 145 | # https://github.com/OpenNI/OpenNI/ |
| 146 | |
| 147 | export PATH="/opt/macports-test-universal/bin:/opt/macports-test-universal/sbin:/usr/bin:/bin:/usr/sbin:/sbin" |
| 148 | cd /Users/${SUDO_USER}/Downloads || exit |
| 149 | [[ ! -f OpenNI.zip ]] && { curl -L -o OpenNI.zip https://github.com/OpenNI/OpenNI/zipball/master || exit; } |
| 150 | rm -rf *OpenNI-* |
| 151 | unzip -qq OpenNI.zip |
| 152 | cd *OpenNI-*/Platform/Linux*/CreateRedist/ |
| 153 | chmod +x RedistMaker |
| 154 | export CC='/opt/macports-test-universal/bin/clang-mp-3.2' CXX='/opt/macports-test-universal/bin/clang++-mp-3.2' |
| 155 | export CFLAGS='-I/opt/macports-test-universal/include' LDFLAGS='-L/opt/macports-test-universal/lib' |
| 156 | ./RedistMaker |
| 157 | cd ../Redist/OpenNI* |
| 158 | export X86_CXX=/opt/macports-test-universal/bin/clang++-mp-3.2 |
| 159 | export X86_STAGING=/usr/local-pcl |
| 160 | chmod +x install.sh |
| 161 | |
| 162 | cat <<-'EOF' | ed -s install.sh |
| 163 | H |
| 164 | /printf "copying shared libraries..."/a |
| 165 | mkdir -p $INSTALL_LIB |
| 166 | . |
| 167 | /printf "copying executables..."/a |
| 168 | mkdir -p $INSTALL_BIN |
| 169 | . |
| 170 | wq |
| 171 | EOF |
| 172 | |
| 173 | ./install.sh -c "${X86_STAGING}" |
| 174 | |
| 175 | |
| 176 | # sanitize .dylib install names |
| 177 | otool -L /usr/local-pcl/usr/lib/* |
| 178 | find /usr/local-pcl -type f -name "*.dylib" -print0 | while IFS="" read -r -d "" dylibpath; do |
| 179 | echo install_name_tool -id "$dylibpath" "$dylibpath" |
| 180 | install_name_tool -id "$dylibpath" "$dylibpath" |
| 181 | done | nl |
| 182 | |
| 183 | |
| 184 | otool -L /usr/local-pcl/usr/bin/* /usr/local-pcl/usr/lib/* |
| 185 | find /usr/local-pcl/usr/bin /usr/local-pcl/usr/lib -type f -print0 | xargs -0 otool -L | grep '\.\./\.\./' | sort -u |
| 186 | |
| 187 | find /usr/local-pcl/usr/bin /usr/local-pcl/usr/lib -type f -print0 | while IFS="" read -r -d "" file; do |
| 188 | old='../../Bin/x64-Release/libOpenNI.dylib' |
| 189 | new='/usr/local-pcl/usr/lib/libOpenNI.dylib' |
| 190 | sudo install_name_tool -change "$old" "$new" "$file" |
| 191 | done |
| 192 | |
| 193 | |
| 194 | |
| 195 | dos2unixdir() { |
| 196 | |
| 197 | crchar="$(printf "\r")" |
| 198 | grep -Ilsr -m 1 -Z -e "${crchar}" . | |
| 199 | xargs -0 -n 1 /bin/sh -c ' |
| 200 | crchar="$(printf "\r")" |
| 201 | echo "crchar: ${1}" |
| 202 | printf "%s\n" H ",g/${crchar}*$/s///g" wq | /bin/ed -s "${1}" |
| 203 | ' argv0 |
| 204 | |
| 205 | return 0 |
| 206 | |
| 207 | } |
| 208 | |
| 209 | |
| 210 | # Sensor |
| 211 | # PrimeSensor Modules for OpenNI |
| 212 | # https://github.com/PrimeSense/Sensor |
| 213 | |
| 214 | export PATH='/opt/macports-test-universal/bin:/opt/macports-test-universal/sbin:/usr/local-pcl/bin:/usr/bin:/bin:/usr/sbin:/sbin' |
| 215 | |
| 216 | cd /Users/${SUDO_USER}/Downloads || exit |
| 217 | [[ ! -f Sensor.zip ]] && { curl -L -o Sensor.zip https://github.com/PrimeSense/Sensor/zipball/master || exit; } |
| 218 | rm -rf *Sensor-* |
| 219 | unzip -qq Sensor.zip |
| 220 | cd PrimeSense-Sensor-* |
| 221 | dos2unixdir |
| 222 | cd ../PrimeSense-Sensor-*/Platform/Linux/CreateRedist |
| 223 | export CC='/opt/macports-test-universal/bin/clang-mp-3.2' CXX='/opt/macports-test-universal/bin/clang++-mp-3.2' |
| 224 | export CFLAGS='-I/usr/include -I/opt/macports-test-universal/include -I/usr/local-pcl/usr/include -I/usr/local-pcl/usr/include/ni' LDFLAGS='-L/opt/macports-test-universal/lib -L/usr/local-pcl/usr/lib' |
| 225 | xattr -d com.apple.quarantine RedistMaker |
| 226 | |
| 227 | # remove -j option to make command in RedistMaker file |
| 228 | printf '%s\n' H '/-j$(calc_jobs_number)/s///' wq | ed -s RedistMaker |
| 229 | |
| 230 | ./RedistMaker |
| 231 | |
| 232 | cd ../Redist/Sensor-Bin-MacOSX-* |
| 233 | export X86_CXX=/opt/macports-test-universal/bin/clang++-mp-3.2 |
| 234 | export X86_STAGING=/usr/local-pcl |
| 235 | chmod +x install.sh |
| 236 | ./install.sh -c "${X86_STAGING}" |
| 237 | |
| 238 | |
| 239 | # sanitize .dylib install names |
| 240 | |
| 241 | otool -L /usr/local-pcl/usr/bin/* /usr/local-pcl/usr/lib/* |
| 242 | find /usr/local-pcl/usr/lib /usr/local-pcl/usr/bin -type f -print0 | xargs -0 otool -L | grep '\.\./\.\./' | sort -u |
| 243 | |
| 244 | find /usr/local-pcl/usr/lib /usr/local-pcl/usr/bin -type f -print0 | while IFS="" read -r -d "" file; do |
| 245 | |
| 246 | old1='../../Bin/x64-Release/libOpenNI.dylib' |
| 247 | new1='/usr/local-pcl/usr/lib/libOpenNI.dylib' |
| 248 | |
| 249 | old2='../../Bin/x64-Release/libXnCore.dylib' |
| 250 | new2='/usr/local-pcl/usr/lib/libXnCore.dylib' |
| 251 | |
| 252 | old3='../../Bin/x64-Release/libXnDDK.dylib' |
| 253 | new3='/usr/local-pcl/usr/lib/libXnDDK.dylib' |
| 254 | |
| 255 | old4='../../Bin/x64-Release/libXnDeviceFile.dylib' |
| 256 | new4='/usr/local-pcl/usr/lib/libXnDeviceFile.dylib' |
| 257 | |
| 258 | old5='../../Bin/x64-Release/libXnDeviceSensorV2.dylib' |
| 259 | new5='/usr/local-pcl/usr/lib/libXnDeviceSensorV2.dylib' |
| 260 | |
| 261 | old6='../../Bin/x64-Release/libXnFormats.dylib' |
| 262 | new6='/usr/local-pcl/usr/lib/libXnFormats.dylib' |
| 263 | |
| 264 | sudo install_name_tool -change "$old1" "$new1" -change "$old2" "$new2" -change "$old3" "$new3" -change "$old4" "$new4" -change "$old5" "$new5" -change "$old6" "$new6" "$file" |
| 265 | |
| 266 | done |
| 267 | |
| 268 | |
| 269 | # sanitize .dylib install names |
| 270 | find /usr/local-pcl -type f -name "*.dylib" -print0 | while IFS="" read -r -d "" dylibpath; do |
| 271 | echo install_name_tool -id "$dylibpath" "$dylibpath" |
| 272 | install_name_tool -id "$dylibpath" "$dylibpath" |
| 273 | done | nl |
| 274 | |
| 275 | |
| 276 | otool -L /usr/local-pcl/usr/bin/* /usr/local-pcl/usr/lib/* |
| 277 | |
| 278 | |
| 279 | # not needed anymore |
| 280 | # cminpack 1.2.2 (in /usr/local-pcl) |
| 281 | # http://devernay.free.fr/hacks/cminpack/index.html |
| 282 | curl -L -O http://devernay.free.fr/hacks/cminpack/cminpack-1.2.2.tar.gz |
| 283 | rm -rf cminpack-1.2.2 |
| 284 | tar -xf cminpack-1.2.2.tar.gz |
| 285 | cd cminpack-1.2.2 |
| 286 | mkdir build |
| 287 | cd build |
| 288 | cmake -DUSE_FPIC=ON -DSHARED_LIBS=ON -DBUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=/usr/local-pcl .. |
| 289 | make |
| 290 | sudo make install |
| 291 | otool -L /usr/local-pcl/lib/libcminpack.dylib |
| 292 | sudo install_name_tool -id /usr/local-pcl/lib/libcminpack.1.0.90.dylib /usr/local-pcl/lib/libcminpack.1.0.90.dylib |
| 293 | |
| 294 | |
| 295 | # PCL 1.5.1 (2012.02.22) |
| 296 | # http://www.pointclouds.org/downloads/ |
| 297 | cd /Users/${SUDO_USER}/Downloads |
| 298 | [[ ! -f 'PCL-1.5.1-Source.tar.bz2' ]] && curl -L -O http://www.pointclouds.org/assets/files/1.5.1/PCL-1.5.1-Source.tar.bz2 |
| 299 | rm -rf PCL-1.5.1-Source |
| 300 | tar -xf PCL-1.5.1-Source.tar.bz2 |
| 301 | cd PCL-1.5.1-Source |
| 302 | #dos2unixdir |
| 303 | export PATH='/opt/macports-test-universal/bin:/opt/macports-test-universal/sbin:/usr/local-pcl/bin:/usr/local-pcl/sbin:/usr/bin:/bin:/usr/sbin:/sbin' |
| 304 | mkdir build |
| 305 | cd build |
| 306 | |
| 307 | # all three variants below did cause build / compiler (gcc) errors in the make build phase on Mac OS X 10.6.8 |
| 308 | ###env CC=/opt/macports-test-universal/bin/clang-mp-3.2 CXX=/opt/macports-test-universal/bin/clang++-mp-3.2 \ |
| 309 | ###env CC=/opt/macports-test-universal/bin/gcc-mp-4.7 CXX=/opt/macports-test-universal/bin/g++-mp-4.7 \ |
| 310 | ###env CC=/opt/macports-test-universal/bin/gcc-mp-4.8 CXX=/opt/macports-test-universal/bin/g++-mp-4.8 \ |
| 311 | |
| 312 | #env CC=/usr/bin/gcc-4.2 CXX=/usr/bin/g++-4.2 \ |
| 313 | env CC=/opt/macports-test-universal/bin/gcc-apple-4.2 CXX=/opt/macports-test-universal/bin/g++-apple-4.2 \ |
| 314 | cmake -DCMAKE_PREFIX_PATH='/opt/macports-test-universal:/usr/local-pcl/usr' -DOPENNI_INCLUDE_DIR=/usr/local-pcl/usr/include/ni \ |
| 315 | -DOPENNI_LIBRARY=/usr/local-pcl/usr/lib/libOpenNI.dylib -DCMAKE_INSTALL_PREFIX=/usr/local-pcl .. |
| 316 | |
| 317 | |
| 318 | # edit cmake_install.cmake files: "lib..*\.dylib" --> "${CMAKE_INSTALL_PREFIX}/lib/lib..*\.dylib" |
| 319 | printf '\n\n%s\n\n' "${PWD}: install_name_tool search & replace: \"lib..*.dylib\" --> \"\${CMAKE_INSTALL_PREFIX}/lib/lib..*.dylib\"" |
| 320 | egrep -Ilsr -Z -e 'install_name_tool' . | xargs -0 egrep -Ils '"lib..*\.dylib"' | nl |
| 321 | |
| 322 | egrep -Ilsr -Z -e 'install_name_tool' . | |
| 323 | xargs -0 egrep -Ils -Z '"lib..*\.dylib"' | |
| 324 | xargs -0 -n 1 /bin/sh -c 'printf "%s\n" H "g/\"\(lib..*\.dylib\)\"/s||\"\${CMAKE_INSTALL_PREFIX}/lib/\1\"|g" wq | /bin/ed -s "${1}"' argv0 |
| 325 | |
| 326 | # for use with gcc-mp-4.7 / g++-mp-4.7 and gcc-mp-4.8 / g++-mp-4.8 only |
| 327 | ###egrep -Ilsr -Z -e ' \-Wl ' . | xargs -0 -n 1 /bin/sh -c 'printf "%s\n" H "g/ \-Wl /s|| |g" wq | /bin/ed -s "${1}"' argv0 |
| 328 | |
| 329 | make |
| 330 | make install |
| 331 | |
| 332 | |
| 333 | find -x /usr/local-pcl/usr/bin /usr/local-pcl/usr/lib /usr/local-pcl/bin /usr/local-pcl/lib -type f -print0 | xargs -0 otool -L 2>/dev/null | less |
| 334 | find /usr/local-pcl/usr/bin /usr/local-pcl/usr/lib /usr/local-pcl/bin /usr/local-pcl/lib -type f -print0 | xargs -0 otool -L | grep '\.\./\.\./' | sort -u |
| 335 | |
| 336 | |
| 337 | |
| 338 | }}} |