pymumu / smartdns

A local DNS server to obtain the fastest website IP for the best Internet experience, support DoT, DoH. 一个本地DNS服务器,获取最快的网站IP,获得最佳上网体验,支持DoH,DoT。
https://pymumu.github.io/smartdns/
GNU General Public License v3.0
8.52k stars 1.09k forks source link

能不能给个编译文件 #186

Closed ghostry closed 5 years ago

ghostry commented 5 years ago

需求应用场景 集成到固件中

建议的方案 https://github.com/coolsnowwolf/lede/tree/master/package/lean/v2ray

参考上面的这种,不用放出源码,也可以结合到编译过程中。

这样可以集成到固件里。

我试着写一个,但是搞了一下有点搞不清各个cpu的对应关系。 R26文件太大,我使用的R25的文件, arm,arm64,amd64,x86, armv7,mips,mipsle不知道该放哪个文件进去。

ghostry commented 5 years ago
include $(TOPDIR)/rules.mk

PKG_NAME:=smartdns
PKG_VERSION:=1.2019.05.21
PKG_RELEASE:=2250

include $(INCLUDE_DIR)/package.mk

define Package/$(PKG_NAME)
    SECTION:=net
    CATEGORY:=Gmod
    SUBMENU:=Network
    TITLE:=Smartdns is a DNS proxy software
    DEPENDS:=+libopenssl
    URL:=https://github.com/pymumu/smartdns/releases
endef

define Package/$(PKG_NAME)/description
smartdns is a DNS proxy software
endef

SMARTDNS_BIN:=smartdns

ifeq ($(ARCH),x86_64)
    PKG_ARCH_SMARTDNS:=amd64
endif
ifeq ($(ARCH),mipsel)
    PKG_ARCH_SMARTDNS:=mipsle
endif
ifeq ($(ARCH),mips)
    PKG_ARCH_SMARTDNS:=mips
endif
ifeq ($(ARCH),i386)
    PKG_ARCH_SMARTDNS:=x86
endif
ifeq ($(ARCH),arm)
    PKG_ARCH_SMARTDNS:=arm
    ifneq ($(BOARD),bcm53xx)
        SMARTDNS_BIN:=smartdns_armv7
    endif
    ifeq ($(BOARD),kirkwood)
        SMARTDNS_BIN:=smartdns
    endif
endif
ifeq ($(ARCH),aarch64)
    PKG_ARCH_SMARTDNS:=arm64
endif

define Build/Prepare
endef

define Build/Configure
endef

define Build/Compile
endef

