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.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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/$(OPENSSL_NAME).tar.gz: | build/
  33. wget https://www.openssl.org/source/$(OPENSSL_NAME).tar.gz -O $@
  34. $(OPENSSL_DIR)/: build/$(OPENSSL_NAME).tar.gz
  35. tar -C build -xf build/$(OPENSSL_NAME).tar.gz
  36. $(OPENSSL_DIR)/Makefile: | $(OPENSSL_DIR)/
  37. cd $(OPENSSL_DIR); ./Configure enable-ssl3 enable-ssl2 enable-shared linux-x86_64
  38. $(OPENSSL_DIR)/libssl.so \
  39. $(OPENSSL_DIR)/libcrypto.so: $(OPENSSL_DIR)/Makefile
  40. $(MAKE) -C $(OPENSSL_DIR) depend build_libs
  41. lib/%.so: $(OPENSSL_DIR)/%.so
  42. cp $< $@
  43. lib/%.so.1.0.0:
  44. ln -fs $(notdir $(subst .1.0.0,, $@)) $@
  45. libs: lib/libssl.so lib/libcrypto.so lib/libssl.so.1.0.0 lib/libcrypto.so.1.0.0
  46. build/$(RUBY_NAME).tar.gz: | build/
  47. wget http://cache.ruby-lang.org/pub/ruby/$(RUBY_MAJOR_VERSION)/$(RUBY_NAME).tar.gz -O $@
  48. $(RUBY_DIR)/: build/$(RUBY_NAME).tar.gz
  49. tar -C build -xf $<
  50. $(RUBY_OPENSSL_EXT_DIR)/Makefile: libs | $(RUBY_DIR)/
  51. patch -d $(RUBY_DIR)/ -p1 < patch
  52. cd $(RUBY_OPENSSL_EXT_DIR); ruby extconf.rb
  53. $(RUBY_OPENSSL_EXT_DIR)/openssl.so: libs $(RUBY_OPENSSL_EXT_DIR)/Makefile
  54. top_srcdir=../.. $(MAKE) -C $(RUBY_OPENSSL_EXT_DIR)
  55. lib/openssl.so: $(RUBY_OPENSSL_EXT_DIR)/openssl.so
  56. cp $< $@
  57. ext: lib/openssl.so