Просмотр исходного кода

Rename couch package into opencouch

Per request: https://github.com/ninenines/erlang.mk/issues/300

This commit also fixes issues with packages which have a different
name than the application name.
Loïc Hoguin 9 лет назад
Родитель
Сommit
bfa0b2edc1
4 измененных файлов с 27 добавлено и 25 удалено
  1. 19 17
      core/deps.mk
  2. 0 7
      index/couch.mk
  3. 7 0
      index/opencouch.mk
  4. 1 1
      test/Makefile

+ 19 - 17
core/deps.mk

@@ -21,8 +21,13 @@ export DEPS_DIR
 REBAR_DEPS_DIR = $(DEPS_DIR)
 REBAR_DEPS_DIR = $(DEPS_DIR)
 export REBAR_DEPS_DIR
 export REBAR_DEPS_DIR
 
 
+dep_name = $(if $(dep_$(1)),$(1),$(pkg_$(1)_name))
+dep_repo = $(patsubst git://github.com/%,https://github.com/%, \
+	$(if $(dep_$(1)),$(word 2,$(dep_$(1))),$(pkg_$(1)_repo)))
+dep_commit = $(if $(dep_$(1)_commit),$(dep_$(1)_commit),$(if $(dep_$(1)),$(word 3,$(dep_$(1))),$(pkg_$(1)_commit)))
+
 ALL_APPS_DIRS = $(if $(wildcard $(APPS_DIR)/),$(filter-out $(APPS_DIR),$(shell find $(APPS_DIR) -maxdepth 1 -type d)))
 ALL_APPS_DIRS = $(if $(wildcard $(APPS_DIR)/),$(filter-out $(APPS_DIR),$(shell find $(APPS_DIR) -maxdepth 1 -type d)))
-ALL_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(filter-out $(IGNORE_DEPS),$(BUILD_DEPS) $(DEPS)))
+ALL_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(foreach dep,$(filter-out $(IGNORE_DEPS),$(BUILD_DEPS) $(DEPS)),$(call dep_name,$(dep))))
 
 
 ifeq ($(filter $(APPS_DIR) $(DEPS_DIR),$(subst :, ,$(ERL_LIBS))),)
 ifeq ($(filter $(APPS_DIR) $(DEPS_DIR),$(subst :, ,$(ERL_LIBS))),)
 ifeq ($(ERL_LIBS),)
 ifeq ($(ERL_LIBS),)
@@ -546,26 +551,23 @@ define dep_fetch
 			fail))
 			fail))
 endef
 endef
 
 
-dep_name = $(if $(dep_$(1)),$(1),$(pkg_$(1)_name))
-dep_repo = $(patsubst git://github.com/%,https://github.com/%, \
-	$(if $(dep_$(1)),$(word 2,$(dep_$(1))),$(pkg_$(1)_repo)))
-dep_commit = $(if $(dep_$(1)_commit),$(dep_$(1)_commit),$(if $(dep_$(1)),$(word 3,$(dep_$(1))),$(pkg_$(1)_commit)))
-
 define dep_target
 define dep_target
-$(DEPS_DIR)/$(1):
+$(DEPS_DIR)/$(call dep_name,$1):
-	$(verbose) if test -d $(APPS_DIR)/$1; then \
+	$(eval DEP_NAME := $(call dep_name,$1))
-		echo "Error: Dependency $1 conflicts with application found in $(APPS_DIR)/$1."; \
+	$(eval DEP_STR := $(if $(filter-out $1,$(DEP_NAME)),$1,"$1 ($(DEP_NAME))"))
+	$(verbose) if test -d $(APPS_DIR)/$(DEP_NAME); then \
+		echo "Error: Dependency" $(DEP_STR) "conflicts with application found in $(APPS_DIR)/$(DEP_NAME)."; \
 		exit 17; \
 		exit 17; \
 	fi
 	fi
 	$(verbose) mkdir -p $(DEPS_DIR)
 	$(verbose) mkdir -p $(DEPS_DIR)
