Makefile 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #
  2. # This makefile downloads, configures and builds Slic3r PE dependencies for Unix.
  3. # (That is, all dependencies except perl + wxWidgets.)
  4. # The libraries are installed in DESTDIR, which you can customize like so:
  5. #
  6. # DESTDIR=foo/bar make
  7. #
  8. # The default DESTDIR is ~/slic3r-destdir
  9. # If the DESTDIR doesn't exits, the makefile tries to create it
  10. #
  11. # To pass the DESTDIR path along to cmake, set the use CMAKE_PREFIX_PATH variable
  12. # and set it to $DESTDIR/usr/local
  13. #
  14. # You can also customize the NPROC variable in the same way to configure the number
  15. # of cores the build process uses. By default this is set to what the `nproc` command says.
  16. #
  17. DESTDIR ?= $(HOME)/slic3r-destdir
  18. NPROC ?= $(shell nproc)
  19. BOOST = boost_1_66_0
  20. TBB_SHA = a0dc9bf76d0120f917b641ed095360448cabc85b
  21. TBB = tbb-$(TBB_SHA)
  22. OPENSSL = openssl-OpenSSL_1_1_0g
  23. CURL = curl-7.58.0
  24. .PHONY: all destdir boost libcurl libopenssl libtbb
  25. all: destdir boost libtbb libcurl
  26. @echo
  27. @echo "All done!"
  28. @echo
  29. destdir:
  30. mkdir -p $(DESTDIR)
  31. boost: $(BOOST).tar.gz
  32. tar -zxvf $(BOOST).tar.gz
  33. cd $(BOOST) && ./bootstrap.sh --with-libraries=system,filesystem,thread,log,locale,regex --prefix=$(DESTDIR)/usr/local
  34. cd $(BOOST) && ./b2 \
  35. -j $(NPROC) \
  36. link=static \
  37. variant=release \
  38. threading=multi \
  39. boost.locale.icu=off \
  40. cxxflags=-fPIC cflags=-fPIC \
  41. install
  42. $(BOOST).tar.gz:
  43. curl -L -o $@ https://dl.bintray.com/boostorg/release/1.66.0/source/$@
  44. libtbb: $(TBB).tar.gz
  45. tar -zxvf $(TBB).tar.gz
  46. mkdir -p $(TBB)/mybuild
  47. cd $(TBB)/mybuild && cmake .. -DTBB_BUILD_SHARED=OFF -DTBB_BUILD_TESTS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON
  48. $(MAKE) -C $(TBB)/mybuild -j$(NPROC)
  49. $(MAKE) -C $(TBB)/mybuild install DESTDIR=$(DESTDIR)
  50. $(TBB).tar.gz:
  51. curl -L -o $@ https://github.com/wjakob/tbb/archive/$(TBB_SHA).tar.gz
  52. # Note: libcurl build system seems to be a bit wonky about finding openssl (cf. #2378).
  53. # It seems that currently the only working option is to set a prefix in the openssl build
  54. # and use the `--with-ssl=...` option in libcurl.
  55. # Additionally, pkg-config needs to be installed and openssl libs need to NOT be installed on the build system.
  56. libopenssl: $(OPENSSL).tar.gz
  57. tar -zxvf $(OPENSSL).tar.gz
  58. cd $(OPENSSL) && ./config --prefix=$(DESTDIR)/usr/local no-shared no-ssl3-method no-dynamic-engine '-Wa,--noexecstack'
  59. $(MAKE) -C $(OPENSSL) depend
  60. $(MAKE) -C $(OPENSSL) -j$(NPROC)
  61. $(MAKE) -C $(OPENSSL) install_sw
  62. $(OPENSSL).tar.gz:
  63. curl -L -o $@ 'https://github.com/openssl/openssl/archive/OpenSSL_1_1_0g.tar.gz'
  64. libcurl: libopenssl $(CURL).tar.gz
  65. tar -zxvf $(CURL).tar.gz
  66. cd $(CURL) && ./configure \
  67. --enable-static \
  68. --disable-shared \
  69. --with-ssl=$(DESTDIR)/usr/local \
  70. --with-pic \
  71. --enable-ipv6 \
  72. --enable-versioned-symbols \
  73. --enable-threaded-resolver \
  74. --with-random=/dev/urandom \
  75. --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt \
  76. --disable-ldap \
  77. --disable-ldaps \
  78. --disable-manual \
  79. --disable-rtsp \
  80. --disable-dict \
  81. --disable-telnet \
  82. --disable-pop3 \
  83. --disable-imap \
  84. --disable-smb \
  85. --disable-smtp \
  86. --disable-gopher \
  87. --disable-crypto-auth \
  88. --without-gssapi \
  89. --without-libpsl \
  90. --without-libidn2 \
  91. --without-gnutls \
  92. --without-polarssl \
  93. --without-mbedtls \
  94. --without-cyassl \
  95. --without-nss \
  96. --without-axtls \
  97. --without-brotli \
  98. --without-libmetalink \
  99. --without-libssh \
  100. --without-libssh2 \
  101. --without-librtmp \
  102. --without-nghttp2 \
  103. --without-zsh-functions-dir
  104. $(MAKE) -C $(CURL) -j$(NPROC)
  105. $(MAKE) -C $(CURL) install DESTDIR=$(DESTDIR)
  106. $(CURL).tar.gz:
  107. curl -L -o $@ https://curl.haxx.se/download/$@
  108. clean:
  109. rm -rf $(BOOST) $(BOOST).tar.gz $(TBB) $(TBB).tar.gz $(OPENSSL) $(OPENSSL).tar.gz $(CURL) $(CURL).tar.gz