You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. PWD = $(shell pwd)
  2. export CPATH = $(PWD)/openssl/include
  3. export LIBRARY_PATH = $(PWD)/openssl
  4. OPENSSL_VERSION = 1.0.2g
  5. OPENSSL_NAME = openssl-$(OPENSSL_VERSION)
  6. OPENSSL_DIR = build/$(OPENSSL_NAME)
  7. #OPENSSL_DIR = openssl
  8. RUBY_MAJOR_VERSION = 2.3
  9. RUBY_VERSION = $(RUBY_MAJOR_VERSION).0
  10. RUBY_NAME = ruby-$(RUBY_VERSION)
  11. RUBY_DIR = build/$(RUBY_NAME)
  12. RUBY_OPENSSL_EXT_DIR = $(RUBY_DIR)/ext/openssl
  13. export LIBRARY_PATH = $(PWD)/lib
  14. export C_INCLUDE_PATH = $(PWD)/$(OPENSSL_DIR)/include
  15. .SECONDARY:
  16. all: libs ext
  17. clean: clean-libs clean-ext
  18. clean-libs:
  19. [ -d $(OPENSSL_DIR) ] \
  20. && find $(OPENSSL_DIR) \( -name "*.o" -o -name "*.so" \) -delete \
  21. || true
  22. rm -f lib/libcrypto.so* lib/libssl.so* $(OPENSSL_DIR)/Makefile
  23. clean-ext:
  24. [ -d $(RUBY_OPENSSL_EXT_DIR) ] \
  25. && find $(RUBY_OPENSSL_EXT_DIR) \( -name "*.o" -o -name "*.so" \) -delete \
  26. || true
  27. rm -f lib/openssl.so
  28. mr-proper:
  29. rm -rf lib/libcrypto.so* lib/libssl.so* lib/openssl.so build
  30. build/:
  31. mkdir $@
  32. build/chacha-poly.patch: | build/
  33. wget https://github.com/cloudflare/sslconfig/raw/master/patches/openssl__chacha20_poly1305_draft_and_rfc_ossl102g.patch -O $@
  34. build/$(OPENSSL_NAME).tar.gz: | build/
  35. wget https://www.openssl.org/source/$(OPENSSL_NAME).tar.gz -O $@
  36. $(OPENSSL_DIR)/: build/$(OPENSSL_NAME).tar.gz build/chacha-poly.patch
  37. tar -C build -xf build/$(OPENSSL_NAME).tar.gz
  38. patch -d $(OPENSSL_DIR) -p1 < build/chacha-poly.patch
  39. $(OPENSSL_DIR)/Makefile: | $(OPENSSL_DIR)/
  40. cd $(OPENSSL_DIR) && ./Configure enable-weak-ssl-ciphers enable-ssl3 enable-ssl2 enable-shared linux-x86_64
  41. $(OPENSSL_DIR)/libssl.so \
  42. $(OPENSSL_DIR)/libcrypto.so: $(OPENSSL_DIR)/Makefile
  43. $(MAKE) -C $(OPENSSL_DIR) depend build_libs
  44. lib/%.so: $(OPENSSL_DIR)/%.so
  45. cp $< $@
  46. lib/%.so.1.0.0:
  47. ln -fs $(notdir $(subst .1.0.0,, $@)) $@
  48. libs: lib/libssl.so lib/libcrypto.so lib/libssl.so.1.0.0 lib/libcrypto.so.1.0.0
  49. build/$(RUBY_NAME).tar.gz: | build/
  50. wget http://cache.ruby-lang.org/pub/ruby/$(RUBY_MAJOR_VERSION)/$(RUBY_NAME).tar.gz -O $@
  51. $(RUBY_DIR)/: build/$(RUBY_NAME).tar.gz
  52. tar -C build -xf $<
  53. $(RUBY_OPENSSL_EXT_DIR)/Makefile: libs | $(RUBY_DIR)/
  54. patch -d $(RUBY_DIR)/ -p1 < tmp_key.patch
  55. cd $(RUBY_OPENSSL_EXT_DIR) && ruby extconf.rb
  56. $(RUBY_OPENSSL_EXT_DIR)/openssl.so: libs $(RUBY_OPENSSL_EXT_DIR)/Makefile
  57. top_srcdir=../.. $(MAKE) -C $(RUBY_OPENSSL_EXT_DIR)
  58. lib/openssl.so: $(RUBY_OPENSSL_EXT_DIR)/openssl.so
  59. cp $< $@
  60. ext: lib/openssl.so