-	$(dep_verbose) $(call dep_fetch_$(strip $(call dep_fetch,$(1))),$(1))
+	$(dep_verbose) $(call dep_fetch_$(strip $(call dep_fetch,$1)),$1)
-	$(verbose) if [ -f $(DEPS_DIR)/$(1)/configure.ac -o -f $(DEPS_DIR)/$(1)/configure.in ]; then \
+	$(verbose) if [ -f $(DEPS_DIR)/$(DEP_NAME)/configure.ac -o -f $(DEPS_DIR)/$(DEP_NAME)/configure.in ]; then \
-		echo " AUTO  " $(1); \
+		echo " AUTO  " $(DEP_STR); \
-		cd $(DEPS_DIR)/$(1) && autoreconf -Wall -vif -I m4; \
+		cd $(DEPS_DIR)/$(DEP_NAME) && autoreconf -Wall -vif -I m4; \
 	fi
 	fi
-	- $(verbose) if [ -f $(DEPS_DIR)/$(1)/configure ]; then \
+	- $(verbose) if [ -f $(DEPS_DIR)/$(DEP_NAME)/configure ]; then \
-		echo " CONF  " $(1); \
+		echo " CONF  " $(DEP_STR); \
-		cd $(DEPS_DIR)/$(1) && ./configure; \
+		cd $(DEPS_DIR)/$(DEP_NAME) && ./configure; \
 	fi
 	fi
 ifeq ($(filter $(1),$(NO_AUTOPATCH)),)
 ifeq ($(filter $(1),$(NO_AUTOPATCH)),)
 	$(verbose) if [ "$(1)" = "amqp_client" -a "$(RABBITMQ_CLIENT_PATCH)" ]; then \
 	$(verbose) if [ "$(1)" = "amqp_client" -a "$(RABBITMQ_CLIENT_PATCH)" ]; then \
@@ -584,7 +586,7 @@ ifeq ($(filter $(1),$(NO_AUTOPATCH)),)
 			git clone https://github.com/rabbitmq/rabbitmq-codegen.git $(DEPS_DIR)/rabbitmq-codegen; \
 			git clone https://github.com/rabbitmq/rabbitmq-codegen.git $(DEPS_DIR)/rabbitmq-codegen; \
 		fi \
 		fi \
 	else \
 	else \
-		$(call dep_autopatch,$(1)) \
+		$(call dep_autopatch,$(DEP_NAME)) \
 	fi
 	fi
 endif
 endif
 endef
 endef

+ 0 - 7
index/couch.mk

@@ -1,7 +0,0 @@
-PACKAGES += couch
-pkg_couch_name = couch
-pkg_couch_description = A embeddable document oriented database compatible with Apache CouchDB
-pkg_couch_homepage = https://github.com/benoitc/opencouch
-pkg_couch_fetch = git
-pkg_couch_repo = https://github.com/benoitc/opencouch
-pkg_couch_commit = master

+ 7 - 0
index/opencouch.mk

@@ -0,0 +1,7 @@
+PACKAGES += opencouch
+pkg_opencouch_name = couch
+pkg_opencouch_description = A embeddable document oriented database compatible with Apache CouchDB
+pkg_opencouch_homepage = https://github.com/benoitc/opencouch
+pkg_opencouch_fetch = git
+pkg_opencouch_repo = https://github.com/benoitc/opencouch
+pkg_opencouch_commit = master

+ 1 - 1
test/Makefile

@@ -192,7 +192,7 @@ pkg-$1: clean build
 	$(eval @ = pkg-$1)
 	$(eval @ = pkg-$1)
 
 
 # Get the real application's name.
 # Get the real application's name.
-	$(eval APP_NAME = `sed '2!d;s/pkg_$1_name = //' ../index/$1.mk`)
+	$(eval APP_NAME := $(shell sed '2!d;s/pkg_$1_name = //' ../index/$1.mk))
 
 
 	$i "Bootstrap a new OTP library in packages/$1_pkg"
 	$i "Bootstrap a new OTP library in packages/$1_pkg"
 	$t mkdir -p packages/$1_pkg/
 	$t mkdir -p packages/$1_pkg/