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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. RBENV_DIR = $(RBENV_ROOT)/versions/$(RUBY_VERSION)-cryptcheck
  9. RBENV_ROOT ?= ~/.rbenv
  10. export LIBRARY_PATH ?= $(PWD)/lib
  11. export C_INCLUDE_PATH ?= $(PWD)/build/openssl/include
  12. export LD_LIBRARY_PATH ?= $(PWD)/lib
  13. .SECONDARY:
  14. .SUFFIXES:
  15. all: libs rbenv
  16. clean: clean-libs
  17. clean-libs:
  18. [ -d "build/openssl/" ] \
  19. && find "build/openssl/" \( -name "*.o" -o -name "*.so" \) -delete \
  20. || true
  21. rm -f lib/libcrypto.so* lib/libssl.so* "build/openssl//Makefile"
  22. mr-proper:
  23. rm -rf lib/libcrypto.so* lib/libssl.so* lib/openssl.so build
  24. build/:
  25. mkdir "$@"
  26. build/chacha-poly.patch: | build/
  27. wget -q https://github.com/cloudflare/sslconfig/raw/master/patches/openssl__chacha20_poly1305_draft_and_rfc_ossl102j.patch -O "$@"
  28. build/$(OPENSSL_NAME).tar.gz: | build/
  29. wget -q "https://www.openssl.org/source/$(OPENSSL_NAME).tar.gz" -O "$@"
  30. build/openssl/: | $(OPENSSL_DIR)/
  31. ln -s "$(OPENSSL_NAME)" "build/openssl"
  32. $(OPENSSL_DIR)/: build/$(OPENSSL_NAME).tar.gz build/chacha-poly.patch
  33. tar -C build -xf "build/$(OPENSSL_NAME).tar.gz"
  34. patch -d "$(OPENSSL_DIR)" -p1 < build/chacha-poly.patch
  35. for p in patches/openssl/*.patch; do patch -d "$@" -p1 < "$$p"; done
  36. build/openssl/Makefile: | build/openssl/
  37. cd build/openssl/ && ./config enable-ssl2 enable-ssl3 enable-ssl3-method enable-md2 enable-rc5 enable-weak-ssl-ciphers enable-shared
  38. build/openssl/libssl.so \
  39. build/openssl/libcrypto.so: build/openssl/Makefile
  40. $(MAKE) -C build/openssl/
  41. LIBS = lib/libssl.so lib/libcrypto.so lib/libssl.so.$(OPENSSL_LIB_VERSION) lib/libcrypto.so.$(OPENSSL_LIB_VERSION)
  42. lib/%.so: build/openssl/%.so
  43. cp "$<" "$@"
  44. lib/%.so.$(OPENSSL_LIB_VERSION): lib/%.so
  45. ln -fs "$(notdir $(subst .$(OPENSSL_LIB_VERSION),,$@))" "$@"
  46. libs: $(LIBS)
  47. $(RBENV_ROOT)/:
  48. git clone https://github.com/rbenv/rbenv/ $@ -b v1.1.1 --depth 1
  49. $(RBENV_ROOT)/plugins/ruby-build/: | $(RBENV_ROOT)/
  50. git clone https://github.com/rbenv/ruby-build/ $@ -b v20171215 --depth 1
  51. $(RBENV_ROOT)/plugins/ruby-build/share/ruby-build/$(RUBY_VERSION): | $(RBENV_ROOT)/plugins/ruby-build/
  52. build/$(RUBY_VERSION)-cryptcheck: $(RBENV_ROOT)/plugins/ruby-build/share/ruby-build/$(RUBY_VERSION)
  53. cp $< $@
  54. rbenv: build/$(RUBY_VERSION)-cryptcheck $(LIBS) | $(OPENSSL_DIR)/
  55. cat patches/ruby/*.patch | \
  56. RUBY_BUILD_CACHE_PATH=$(PWD)/build \
  57. RUBY_BUILD_DEFINITIONS=$(PWD)/build \
  58. MAKE_OPTS="-j $(shell nproc)" rbenv install -fp $(RUBY_VERSION)-cryptcheck
  59. # rbenv sequester $(RUBY_VERSION)-cryptcheck
  60. rbenv local $(RUBY_VERSION)-cryptcheck
  61. gem install bundler
  62. bundle install
  63. spec/faketime/libfaketime.so: spec/faketime/faketime.c spec/faketime/faketime.h
  64. $(CC) $^ -o $@ -shared -fPIC -ldl -std=c99 -Werror -Wall
  65. lib/libfaketime.so: spec/faketime/libfaketime.so
  66. ln -fs ../$< $@
  67. faketime: lib/libfaketime.so
  68. test-material:
  69. bin/generate-test-material.rb
  70. test: spec/faketime/libfaketime.so
  71. bin/rspec
  72. docker:
  73. docker build . -t aeris22/cryptcheck:v2 -t aeris22/cryptcheck:v2.1 -t aeris22/cryptcheck:latest