Bläddra i källkod

update makefile for openwrt

Nick Peng 5 år sedan
förälder
incheckning
4464bb982e
1 ändrade filer med 43 tillägg och 18 borttagningar
  1. 43 18
      package/openwrt/Makefile

+ 43 - 18
package/openwrt/Makefile

@@ -13,38 +13,63 @@
 #
 # 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
 
-PKG_NAME:=smarttdns
-PKG_VERSION:=2018.7.1.1607
-PKG_RELEASE:=$(PKG_SOURCE_VERSION)
+PKG_NAME:=smartdns
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/pymumu/smartdns.git
 
-PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_REV:=d51f5e6eeba7bfde1b108fe32d540bd429550573
+PKG_VERSION:=1.2019.11.02-1102
+PKG_RELEASE:=1
+PKG_LICENSE:=GPL-3.0
+
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
 
 include $(INCLUDE_DIR)/package.mk
 
+MAKE_ARGS := CFLAGS="$(TARGET_CFLAGS)" CC=$(TARGET_CC)
+
 define Package/smartdns
-	SECTION:=net
-	CATEGORY:=Network
-	TITLE:=smartdns
-	URL:=https://github.com/pymumu/smartdns
-	MAINTAINER:=Nick Peng <[email protected]>
-	DEPENDS:=
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=smartdns server
+  URL:=http://github.com/pymumu/smartdns/
+  MAINTAINER:=Nick Peng <[email protected]>
+  DEPENDS:=+libopenssl
 endef
 
 define Package/smartdns/description
-	smartdns server, find fastest ip.
+SmartDNS is a local DNS server. SmartDNS accepts DNS query requests from local clients, obtains DNS query results from multiple upstream DNS servers, and returns the fastest access results to clients.
+endef
+
+define Build/Configure
+	mkdir -p $(PKG_INSTALL_DIR)
+endef
+
+define Build/Compile
+	$(MAKE) -C $(PKG_BUILD_DIR)/src $(MAKE_ARGS) all
 endef
 
-define Build/Prepare
-	mkdir -p $(PKG_BUILD_DIR)
-	cp -r ../* $(PKG_BUILD_DIR)
+define Package/smartdns/conffiles
+/etc/config/smartdns
+/etc/smartdns/address.conf
+/etc/smartdns/blacklist-ip.conf
+/etc/smartdns/custom.conf
 endef
 
 define Package/smartdns/install
-	$(INSTALL_DIR) $(1)/usr/sbin
-	$(INSTALL_BIN) $(PKG_BUILD_DIR)/smartdns $(1)/usr/sbin
+	$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d $(1)/etc/smartdns
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/smartdns $(1)/usr/sbin/smartdns
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/package/openwrt/files/etc/init.d/smartdns $(1)/etc/init.d/smartdns
+	$(INSTALL_CONF) $(PKG_BUILD_DIR)/package/openwrt/address.conf $(1)/etc/smartdns/address.conf
+	$(INSTALL_CONF) $(PKG_BUILD_DIR)/package/openwrt/blacklist-ip.conf $(1)/etc/smartdns/blacklist-ip.conf
+	$(INSTALL_CONF) $(PKG_BUILD_DIR)/package/openwrt/custom.conf $(1)/etc/smartdns/custom.conf
+	$(INSTALL_CONF) $(PKG_BUILD_DIR)/package/openwrt/files/etc/config/smartdns $(1)/etc/config/smartdns
 endef
 
-$(eval $(call BuildPackage, smartdns))
+$(eval $(call BuildPackage,smartdns))