core_deps.mk 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. # Core: Packages and dependencies.
  2. CORE_DEPS_CASES = build-c-8cc build-c-imagejs build-erl pkg search
  3. CORE_DEPS_TARGETS = $(addprefix core-deps-,$(CORE_DEPS_CASES))
  4. CORE_DEPS_CLEAN_TARGETS = $(addprefix clean-,$(CORE_DEPS_TARGETS))
  5. .PHONY: core-deps $(CORE_DEPS_TARGETS) clean-core-deps $(CORE_DEPS_CLEAN_TARGETS)
  6. clean-core-deps: $(CORE_DEPS_CLEAN_TARGETS)
  7. $(CORE_DEPS_CLEAN_TARGETS):
  8. $t rm -rf $(APP_TO_CLEAN)/
  9. core-deps: $(CORE_DEPS_TARGETS)
  10. ifneq ($(PLATFORM),msys2)
  11. core-deps-build-c-8cc: build clean-core-deps-build-c-8cc
  12. $i "Bootstrap a new OTP library named $(APP)"
  13. $t mkdir $(APP)/
  14. $t cp ../erlang.mk $(APP)/
  15. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  16. $i "Add 8cc to the list of build dependencies"
  17. $t sed -i.bak '2i\
  18. BUILD_DEPS = 8cc\
  19. dep_8cc = git https://github.com/rui314/8cc master\
  20. ' $(APP)/Makefile
  21. $i "Build the application"
  22. $t $(MAKE) -C $(APP) $v
  23. $i "Check that all dependencies were fetched"
  24. $t test -d $(APP)/deps/8cc
  25. $i "Check that 8cc can be started"
  26. $t $(APP)/deps/8cc/8cc -h $v
  27. $i "Check that the application was compiled correctly"
  28. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  29. [ok = application:load(App) || App <- [$(APP)]], \
  30. {ok, Deps} = application:get_key($(APP), applications), \
  31. false = lists:member('8cc', Deps), \
  32. halt()"
  33. endif
  34. core-deps-build-c-imagejs: build clean-core-deps-build-c-imagejs
  35. $i "Bootstrap a new OTP library named $(APP)"
  36. $t mkdir $(APP)/
  37. $t cp ../erlang.mk $(APP)/
  38. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  39. $i "Add imagejs to the list of build dependencies"
  40. $t sed -i.bak '2i\
  41. BUILD_DEPS = imagejs\
  42. dep_imagejs = git https://github.com/jklmnn/imagejs master\
  43. ' $(APP)/Makefile
  44. $i "Build the application"
  45. $t $(MAKE) -C $(APP) $v
  46. $i "Check that all dependencies were fetched"
  47. $t test -d $(APP)/deps/imagejs
  48. $i "Check that imagejs works"
  49. $t $(APP)/deps/imagejs/imagejs bmp $(APP)/deps/imagejs/Makefile
  50. $t test -f $(APP)/deps/imagejs/Makefile.bmp
  51. $i "Check that the application was compiled correctly"
  52. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  53. [ok = application:load(App) || App <- [$(APP)]], \
  54. {ok, Deps} = application:get_key($(APP), applications), \
  55. false = lists:member(imagejs, Deps), \
  56. halt()"
  57. core-deps-build-erl: build clean-core-deps-build-erl
  58. $i "Bootstrap a new OTP library named $(APP)"
  59. $t mkdir $(APP)/
  60. $t cp ../erlang.mk $(APP)/
  61. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  62. $i "Add rebar to the list of build dependencies"
  63. $t sed -i.bak '2i\
  64. BUILD_DEPS = rebar\
  65. dep_rebar = git https://github.com/rebar/rebar master\
  66. ' $(APP)/Makefile
  67. $i "Build the application"
  68. $t $(MAKE) -C $(APP) $v
  69. $i "Check that all dependencies were fetched"
  70. $t test -d $(APP)/deps/rebar
  71. $i "Check that the application was compiled correctly"
  72. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  73. [ok = application:load(App) || App <- [$(APP), rebar]], \
  74. {ok, Deps} = application:get_key($(APP), applications), \
  75. false = lists:member(rebar, Deps), \
  76. halt()"
  77. core-deps-pkg: build clean-core-deps-pkg
  78. $i "Bootstrap a new OTP library named $(APP)"
  79. $t mkdir $(APP)/
  80. $t cp ../erlang.mk $(APP)/
  81. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  82. $i "Add Cowboy to the list of dependencies"
  83. $t sed -i.bak '2i\
  84. DEPS = cowboy\
  85. ' $(APP)/Makefile
  86. ifdef LEGACY
  87. $i "Add Cowboy to the applications key in the .app.src file"
  88. $t sed -i.bak '8i\
  89. cowboy,' $(APP)/src/$(APP).app.src
  90. endif
  91. $i "Build the application"
  92. $t $(MAKE) -C $(APP) $v
  93. $i "Check that all dependencies were fetched"
  94. $t test -d $(APP)/deps/cowboy
  95. $t test -d $(APP)/deps/cowlib
  96. $t test -d $(APP)/deps/ranch
  97. $i "Check that the application was compiled correctly"
  98. $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
  99. [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
  100. {ok, Deps} = application:get_key($(APP), applications), \
  101. true = lists:member(cowboy, Deps), \
  102. halt()"
  103. core-deps-search: build clean-core-deps-search
  104. $i "Bootstrap a new OTP library named $(APP)"
  105. $t mkdir $(APP)/
  106. $t cp ../erlang.mk $(APP)/
  107. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
  108. $i "Run 'make search' and check that it prints packages"
  109. $t test -n "`$(MAKE) -C $(APP) search`"
  110. $i "Run 'make search q=cowboy' and check that it prints packages"
  111. $t test -n "`$(MAKE) -C $(APP) search q=cowboy`"