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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. PWD = $(shell pwd)
  2. OPENSSL_LIB_VERSION = 1.0.0
  3. OPENSSL_VERSION = 1.0.2j
  4. OPENSSL_NAME = openssl-$(OPENSSL_VERSION)
  5. OPENSSL_DIR = build/$(OPENSSL_NAME)
  6. RUBY_MAJOR_VERSION = 2.3
  7. RUBY_VERSION = $(RUBY_MAJOR_VERSION).8
  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)/build/openssl/include
  16. export LD_LIBRARY_PATH ?= $(PWD)/lib
  17. .SECONDARY:
  18. .SUFFIXES:
  19. all: libs ext
  20. clean: clean-libs clean-ext
  21. clean-libs:
  22. [ -d "build/openssl/" ] \
  23. && find "build/openssl/" \( -name "*.o" -o -name "*.so" \) -delete \
  24. || true
  25. rm -f lib/libcrypto.so* lib/libssl.so* "build/openssl//Makefile"
  26. clean-ext:
  27. [ -d "$(RUBY_OPENSSL_EXT_DIR)" ] \
  28. && find "$(RUBY_OPENSSL_EXT_DIR)" \( -name "*.o" -o -name "*.so" \) -delete \
  29. || true
  30. rm -f lib/openssl.so
  31. mr-proper:
  32. rm -rf lib/libcrypto.so* lib/libssl.so* lib/openssl.so build
  33. build/:
  34. mkdir "$@"
  35. build/chacha-poly.patch: | build/
  36. wget https://github.com/cloudflare/sslconfig/raw/master/patches/openssl__chacha20_poly1305_draft_and_rfc_ossl102j.patch -O "$@"
  37. build/$(OPENSSL_NAME).tar.gz: | build/
  38. wget "https://www.openssl.org/source/$(OPENSSL_NAME).tar.gz" -O "$@"
  39. build/openssl/: | $(OPENSSL_DIR)/
  40. ln -s "$(OPENSSL_NAME)" "build/openssl"
  41. $(OPENSSL_DIR)/: build/$(OPENSSL_NAME).tar.gz build/chacha-poly.patch
  42. tar -C build -xf "build/$(OPENSSL_NAME).tar.gz"
  43. patch -d "$(OPENSSL_DIR)" -p1 < build/chacha-poly.patch
  44. patch -d "$(OPENSSL_DIR)" -p1 < patches/openssl/00_disable_digest_check.patch
  45. build/openssl/Makefile: | build/openssl/
  46. #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
  47. #cd $(OPENSSL_DIR) && ./config enable-ssl2 enable-ssl3 enable-md2 enable-rc5 enable-weak-ssl-ciphers shared
  48. cd build/openssl/ && ./config enable-ssl2 enable-ssl3 enable-ssl3-method enable-md2 enable-rc5 enable-weak-ssl-ciphers enable-shared
  49. build/openssl/libssl.so \
  50. build/openssl/libcrypto.so: build/openssl/Makefile
  51. $(MAKE) -C build/openssl/
  52. install-openssl: build/openssl/Makefile
  53. $(MAKE) -C build/openssl/ install
  54. LIBS = lib/libssl.so lib/libcrypto.so lib/libssl.so.$(OPENSSL_LIB_VERSION) lib/libcrypto.so.$(OPENSSL_LIB_VERSION)
  55. lib/%.so: build/openssl/%.so
  56. cp "$<" "$@"
  57. lib/%.so.$(OPENSSL_LIB_VERSION): lib/%.so
  58. ln -fs "$(notdir $(subst .$(OPENSSL_LIB_VERSION),,$@))" "$@"
  59. libs: $(LIBS)
  60. $(RBENV_ROOT)/:
  61. git clone https://github.com/rbenv/rbenv/ $@ -b v1.1.1 --depth 1
  62. $(RBENV_ROOT)/plugins/ruby-build/: | $(RBENV_ROOT)/
  63. git clone https://github.com/rbenv/ruby-build/ $@ -b v20171215 --depth 1
  64. $(RBENV_ROOT)/plugins/ruby-build/share/ruby-build/$(RUBY_VERSION): | $(RBENV_ROOT)/plugins/ruby-build/
  65. build/$(RUBY_VERSION)-cryptcheck: $(RBENV_ROOT)/plugins/ruby-build/share/ruby-build/$(RUBY_VERSION)
  66. cp "$<" "$@"
  67. install-rbenv: build/$(RUBY_VERSION)-cryptcheck
  68. install-rbenv-cryptcheck: build/$(RUBY_VERSION)-cryptcheck $(LIBS) | build/openssl/
  69. cat patches/ruby/*.patch | \
  70. RUBY_BUILD_CACHE_PATH="$(PWD)/build" \
  71. RUBY_BUILD_DEFINITIONS="$(PWD)/build" \
  72. rbenv install -fp "$(RUBY_VERSION)-cryptcheck"
  73. rbenv local "$(RUBY_VERSION)-cryptcheck"
  74. gem update --system
  75. gem install bundler
  76. # bundle install --without test development
  77. $(RUBY_LIB_DIR)/openssl/ssl.rb: $(RUBY_OPENSSL_EXT_DIR)/lib/openssl/ssl.rb
  78. cp "$<" "$@"
  79. $(RUBY_LIB_DIR)/x86_64-linux/openssl.so: $(RUBY_OPENSSL_EXT_DIR)/openssl.so
  80. cp "$<" "$@"
  81. sync-ruby: $(RUBY_LIB_DIR)/openssl/ssl.rb $(RUBY_LIB_DIR)/x86_64-linux/openssl.so
  82. build/$(RUBY_NAME).tar.xz: | build/
  83. wget "http://cache.ruby-lang.org/pub/ruby/$(RUBY_MAJOR_VERSION)/$(RUBY_NAME).tar.xz" -O "$@"
  84. $(RUBY_DIR)/: build/$(RUBY_NAME).tar.xz
  85. tar -C build -xf "$<"
  86. for p in patches/ruby/*.patch; do patch -d "$@" -p1 < $i; done
  87. $(RUBY_OPENSSL_EXT_DIR)/Makefile: libs | $(RUBY_DIR)/
  88. cd "$(RUBY_OPENSSL_EXT_DIR)" && ruby extconf.rb
  89. $(RUBY_OPENSSL_EXT_DIR)/openssl.so: $(LIBS) $(RUBY_OPENSSL_EXT_DIR)/Makefile
  90. top_srcdir=../.. $(MAKE) -C "$(RUBY_OPENSSL_EXT_DIR)"
  91. lib/openssl.so: $(RUBY_OPENSSL_EXT_DIR)/openssl.so
  92. cp "$<" "$@"
  93. ext: lib/openssl.so
  94. install-ruby: $(RUBY_DIR)/
  95. cd "$(RUBY_DIR)/" && ./configure --enable-shared --disable-install-rdoc && make install
  96. spec/faketime/libfaketime.so: spec/faketime/faketime.c spec/faketime/faketime.h
  97. $(CC) "$^" -o "$@" -shared -fPIC -ldl -std=c99 -Werror -Wall
  98. lib/libfaketime.so: spec/faketime/libfaketime.so
  99. ln -fs "../$<" "$@"
  100. faketime: lib/libfaketime.so
  101. test-material:
  102. bin/generate-test-material.rb
  103. test: spec/faketime/libfaketime.so
  104. bin/rspec