Makefile.vars 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. # Licensed to Cloudera, Inc. under one
  2. # or more contributor license agreements. See the NOTICE file
  3. # distributed with this work for additional information
  4. # regarding copyright ownership. Cloudera, Inc. licenses this file
  5. # to you under the Apache License, Version 2.0 (the
  6. # "License"); you may not use this file except in compliance
  7. # with the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. # Public (SDK) Makefile variables. It requires the following to be defined:
  18. # ROOT
  19. # Points to the root of the Hue installation.
  20. # From here, we can include $(ROOT)/Makefile.vars
  21. # to access various
  22. #
  23. SHELL := /bin/bash
  24. ##############################
  25. # 1. Check for python-dev
  26. # 2. Locate the system Python
  27. ##############################
  28. # If we're an installed Makefile, allow the build to override
  29. # some things. This allows the install to prepopulate
  30. # SYS_PYTHON, in particular.
  31. ifneq ($(wildcard $(ROOT)/Makefile.buildvars),)
  32. include $(ROOT)/Makefile.buildvars
  33. endif
  34. VER_ERR_MSG = "Variable PYTHON_VER is $(PYTHON_VER) but it only supports python2.7 or >= python3.8. If not set, defaults to python2.7."
  35. PYTHON_VER ?= python2.7
  36. PYTHON_EXE = $(shell echo $(PYTHON_VER) | sed "s/\.//")
  37. SYS_PIP = "pip2.7"
  38. $(info "PYTHON_VER is $(PYTHON_VER).")
  39. ifeq ($(PYTHON_VER),python2.7)
  40. $(info "Python 2 module install of desktop/ext-py")
  41. EXT_ENV_INSTALL = ext-env-install
  42. SYS_PIP := $(shell which pip2.7)
  43. else ifeq ($(shell echo $(PYTHON_VER) | head -c 8),python3.)
  44. PYTHON_VER := $(shell echo $(PYTHON_VER) | head -c 9)
  45. MINOR_VER = $(shell echo -n $(PYTHON_VER) | tail -c 1)
  46. ifeq ($(shell test $(MINOR_VER) -lt 8; echo $$?),0)
  47. $(error "$(VER_ERR_MSG)")
  48. endif
  49. EXT_ENV_INSTALL = ext-env-pip-install
  50. SYS_PIP := $(shell which pip$(shell echo $(PYTHON_VER) | sed "s/python//g"))
  51. else
  52. $(error "$(VER_ERR_MSG)")
  53. endif
  54. PYTHON_H ?= $(shell ls /usr/include/$(PYTHON_VER)/Python.h 2>/dev/null || ls /usr/local/include/$(PYTHON_VER)/Python.h 2>/dev/null || find /usr/local/$(PYTHON_EXE)/include/$(PYTHON_VER)* -name Python.h 2>/dev/null || find /opt/rh/rh-$(PYTHON_EXE)/root/usr/include/$(PYTHON_VER)* -name Python.h 2>/dev/null || find /Library/Frameworks/Python.framework/Versions/*/include/$(PYTHON_VER)* -name Python.h 2>/dev/null)
  55. ifndef SKIP_PYTHONDEV_CHECK
  56. ifeq ($(PYTHON_H),)
  57. $(error "Error: must have python development packages for $(PYTHON_VER). Could not find Python.h. Please install $(PYTHON_VER)-devel or $(PYTHON_VER)-dev")
  58. endif
  59. SYS_PYTHON ?= $(shell ls /usr/bin/$(PYTHON_VER) 2>/dev/null || ls /usr/local/bin/$(PYTHON_VER) 2>/dev/null || ls /usr/local/$(PYTHON_EXE)/bin/$(PYTHON_VER) 2>/dev/null || ls /opt/rh/$(PYTHON_EXE)/root/usr/bin/$(PYTHON_VER) 2>/dev/null || ls /opt/rh/rh-$(PYTHON_EXE)/root/usr/bin/$(PYTHON_VER) 2>/dev/null || ls /Library/Frameworks/Python.framework/Versions/*/bin/$(PYTHON_VER) 2>/dev/null)
  60. else
  61. SYS_PYTHON ?= $(shell which $(PYTHON_VER))
  62. endif
  63. ifeq ($(SYS_PYTHON),)
  64. $(error "Error: Need python version 2.7 or >= 3.5")
  65. else
  66. $(info "SYS_PYTHON is $(SYS_PYTHON).")
  67. endif
  68. HADOOP_HOME ?= /usr/lib/hadoop
  69. ##############################
  70. # Location of the virtual environment
  71. ##############################
  72. BLD_DIR := $(ROOT)/build
  73. BLD_DIR_ENV := $(BLD_DIR)/env
  74. BLD_DIR_BIN := $(BLD_DIR_ENV)/bin
  75. THIRDPARTY_DIR := $(ROOT)/ext/thirdparty
  76. THIRDPARTY_JS_DIR := $(THIRDPARTY_DIR)/js
  77. STATIC_DIR := $(BLD_DIR)/static
  78. ##############################
  79. # ENV_PYTHON is the Python installed in the virtual environment. App
  80. # installation should always use the ENV_PYTHON.
  81. ##############################
  82. ENV_PYTHON := $(BLD_DIR_ENV)/bin/$(notdir $(SYS_PYTHON))
  83. ENV_PYTHON_VERSION = $(shell $(ENV_PYTHON) -c 'import sys; print ("python%d.%d"% sys.version_info[:2])')
  84. $(info "ENV_PYTHON is $(ENV_PYTHON).")
  85. ##############################
  86. # ENV_EASY_INSTALL uses the easy_install script installed in the virtual
  87. # environment. It must be called as an argument to ENV_PYTHON so the
  88. # problem of the shebang being truncated at 80 characters in most kernels
  89. # doesn't arise.
  90. ##############################
  91. ENV_EASY_INSTALL := $(ENV_PYTHON) $(BLD_DIR_BIN)/easy_install
  92. ENV_PIP := $(ENV_PYTHON) $(BLD_DIR_BIN)/pip
  93. PIP_MODULES := \
  94. cryptography==3.3.2 \
  95. future==0.18.2 \
  96. lockfile==0.8 \
  97. python-daemon==1.5.1 \
  98. pytz==2021.1 \
  99. filelock==3.0.12 \
  100. djangorestframework==3.9.4
  101. ##############################
  102. # This version is substituted through to the tarballs and packages.
  103. ##############################
  104. DESKTOP_VERSION := $(shell $(SYS_PYTHON) <(cat $(ROOT)/VERSION; echo print '(VERSION)'))
  105. MAVEN_VERSION = $(DESKTOP_VERSION)-SNAPSHOT
  106. ##############################
  107. # Path to the desktop dbproxy jar
  108. ##############################
  109. DB_PROXY_JAR := $(ROOT)/desktop/libs/librdbms/java-lib/dbproxy-1.0.jar
  110. ################################################
  111. # Internationalization
  112. ################################################
  113. PYBABEL := $(ROOT)/build/env/bin/pybabel
  114. ##############################
  115. # Path to files for pip requirements
  116. ##############################
  117. REQUIREMENT_FILE := $(ROOT)/desktop/core/requirements.txt
  118. NAVOPTAPI_WHL := $(ROOT)/desktop/core/wheels/navoptapi-1.0.0-py3-none-any.whl
  119. BOTO_PKG := $(ROOT)/desktop/core/ext-py3/boto-2.49.0
  120. REQUEST_PKG := $(ROOT)/desktop/core/ext-py3/requests-2.27.1
  121. PYSAML2_PKG := $(ROOT)/desktop/core/ext-py3/pysaml2-5.0.0
  122. DJANGOSAML2_PKG := $(ROOT)/desktop/core/ext-py3/djangosaml2-0.18.0