define Package/$(PKG_NAME)/install
    $(INSTALL_DIR) $(1)/usr/sbin
    $(INSTALL_BIN) ./files/$(PKG_ARCH_SMARTDNS)/$(SMARTDNS_BIN) $(1)/usr/sbin/smartdns
    $(INSTALL_DIR) $(1)/etc/config
    $(INSTALL_DATA) ./files/etc/config/smartdns $(1)/etc/config
    $(INSTALL_DIR) $(1)/etc/smartdns
    $(INSTALL_DATA) ./files/etc/smartdns/*.conf $(1)/etc/smartdns
    $(INSTALL_DIR) $(1)/etc/init.d
    $(INSTALL_BIN) ./files/etc/init.d/smartdns $(1)/etc/init.d/smartdns
endef

$(eval $(call BuildPackage,$(PKG_NAME)))
pymumu commented 5 years ago

openwrt AR71xx

export STAGING_DIR=/opt/toolchain/openwrt-sdk-ar71xx-generic_gcc-7.3.0_musl.Linux-armv7l/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl/ export CC=/opt/toolchain/openwrt-sdk-ar71xx-generic_gcc-7.3.0_musl.Linux-armv7l/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl/bin/mips-openwrt-linux-gcc build mips_24kc openwrt unset CC

openwrt MT7620

export STAGING_DIR=/opt/toolchain/openwrt-sdk-ramips-mt7620_gcc-7.3.0_musl.Linux-armv7l/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/ export CC=/opt/toolchain/openwrt-sdk-ramips-mt7620_gcc-7.3.0_musl.Linux-armv7l/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/bin/mipsel-openwrt-linux-gcc build mipsel_24kc openwrt unset CC

openwrt IPX40xx, ARM

export STAGING_DIR=/opt/toolchain/openwrt-sdk-ipq40xx_gcc-7.3.0_musl_eabi.Linux-armv7l/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/ export CC=/opt/toolchain/openwrt-sdk-ipq40xx_gcc-7.3.0_musl_eabi.Linux-armv7l/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi/bin/arm-openwrt-linux-gcc build arm_cortex-a7_neon-vfpv4 openwrt build arm_cortex-a9_vfpv3 openwrt nobuild build arm_cortex-a15_neon-vfpv4 openwrt nobuild unset CC

openwrt IPX806x, ARM

export STAGING_DIR=/opt/toolchain/openwrt-sdk-ipq806x_gcc-7.3.0_musl_eabi.Linux-armv7l/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-7.3.0_musl_eabi/ export CC=/opt/toolchain/openwrt-sdk-ipq806x_gcc-7.3.0_musl_eabi.Linux-armv7l/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-7.3.0_musl_eabi/bin/arm-openwrt-linux-gcc build arm_cortex-a15_neon-vfpv4 openwrt unset CC

openwrt BCM53xx, ARM

export STAGING_DIR=/opt/toolchain/openwrt-sdk-bcm53xx_gcc-7.3.0_musl_eabi.Linux-armv7l/staging_dir/toolchain-arm_cortex-a9_gcc-7.3.0_musl_eabi/ export CC=/opt/toolchain/openwrt-sdk-bcm53xx_gcc-7.3.0_musl_eabi.Linux-armv7l/staging_dir/toolchain-arm_cortex-a9_gcc-7.3.0_musl_eabi/bin/arm-openwrt-linux-gcc build arm_cortex-a9 openwrt unset CC

openwrt x86_64

export STAGING_DIR=/opt/toolchain/openwrt-sdk-x86-64_gcc-7.3.0_musl.Linux-armv7l/staging_dir/toolchain-x86_64_gcc-7.3.0_musl/ export CC=/opt/toolchain/openwrt-sdk-x86-64_gcc-7.3.0_musl.Linux-armv7l/staging_dir/toolchain-x86_64_gcc-7.3.0_musl/bin/x86_64-openwrt-linux-gcc build x86_64 openwrt unset CC

openwrt x86

export STAGING_DIR=/opt/toolchain/openwrt-sdk-x86-generic_gcc-7.3.0_musl.Linux-armv7l/staging_dir/toolchain-i386_pentium4_gcc-7.3.0_musl/ export CC=/opt/toolchain/openwrt-sdk-x86-generic_gcc-7.3.0_musl.Linux-armv7l/staging_dir/toolchain-i386_pentium4_gcc-7.3.0_musl/bin/i486-openwrt-linux-gcc build i386_pentium4 openwrt unset CC

这个是我18.06的编译脚本,如果是同一个版本的固件,大部分情况下mips, mipsel, arm, x86都是可以通用的。

静态编译的哪个,只是减少了固件版本的依赖。

pymumu commented 5 years ago

也就是说,如果你配套18.06的固件,再release 25版本里面,只要提取如下二进制文件就可以: mips: mips_24kc mipsel: mipsel_24kc arm: arm_cortex-a9 x86: i386_pentium4 x86_64: x86_64

但要openssl配套。 其实制作自定义固件,可以直接使用ipk包,用image-builder添加进去就好。 唯一的要求就是,修改ipk包中的arch依赖信息。

arch依赖修改可以用shell脚本,将ipk解压后,修改完成后,再压缩回去。 临时写了一个修改arch的脚本,你可以试试看。

chagearch -f old.ipk -o new.ipk -a arch

changearch.zip

xiaobaishu1 commented 5 years ago

smartdns

我也想知道你解决了没有? 怎么集成到固件里面

ghostry commented 5 years ago

smartdns

我也想知道你解决了没有? 怎么集成到固件里面

我有试着摆放了下文件,对不对就不清楚了,我路由器能用,其他的没测。https://github.com/ghostry/openwrt-gmod/tree/openwrt-18.06/package/smartdns

xiaobaishu1 commented 5 years ago

GSLB中

我也想知道你解决了没有?怎么集成到固件里面

我有试着摆放了下文件,对不对就不清楚了,我路由器能用,其他的没测.https://github.com/ghostry/openwrt-gmod/tree/openwrt-18.06/package/smartdns

用是可以用但是luci-app-smartdns版本是1.2019.06.21-2337 但是smartdns版本是1.2019.05.21-2250 不知道是不是有问题?