Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

Makefile 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. PWD = $(shell pwd)
  2. OPENSSL_LIB_VERSION = 1.0.0
  3. OPENSSL_VERSION = 1.0.2g
  4. OPENSSL_NAME = openssl-$(OPENSSL_VERSION)
  5. OPENSSL_DIR = build/$(OPENSSL_NAME)
  6. RUBY_MAJOR_VERSION = 2.3
  7. RUBY_VERSION = $(RUBY_MAJOR_VERSION).3
  8. RUBY_NAME = ruby-$(RUBY_VERSION)
  9. RUBY_DIR = build/$(RUBY_NAME)
  10. RUBY_OPENSSL_EXT_DIR = $(RUBY_DIR)/ext/openssl
  11. RBENV_DIR = $(RBENV_ROOT)/versions/$(RUBY_VERSION)-cryptcheck
  12. RUBY_LIB_DIR = $(RBENV_DIR)/lib/ruby/$(RUBY_MAJOR_VERSION).0
  13. RBENV_ROOT ?= ~/.rbenv
  14. export LIBRARY_PATH = $(PWD)/lib
  15. export C_INCLUDE_PATH = $(PWD)/$(OPENSSL_DIR)/include
  16. export LD_LIBRARY_PATH = $(PWD)/lib
  17. .SECONDARY:
  18. all: libs ext
  19. clean: clean-libs clean-ext
  20. clean-libs:
  21. [ -d $(OPENSSL_DIR) ] \
  22. && find $(OPENSSL_DIR) \( -name "*.o" -o -name "*.so" \) -delete \
  23. || true
  24. rm -f lib/libcrypto.so* lib/libssl.so* $(OPENSSL_DIR)/Makefile
  25. clean-ext:
  26. [ -d $(RUBY_OPENSSL_EXT_DIR) ] \
  27. && find $(RUBY_OPENSSL_EXT_DIR) \( -name "*.o" -o -name "*.so" \) -delete \
  28. || true
  29. rm -f lib/openssl.so
  30. mr-proper:
  31. rm -rf lib/libcrypto.so* lib/libssl.so* lib/openssl.so build
  32. build/:
  33. mkdir $@
  34. build/chacha-poly.patch: | build/
  35. wget https://github.com/cloudflare/sslconfig/raw/master/patches/openssl__chacha20_poly1305_draft_and_rfc_ossl102g.patch -O $@
  36. build/$(OPENSSL_NAME).tar.gz: | build/
  37. wget https://www.openssl.org/source/$(OPENSSL_NAME).tar.gz -O $@
  38. $(OPENSSL_DIR)/: build/$(OPENSSL_NAME).tar.gz build/chacha-poly.patch
  39. tar -C build -xf build/$(OPENSSL_NAME).tar.gz
  40. patch -d $(OPENSSL_DIR) -p1 < build/chacha-poly.patch
  41. patch -d $(OPENSSL_DIR) -p1 < disable_digest_check.path
  42. $(OPENSSL_DIR)/Makefile: | $(OPENSSL_DIR)/
  43. #cd $(OPENSSL_DIR) && ./Configure enable-ssl2 enable-ssl3 enable-weak-ssl-ciphers enable-zlib enable-rc5 enable-rc2 enable-gost enable-md2 enable-mdc2 enable-shared linux-x86_64
  44. #cd $(OPENSSL_DIR) && ./config enable-ssl2 enable-ssl3 enable-md2 enable-rc5 enable-weak-ssl-ciphers shared
  45. cd $(OPENSSL_DIR) && ./config enable-ssl2 enable-ssl3 enable-ssl3-method enable-md2 enable-rc5 enable-weak-ssl-ciphers enable-shared
  46. $(OPENSSL_DIR)/libssl.so \
  47. $(OPENSSL_DIR)/libcrypto.so: $(OPENSSL_DIR)/Makefile
  48. $(MAKE) -C $(OPENSSL_DIR)
  49. LIBS = lib/libssl.so lib/libcrypto.so lib/libssl.so.$(OPENSSL_LIB_VERSION) lib/libcrypto.so.$(OPENSSL_LIB_VERSION)
  50. lib/%.so: $(OPENSSL_DIR)/%.so
  51. cp $< $@
  52. lib/%.so.$(OPENSSL_LIB_VERSION): lib/%.so
  53. ln -fs $(notdir $(subst .$(OPENSSL_LIB_VERSION),,$@)) $@
  54. libs: $(LIBS)
  55. build/$(RUBY_VERSION)-cryptcheck: $(RBENV_ROOT)/plugins/ruby-build/share/ruby-build/$(RUBY_VERSION)
  56. cp $< $@
  57. install-ruby: build/$(RUBY_VERSION)-cryptcheck $(LIBS) | $(OPENSSL_DIR)/
  58. cat tmp_key.patch set_ecdh_curves.patch fallback_scsv.patch multiple_certs.patch | \
  59. RUBY_BUILD_CACHE_PATH=$(PWD)/build \
  60. RUBY_BUILD_DEFINITIONS=$(PWD)/build \
  61. rbenv install -fp $(RUBY_VERSION)-cryptcheck
  62. rbenv sequester $(RUBY_VERSION)-cryptcheck
  63. rbenv local $(RUBY_VERSION)-cryptcheck
  64. gem install bundler
  65. bundle
  66. $(RUBY_LIB_DIR)/openssl/ssl.rb: $(RUBY_OPENSSL_EXT_DIR)/lib/openssl/ssl.rb
  67. cp $< $@
  68. $(RUBY_LIB_DIR)/x86_64-linux/openssl.so: $(RUBY_OPENSSL_EXT_DIR)/openssl.so
  69. cp $< $@
  70. sync-ruby: $(RUBY_LIB_DIR)/openssl/ssl.rb $(RUBY_LIB_DIR)/x86_64-linux/openssl.so
  71. build/$(RUBY_NAME).tar.xz: | build/
  72. wget http://cache.ruby-lang.org/pub/ruby/$(RUBY_MAJOR_VERSION)/$(RUBY_NAME).tar.xz -O $@
  73. $(RUBY_DIR)/: build/$(RUBY_NAME).tar.xz
  74. tar -C build -xf $<
  75. $(RUBY_OPENSSL_EXT_DIR)/Makefile: libs | $(RUBY_DIR)/
  76. patch -d $(RUBY_DIR)/ -p1 < tmp_key.patch
  77. patch -d $(RUBY_DIR)/ -p1 < set_ecdh_curves.patch
  78. patch -d $(RUBY_DIR)/ -p1 < fallback_scsv.patch
  79. patch -d $(RUBY_DIR)/ -p1 < multiple_certs.patch
  80. cd $(RUBY_OPENSSL_EXT_DIR) && ruby extconf.rb
  81. $(RUBY_OPENSSL_EXT_DIR)/openssl.so: $(LIBS) $(RUBY_OPENSSL_EXT_DIR)/Makefile
  82. top_srcdir=../.. $(MAKE) -C $(RUBY_OPENSSL_EXT_DIR)
  83. lib/openssl.so: $(RUBY_OPENSSL_EXT_DIR)/openssl.so
  84. cp $< $@
  85. ext: lib/openssl.so
  86. spec/faketime/libfaketime.so: spec/faketime/faketime.c spec/faketime/faketime.h
  87. $(CC) $^ -o $@ -shared -fPIC -ldl -std=c99 -Werror -Wall
  88. lib/libfaketime.so: spec/faketime/libfaketime.so
  89. ln -fs ../$< $@
  90. faketime: lib/libfaketime.so
  91. test-material:
  92. bin/generate-test-material.rb
  93. test: spec/faketime/libfaketime.so
  94. bin/rspec