Skip to content

Commit

Permalink
# adjust adguardhome/Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
czy21 committed Dec 16, 2024
1 parent 0ca122e commit e91214b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 27 deletions.
12 changes: 11 additions & 1 deletion main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,18 @@ if [ "$1" == "update" ];then
sparse_checkout $lede_packages_dir "https://github.com/coolsnowwolf/packages" "$lede_packages_pkg"
cp -rv $lede_packages_dir/net/* package/

##
immortalwrt_packages_dir=feeds/immortalwrt/packages
immortalwrt_packages_pkg="net/adguardhome"
sparse_checkout $immortalwrt_packages_dir "https://github.com/immortalwrt/packages" "$immortalwrt_packages_pkg" $([ "$branch" == "main" ] && echo master || echo $branch)

for t in `find $immortalwrt_packages_dir -name 'Makefile'`;do
cp_pkg_var $t
done

##
official_packages_dir=feeds/openwrt/packages
official_packages_pkg="net/adguardhome net/dnsproxy"
official_packages_pkg="net/dnsproxy"
sparse_checkout $official_packages_dir "https://github.com/openwrt/packages" "$official_packages_pkg" $([ "$branch" == "main" ] && echo master || echo $branch)

for t in `find $official_packages_dir -name 'Makefile'`;do
Expand Down
58 changes: 32 additions & 26 deletions package/adguardhome/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,39 @@ PKG_NAME:=adguardhome
PKG_VERSION:=0.107.53
PKG_RELEASE:=1

PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
PKG_SOURCE_URL:=https://github.com/AdguardTeam/AdGuardHome
PKG_MIRROR_HASH:=d74702bc4f8b82bda64a0a937a98e73ee602c21b9361c0c683671212e03e9316
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/AdguardTeam/AdGuardHome/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=dd2a60ff8806d2fa39fe1c41bf3534c2231132147f23e337f98b3bd83a4be654
PKG_BUILD_DIR:=$(BUILD_DIR)/AdGuardHome-$(PKG_VERSION)

PKG_LICENSE:=GPL-3.0-only
PKG_LICENSE_FILES:=LICENSE.txt
PKG_MAINTAINER:=Dobroslaw Kijowski <[email protected]>

PKG_BUILD_DEPENDS:=golang/host node/host node-yarn/host
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
PKG_BUILD_FLAGS:=no-mips16

GO_PKG:=github.com/AdguardTeam/AdGuardHome
GO_PKG_BUILD_PKG:=github.com/AdguardTeam/AdGuardHome
GO_PKG_BUILD_PKG:=$(GO_PKG)

AGH_BUILD_TIME:=$(shell date -d @$(SOURCE_DATE_EPOCH) +%FT%TZ%z)
AGH_VERSION_PKG:=github.com/AdguardTeam/AdGuardHome/internal/version
GO_PKG_LDFLAGS_X:=$(AGH_VERSION_PKG).channel=release \
$(AGH_VERSION_PKG).version=$(PKG_SOURCE_VERSION) \
$(AGH_VERSION_PKG).buildtime=$(AGH_BUILD_TIME) \
$(AGH_VERSION_PKG).goarm=$(GO_ARM) \
$(AGH_VERSION_PKG).gomips=$(GO_MIPS)
GO_PKG_LDFLAGS_X:= \
$(GO_PKG)/internal/version.channel=release \
$(GO_PKG)/internal/version.version=v$(PKG_VERSION) \
$(GO_PKG)/internal/version.buildtime=$(AGH_BUILD_TIME) \
$(GO_PKG)/internal/version.goarm=$(GO_ARM) \
$(GO_PKG)/internal/version.gomips=$(GO_MIPS)

include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk

define Package/adguardhome
SECTION:=net
CATEGORY:=Network
TITLE:=Network-wide ads and trackers blocking DNS server
URL:=https://github.com/AdguardTeam/AdGuardHome
DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
SECTION:=net
CATEGORY:=Network
TITLE:=Network-wide ads and trackers blocking DNS server
URL:=https://github.com/AdguardTeam/AdGuardHome
DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
endef

define Package/adguardhome/conffiles
Expand All @@ -50,16 +50,21 @@ define Package/adguardhome/conffiles
endef

define Package/adguardhome/description
Free and open source, powerful network-wide ads and trackers blocking DNS server.
Free and open source, powerful network-wide ads and trackers blocking DNS server.
endef

define Build/Compile
( \
pushd $(PKG_BUILD_DIR) ; \
NODE_OPTIONS=--openssl-legacy-provider make js-deps js-build ; \
popd ; \
$(call GoPackage/Build/Compile) ; \
)
FRONTEND_FILE:=$(PKG_NAME)-frontend-$(PKG_VERSION).tar.gz
define Download/adguardhome-frontend
URL:=https://github.com/AdguardTeam/AdGuardHome/releases/download/v$(PKG_VERSION)/
URL_FILE:=AdGuardHome_frontend.tar.gz
FILE:=$(FRONTEND_FILE)
HASH:=69047225e2a5474e55fa56d12b71ba4e58e36b5af299f27099d216e1e7ab7f43
endef

define Build/Prepare
$(call Build/Prepare/Default)

gzip -dc $(DL_DIR)/$(FRONTEND_FILE) | $(HOST_TAR) -C $(PKG_BUILD_DIR)/ $(TAR_OPTIONS)
endef

define Package/adguardhome/install
Expand All @@ -74,5 +79,6 @@ define Package/adguardhome/install
$(INSTALL_DATA) ./files/adguardhome.config $(1)/etc/config/adguardhome
endef

$(eval $(call Download,adguardhome-frontend))
$(eval $(call GoBinPackage,adguardhome))
$(eval $(call BuildPackage,adguardhome))
$(eval $(call BuildPackage,adguardhome))

0 comments on commit e91214b

Please sign in to comment.