bird1-openwrt: use a single Makefile for IPv4 and IPv6 packages
authorRoger Pueyo Centelles <roger.pueyo@guifi.net>
Tue, 13 Dec 2022 15:53:04 +0000 (16:53 +0100)
committerMoritz Warning <moritzwarning@web.de>
Sat, 25 Feb 2023 22:48:33 +0000 (23:48 +0100)
Having two Makefile files, respectively in the bird1-openwrt-ipv4 and
bird1-ipv6-openwrt folders, made the CI tests fail at the time of
building the packages, due to a compilation error. This patch merges
both Makefile files into a single one. As a result, package compilation
succeeds during the CI tests.

Signed-off-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
bird1-openwrt/Makefile [new file with mode: 0644]
bird1-openwrt/bird1-ipv4-openwrt/Makefile [deleted file]
bird1-openwrt/bird1-ipv6-openwrt/Makefile [deleted file]

diff --git a/bird1-openwrt/Makefile b/bird1-openwrt/Makefile
new file mode 100644 (file)
index 0000000..ddb2084
--- /dev/null
@@ -0,0 +1,177 @@
+# Copyright (C) 2014-2017  Eloi Carbo <eloicaso@openmailbox.org>
+# Copyright (C) 2022       Roger Pueyo Centelles <roger.pueyo@guifi.net>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+include $(TOPDIR)/rules.mk
+
+BIRD1_PKG := bird1
+BIRD1_IPV4_PKG := $(BIRD1_PKG)-ipv4
+BIRD1_IPV6_PKG := $(BIRD1_PKG)-ipv6
+BIRD4 := bird4
+BIRD6 := bird6
+
+PKG_NAME := $(BIRD1_PKG)-openwrt
+PKG_IPV4_NAME := $(BIRD1_IPV4_PKG)-openwrt
+PKG_IPV6_NAME := $(BIRD1_IPV6_PKG)-openwrt
+PKG_VERSION := 0.3
+PKG_RELEASE := 2
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
+PKG_LICENSE := GPL-3.0+
+
+PKG_UCI_NAME := $(BIRD1_PKG)-uci
+PKG_LUCI_NAME := $(BIRD1_PKG)-luci
+PKG_IPV4_UCI_NAME := $(BIRD1_IPV4_PKG)-uci
+PKG_IPV6_UCI_NAME := $(BIRD1_IPV6_PKG)-uci
+PKG_IPV4_LUCI_NAME := luci-app-$(BIRD1_IPV4_PKG)
+PKG_IPV6_LUCI_NAME := luci-app-$(BIRD1_IPV6_PKG)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Build/Prepare
+endef
+
+define Build/Compile
+endef
+
+define Package/$(PKG_UCI_NAME)/Default
+  TITLE:=The BIRD UCI module (v1.6)
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Routing and Redirection
+  MAINTAINER:=Roger Pueyo Centelles <roger.pueyo@guifi.net>
+  URL:=https://github.com/openwrt/bird1-openwrt/
+  DEPENDS:=+libuci +uci
+endef
+
+define Package/$(PKG_LUCI_NAME)/Default
+  TITLE:=LuCI support for BIRD (v1.6)
+  SECTION:=luci
+  CATEGORY:=LuCI
+  SUBMENU:=3. Applications
+  MAINTAINER:=Roger Pueyo Centelles <roger.pueyo@guifi.net>
+  URL:=https://github.com/openwrt/bird1-openwrt/
+  DEPENDS:=+luci-base +luci-compat
+endef
+
+define Package/$(PKG_UCI_NAME)/description
+$(BIRD1_PKG) UCI integration module
+endef
+
+define Package/$(PKG_LUCI_NAME)/description
+$(BIRD1_PKG) application for LuCI
+endef
+
+define Package/$(PKG_IPV4_UCI_NAME)
+$(call Package/$(PKG_UCI_NAME)/Default)
+  TITLE+= (IPv4)
+  DEPENDS+= +$(BIRD1_IPV4_PKG)
+endef
+
+define Package/$(PKG_IPV6_UCI_NAME)
+$(call Package/$(PKG_UCI_NAME)/Default)
+  TITLE+= (IPv6)
+  DEPENDS+= +$(BIRD1_IPV6_PKG)
+endef
+
+define Package/$(PKG_IPV4_LUCI_NAME)
+$(call Package/$(PKG_LUCI_NAME)/Default)
+  TITLE+= (IPv4)
+  DEPENDS+= +$(PKG_IPV4_UCI_NAME)
+endef
+
+define Package/$(PKG_IPV6_LUCI_NAME)
+$(call Package/$(PKG_LUCI_NAME)/Default)
+  TITLE+= (IPv6)
+  DEPENDS+= +$(PKG_IPV6_UCI_NAME)
+endef
+
+define Package/$(PKG_IPV4_UCI_NAME)/conffiles
+       /etc/config/$(BIRD4)
+endef
+
+define Package/$(PKG_IPV6_UCI_NAME)/conffiles
+       /etc/config/$(BIRD6)
+endef
+
+define Package/$(PKG_IPV4_UCI_NAME)/install
+       $(INSTALL_DIR) $(1)/etc/$(BIRD4)/init.d
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DIR) $(1)/etc/$(BIRD4)/filters
+       $(INSTALL_DIR) $(1)/etc/$(BIRD4)/functions
+       $(INSTALL_BIN) ./$(PKG_IPV4_NAME)/src/init.d/$(BIRD4)* $(1)/etc/$(BIRD4)/init.d/
+       $(CP) ./$(PKG_IPV4_NAME)/src/uci-defaults/* $(1)/etc/$(BIRD4)/init.d/
+       $(INSTALL_CONF) ./$(PKG_IPV4_NAME)/src/config/$(BIRD4) $(1)/etc/config/
+endef
+
+define Package/$(PKG_IPV6_UCI_NAME)/install
+       $(INSTALL_DIR) $(1)/etc/$(BIRD6)/init.d
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DIR) $(1)/etc/$(BIRD6)/filters
+       $(INSTALL_DIR) $(1)/etc/$(BIRD6)/functions
+       $(INSTALL_BIN) ./$(PKG_IPV6_NAME)/src/init.d/$(BIRD6)* $(1)/etc/$(BIRD6)/init.d/
+       $(CP) ./$(PKG_IPV6_NAME)/src/uci-defaults/* $(1)/etc/$(BIRD6)/init.d/
+       $(INSTALL_CONF) ./$(PKG_IPV6_NAME)/src/config/$(BIRD6) $(1)/etc/config/
+endef
+
+define Package/$(PKG_IPV4_UCI_NAME)/postinst
+#!/bin/sh
+    if [ -z "$${IPKG_INSTROOT}" ]; then
+        ( . /etc/$(BIRD4)/init.d/bird-uci-install-init.d $(BIRD4) ) && rm -f /etc/$(BIRD4)/init.d/bird-uci-install-init.d
+        ( . /etc/$(BIRD4)/init.d/99-relocate-filters $(BIRD4) ) && rm -f /etc/$(BIRD4)/init.d/99-relocate-filters
+        if [ -f /etc/sysupgrade.conf ] && ! grep $(BIRD4) /etc/sysupgrade.conf; then
+            echo /etc/config/$(BIRD4) >> /etc/sysupgrade.conf
+            echo /etc/$(BIRD4)/filters/ >> /etc/sysupgrade.conf
+            echo /etc/$(BIRD4)/functions/ >> /etc/sysupgrade.conf
+        fi
+    fi
+endef
+
+define Package/$(PKG_IPV6_UCI_NAME)/postinst
+#!/bin/sh
+    if [ -z "$${IPKG_INSTROOT}" ]; then
+        ( . /etc/$(BIRD6)/init.d/bird-uci-install-init.d $(BIRD6) ) && rm -f /etc/$(BIRD6)/init.d/bird-uci-install-init.d
+        ( . /etc/$(BIRD6)/init.d/99-relocate-filters $(BIRD6) ) && rm -f /etc/$(BIRD6)/init.d/99-relocate-filters
+        if [ -f /etc/sysupgrade.conf ] && ! grep $(BIRD6) /etc/sysupgrade.conf; then
+            echo /etc/config/$(BIRD6) >> /etc/sysupgrade.conf
+            echo /etc/$(BIRD6)/filters/ >> /etc/sysupgrade.conf
+            echo /etc/$(BIRD6)/functions/ >> /etc/sysupgrade.conf
+        fi
+    fi
+endef
+
+$(eval $(call BuildPackage,$(PKG_IPV4_UCI_NAME)))
+$(eval $(call BuildPackage,$(PKG_IPV6_UCI_NAME)))
+
+define Package/$(PKG_IPV4_LUCI_NAME)/install
+       $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/
+       $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/$(BIRD4)/
+       $(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/$(BIRD4)/
+       $(CP) ./$(PKG_IPV4_NAME)/src/model/* $(1)/usr/lib/lua/luci/model/cbi/$(BIRD4)/
+       $(CP) ./$(PKG_IPV4_NAME)/src/controller/* $(1)/usr/lib/lua/luci/controller/
+       $(CP) ./$(PKG_IPV4_NAME)/src/view/* $(1)/usr/lib/lua/luci/view/$(BIRD4)/
+endef
+
+define Package/$(PKG_IPV6_LUCI_NAME)/install
+       $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/
+       $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/$(BIRD6)/
+       $(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/$(BIRD6)/
+       $(CP) ./$(PKG_IPV6_NAME)/src/model/* $(1)/usr/lib/lua/luci/model/cbi/$(BIRD6)/
+       $(CP) ./$(PKG_IPV6_NAME)/src/controller/* $(1)/usr/lib/lua/luci/controller/
+       $(CP) ./$(PKG_IPV6_NAME)/src/view/* $(1)/usr/lib/lua/luci/view/$(BIRD6)/
+endef
+
+$(eval $(call BuildPackage,$(PKG_IPV4_LUCI_NAME)))
+$(eval $(call BuildPackage,$(PKG_IPV6_LUCI_NAME)))
diff --git a/bird1-openwrt/bird1-ipv4-openwrt/Makefile b/bird1-openwrt/bird1-ipv4-openwrt/Makefile
deleted file mode 100644 (file)
index 9cb399d..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-# Copyright (C) 2014-2017  Eloi Carbo <eloicaso@openmailbox.org>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-BIRD := bird4
-BIRD_PKG := bird1-ipv4
-PKG_NAME := $(BIRD_PKG)-openwrt
-PKG_VERSION := 0.3
-PKG_RELEASE := 1
-PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
-PKG_LICENSE := GPL-3.0+
-uci := $(BIRD_PKG)-uci
-luci := luci-app-$(BIRD_PKG)
-
-include $(INCLUDE_DIR)/package.mk
-
-define Build/Prepare
-endef
-define Build/Compile
-endef
-
-define Package/$(uci)
-  TITLE:=The BIRD UCI module (v1.6) (IPv4)
-  SECTION:=net
-  CATEGORY:=Network
-  SUBMENU:=Routing and Redirection
-  MAINTAINER:=Roger Pueyo Centelles <roger.pueyo@guifi.net>
-  URL:=https://github.com/eloicaso/bird-openwrt/
-  DEPENDS:=+$(BIRD_PKG) +libuci +uci
-endef
-
-define Package/$(uci)/description
-$(BIRD_PKG) UCI integration module
-endef
-
-define Package/$(uci)/conffiles
-       /etc/config/$(BIRD)
-endef
-
-define Package/$(uci)/install
-       $(INSTALL_DIR) $(1)/etc/$(BIRD)/init.d
-       $(INSTALL_DIR) $(1)/etc/config
-       $(INSTALL_DIR) $(1)/etc/$(BIRD)/filters
-       $(INSTALL_DIR) $(1)/etc/$(BIRD)/functions
-       $(INSTALL_BIN) ./src/init.d/$(BIRD)* $(1)/etc/$(BIRD)/init.d/
-       $(CP) ./src/uci-defaults/* $(1)/etc/$(BIRD)/init.d/
-       $(INSTALL_CONF) ./src/config/$(BIRD) $(1)/etc/config/
-endef
-
-define Package/$(uci)/postinst
-#!/bin/sh
-    if [ -z "$${IPKG_INSTROOT}" ]; then
-        ( . /etc/$(BIRD)/init.d/bird-uci-install-init.d $(BIRD) ) && rm -f /etc/$(BIRD)/init.d/bird-uci-install-init.d
-        ( . /etc/$(BIRD)/init.d/99-relocate-filters $(BIRD) ) && rm -f /etc/$(BIRD)/init.d/99-relocate-filters
-        if [ -f /etc/sysupgrade.conf ] && ! grep $(BIRD) /etc/sysupgrade.conf; then
-            echo /etc/config/$(BIRD) >> /etc/sysupgrade.conf
-            echo /etc/$(BIRD)/filters/ >> /etc/sysupgrade.conf
-            echo /etc/$(BIRD)/functions/ >> /etc/sysupgrade.conf
-        fi
-    fi
-endef
-
-$(eval $(call BuildPackage,$(uci)))
-
-define Package/$(luci)
-  TITLE:=LuCI support for $(BIRD_PKG)
-  SECTION:=luci
-  CATEGORY:=LuCI
-  SUBMENU:=3. Applications
-  MAINTAINER:=Roger Pueyo Centelles <roger.pueyo@guifi.net>
-  URL:=https://github.com/eloicaso/bird-openwrt/
-  DEPENDS:=+$(BIRD_PKG)-uci +luci-base +luci-compat
-endef
-
-define Package/$(luci)/description
-$(BIRD) application for LuCI
-endef
-
-define Package/$(luci)/install
-       $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/
-       $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/$(BIRD)/
-       $(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/$(BIRD)/
-       $(CP) ./src/model/* $(1)/usr/lib/lua/luci/model/cbi/$(BIRD)/
-       $(CP) ./src/controller/* $(1)/usr/lib/lua/luci/controller/
-       $(CP) ./src/view/* $(1)/usr/lib/lua/luci/view/$(BIRD)/
-endef
-
-$(eval $(call BuildPackage,$(luci)))
diff --git a/bird1-openwrt/bird1-ipv6-openwrt/Makefile b/bird1-openwrt/bird1-ipv6-openwrt/Makefile
deleted file mode 100644 (file)
index 56f0f59..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-# Copyright (C) 2014-2017  Eloi Carbo <eloicaso@openmailbox.org>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-BIRD := bird6
-BIRD_PKG := bird1-ipv6
-PKG_NAME := $(BIRD_PKG)-openwrt
-PKG_VERSION := 0.3
-PKG_RELEASE := 1
-PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
-PKG_LICENSE := GPL-3.0+
-uci := $(BIRD_PKG)-uci
-luci := luci-app-$(BIRD_PKG)
-
-include $(INCLUDE_DIR)/package.mk
-
-define Build/Prepare
-endef
-define Build/Compile
-endef
-
-define Package/$(uci)
-  TITLE:=The BIRD UCI module (v1.6) (IPv6)
-  SECTION:=net
-  CATEGORY:=Network
-  SUBMENU:=Routing and Redirection
-  MAINTAINER:=Roger Pueyo Centelles <roger.pueyo@guifi.net>
-  URL:=https://github.com/eloicaso/bird-openwrt/
-  DEPENDS:=+$(BIRD_PKG) +libuci +uci
-endef
-
-define Package/$(uci)/description
-$(BIRD_PKG) UCI integration module
-endef
-
-define Package/$(uci)/conffiles
-       /etc/config/$(BIRD)
-endef
-
-define Package/$(uci)/install
-       $(INSTALL_DIR) $(1)/etc/$(BIRD)/init.d
-       $(INSTALL_DIR) $(1)/etc/config
-       $(INSTALL_DIR) $(1)/etc/$(BIRD)/filters
-       $(INSTALL_DIR) $(1)/etc/$(BIRD)/functions
-       $(INSTALL_BIN) ./src/init.d/$(BIRD)* $(1)/etc/$(BIRD)/init.d/
-       $(CP) ./src/uci-defaults/* $(1)/etc/$(BIRD)/init.d/
-       $(INSTALL_CONF) ./src/config/$(BIRD) $(1)/etc/config/
-endef
-
-define Package/$(uci)/postinst
-#!/bin/sh
-    if [ -z "$${IPKG_INSTROOT}" ]; then
-        ( . /etc/$(BIRD)/init.d/bird-uci-install-init.d $(BIRD) ) && rm -f /etc/$(BIRD)/init.d/bird-uci-install-init.d
-        ( . /etc/$(BIRD)/init.d/99-relocate-filters $(BIRD) ) && rm -f /etc/$(BIRD)/init.d/99-relocate-filters
-        if [ -f /etc/sysupgrade.conf ] && ! grep $(BIRD) /etc/sysupgrade.conf; then
-            echo /etc/config/$(BIRD) >> /etc/sysupgrade.conf
-            echo /etc/$(BIRD)/filters/ >> /etc/sysupgrade.conf
-            echo /etc/$(BIRD)/functions/ >> /etc/sysupgrade.conf
-        fi
-    fi
-endef
-
-$(eval $(call BuildPackage,$(uci)))
-
-define Package/$(luci)
-  TITLE:=LuCI support for $(BIRD_PKG)
-  SECTION:=luci
-  CATEGORY:=LuCI
-  SUBMENU:=3. Applications
-  MAINTAINER:=Roger Pueyo Centelles <roger.pueyo@guifi.net>
-  URL:=https://github.com/eloicaso/bird-openwrt/
-  DEPENDS:=+$(BIRD_PKG)-uci +luci-base +luci-compat
-endef
-
-define Package/$(luci)/description
-$(BIRD) application for LuCI
-endef
-
-define Package/$(luci)/install
-       $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/
-       $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/$(BIRD)/
-       $(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/$(BIRD)/
-       $(CP) ./src/model/* $(1)/usr/lib/lua/luci/model/cbi/$(BIRD)/
-       $(CP) ./src/controller/* $(1)/usr/lib/lua/luci/controller/
-       $(CP) ./src/view/* $(1)/usr/lib/lua/luci/view/$(BIRD)/
-endef
-
-$(eval $(call BuildPackage,$(luci)))