Сompile failed

You don't need it so you can just ignore that error. It's been like that "forever".

1 Like

made.
log

make -j4 clean download world

/openwrt/bin/targets/ar71xx/generic/openwrt-ar71xx-generic-gl-ar150-squashfs-sysupgrade.bin
that's what it is my ready firmware file? he is different from that which i downloaded from http://downloads.openwrt.org/releases/18.06.1/targets/ar71xx/generic/openwrt-18.06.1-ar71xx-generic-gl-ar150-squashfs-sysupgrade.bin
original = 3.8 mb
my compiled = 3.5 mb

what's next?

It's probably smaller as it may not include LuCI by default.

If you want LuCI, you'll need to add that using make menuconfig and selecting the appropriate LuCI collection. I personally recommend a TLS-enabled version. I would confirm that the image you build from the "stock" sources installs and runs as you expect before moving on to adding "non-standard" things.

You'll then need to add the package feed for the custom package you are trying to build and add it in make menuconfig as well. Then building the image should include what you're looking for.

1 Like

I starting from this paragraph . right?

Creating the package directory

Adding your package to an existing feed

For this example we assume that your are in /home/user/openwrt as your base directory.

  1. You create your current project dir project .

  2. Then while in /home/user/openwrt/project

  3. svn co svn:svn.openwrt.org/openwrt/trunk openwrt (for the OpenWRT base system) - svn co svn:svn.openwrt.org/openwrt/packages packages (for the packages feed)

  4. Add your package in the appropriate subdirectory under /home/user/openwrt/project/packages

after entering the command

svn co svn:svn.openwrt.org/openwrt/trunk openwrt

getting an error

svn: E125002: 'svn:svn.openwrt.org/openwrt/trunk' not a well formed URL

I think you should be able to add the package's git repo to your build by:

  • Copying feeds.conf.default to feeds.conf
  • Adding src-git redsocks2 https://github.com/aa65535/openwrt-redsocks2 to that file

This is based on the "feeds" link above and looking at scripts/feeds which contains

sub parse_config() {
        my $line = 0;
        my %name;

        open FEEDS, "feeds.conf" or
                open FEEDS, "feeds.conf.default" or
                die "Unable to open feeds configuration";
        while (<FEEDS>) {
[...]
1 Like

I think that guide must be outdated. It's using Git now, not svn. If it was svn it would have been svn://svn.openwrt.org, but that server does not exist.

I'm in stupor
I created a file /openwrt/project/openwrt/feeds.conf

src-git packages https://git.openwrt.org/feed/packages.git;openwrt-18.06
src-git luci https://git.openwrt.org/project/luci.git;openwrt-18.06
src-git routing https://git.openwrt.org/feed/routing.git;openwrt-18.06
src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-18.06
src-git redsocks2 https://github.com/aa65535/openwrt-redsocks2.git

executed these commands

  1. ./scripts/feeds update customfeed
    2)./scripts/feeds install -p customfeed
    further in make menuconfig I can not find this package

everything is so confusing in this wiki

Yes, very often wiki pages are written by experts that forget that non-experts read them!

"customfeed" there is just an example. If you run

./scripts/feeds update -a
./scripts/feeds install -a

it should find the new "redsocks2" feed you added.

Looking at the Makefile from that package

define Package/redsocks2
	SECTION:=net
	CATEGORY:=Network
	TITLE:=Redirect any TCP connection to a SOCKS or HTTPS proxy server
	URL:=https://github.com/semigodking/redsocks
	DEPENDS:=+libevent2
endef

tells me that you should find it in the Network section. You can also search in make menuconfig with the slash / key.

1 Like

not found.
thereafter I added it to original feed file /openwrt/feeds.conf.default
after entering

./scripts/feeds update -a
Updating feed 'packages' from 'https://git.openwrt.org/feed/packages.git;openwrt-18.06' ...
Already up-to-date.
Create index file './feeds/packages.index' 
Updating feed 'luci' from 'https://git.openwrt.org/project/luci.git;openwrt-18.06' ...
Already up-to-date.
Create index file './feeds/luci.index' 
Updating feed 'routing' from 'https://git.openwrt.org/feed/routing.git;openwrt-18.06' ...
Already up-to-date.
Create index file './feeds/routing.index' 
Updating feed 'telephony' from 'https://git.openwrt.org/feed/telephony.git;openwrt-18.06' ...
Already up-to-date.
Create index file './feeds/telephony.index' 
Updating feed 'redsocks2' from 'https://github.com/aa65535/openwrt-redsocks2' ...
Already up-to-date.
Create index file './feeds/redsocks2.index' 
/openwrt/feeds/redsocks2.tmp/info/.files-packageinfo.mk:1: *** target pattern contains no `%'.  Stop.

I executed this command a second time, because of this you see

Updating feed 'redsocks2' from 'https://github.com/aa65535/openwrt-redsocks2' ...
Already up-to-date.

It looks like the package was "installed" but that there might be some problem with the Makefile of the package or the sources it downloads. I don't see "target pattern contains no" in the OpenWrt build system itself.


Looks like the package might be broken

Updating feed 'redsocks2' from 'https://github.com/aa65535/openwrt-redsocks2' ...
Cloning into './feeds/redsocks2'...
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 9 (delta 0), reused 6 (delta 0), pack-reused 0
Unpacking objects: 100% (9/9), done.
Create index file './feeds/redsocks2.index' 
grep: feeds/redsocks2/Makefile:$(eval: No such file or directory
grep: $(call: No such file or directory
grep: BuildPackage,redsocks2))/Makefile: No such file or directory
/home/jeff/devel/openwrt/feeds/redsocks2.tmp/info/.files-packageinfo.mk:1: *** target pattern contains no '%'.  Stop.

Looking into it now

this package may conflict with /openwrt/feeds/packages/net/redsocks folder? which has already been installed with all openwrt system?

upd:didn't see your updated post

Looks like it's failing on the "update" step when (printed for debug from within the perl script in update_index($))

make -s -f include/scan.mk IS_TTY=1 SCAN_TARGET="packageinfo" \
SCAN_DIR="feeds/redsocks2" SCAN_NAME="package" \
SCAN_DEPTH=5 SCAN_EXTRA="" \
TMP_DIR="path/to/openwrt/feeds/redsocks2.tmp"

is executed
(I've never looked into just what this is)


OK, I've cloned the repo with the package files into ./package/openwrt-redsocks2

openwrt/package$ git clone https://github.com/aa65535/openwrt-redsocks2 

and it's showing up in make menuconfig (and removed feeds.conf). My apologies if this has sent you down a frustrating path. Trying a build now.

[...]
 make[2] -C package/openwrt-redsocks2 download
[...]
 make[3] -C package/openwrt-redsocks2 compile
[...]
 make[2] package/install
 make[2] target/install
 make[3] -C target/linux install
 make[2] package/index
 make[2] checksum

Looks like it's working! Shows in the .manifest as well.

Might want to look into https://github.com/semigodking/redsocks to see if that is more up-to-date for source than the package file's reference, but let's get at least one built!

1 Like

No guarantee that this works, but it does build!

openwrt/package/openwrt-redsocks2$ git diff HEAD^
diff --git a/Makefile b/Makefile
index da48d92..baca193 100644
--- a/Makefile
+++ b/Makefile
@@ -8,12 +8,17 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=redsocks2
-PKG_VERSION:=0.60
-PKG_RELEASE=2
+PKG_VERSION:=2018-09-27
+PKG_RELEASE=1
 
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=https://github.com/aa65535/openwrt-redsocks2/releases/download/v$(PKG_VERSION)
-PKG_MD5SUM:=b88bf23bf75fa7642f8d230db21f73b9
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/semigodking/redsocks
+PKG_SOURCE_VERSION:=4133bcf5f9ee7dd7687ab55bd36c051d149eb3ea
+PKG_SOURCE_DATE:=2018-09-27
+# make package/openwrt-redsocks2/check
+# WARNING: PKG_MIRROR_HASH is missing, set to f100249533ff792df5ed20e4f148d244e91ae2eb8a3edbc181e9481ee3f16ee3
+PKG_MIRROR_HASH:=f100249533ff792df5ed20e4f148d244e91ae2eb8a3edbc181e9481ee3f16ee3
 
 PKG_LICENSE:=GPLv2
 PKG_LICENSE_FILES:=LICENSE
@@ -28,7 +33,7 @@ define Package/redsocks2
        CATEGORY:=Network
        TITLE:=Redirect any TCP connection to a SOCKS or HTTPS proxy server
        URL:=https://github.com/semigodking/redsocks
-       DEPENDS:=+libevent2
+       DEPENDS:=+libevent2 +libopenssl
 endef
 
 define Package/redsocks2/description

It's apparently possible to build it with the "polar" libraries (now known as mbedTLS), but this should get you going with the newer code.

1 Like

https://openwrt.org/docs/guide-developer/feeds is indeed outdated. svn is long no more.

Any volunteers for updating that page?

all OK! Thanks for the support!

compiled, but it doesn't work for me. can it not work due to installed package mbedTLS ?

receives packets, but does not send

netstat -tulpn

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1169/uhttpd
tcp        0      0 192.168.2.60:53         0.0.0.0:*               LISTEN      2731/dnsmasq
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      2731/dnsmasq
tcp        0      0 192.168.2.1:53          0.0.0.0:*               LISTEN      2731/dnsmasq
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1308/dropbear
tcp       18      0 0.0.0.0:12345           0.0.0.0:*               LISTEN      7088/redsocks2
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      1169/uhttpd
tcp        0      0 :::80                   :::*                    LISTEN      1169/uhttpd
tcp        0      0 fe80::e495:6eff:fe44:a9e7:53 :::*                    LISTEN      2731/dnsmasq
tcp        0      0 fe80::e695:6eff:fe44:a9e7:53 :::*                    LISTEN      2731/dnsmasq
tcp        0      0 ::1:53                  :::*                    LISTEN      2731/dnsmasq
tcp        0      0 fd95:5bcb:c745::1:53    :::*                    LISTEN      2731/dnsmasq
tcp        0      0 fe80::e695:6eff:fe44:a9e7:53 :::*                    LISTEN      2731/dnsmasq
tcp        0      0 :::22                   :::*                    LISTEN      1308/dropbear
tcp        0      0 :::443                  :::*                    LISTEN      1169/uhttpd
udp        0      0 192.168.2.60:53         0.0.0.0:*                           2731/dnsmasq
udp        0      0 127.0.0.1:53            0.0.0.0:*                           2731/dnsmasq
udp        0      0 192.168.2.1:53          0.0.0.0:*                           2731/dnsmasq
udp        0      0 0.0.0.0:67              0.0.0.0:*                           2731/dnsmasq
udp        0      0 :::547                  :::*                                947/odhcpd
udp        0      0 fe80::e495:6eff:fe44:a9e7:53 :::*                                2731/dnsmasq
udp        0      0 fe80::e695:6eff:fe44:a9e7:53 :::*                                2731/dnsmasq
udp        0      0 ::1:53                  :::*                                2731/dnsmasq
udp        0      0 fd95:5bcb:c745::1:53    :::*                                2731/dnsmasq
udp        0      0 fe80::e695:6eff:fe44:a9e7:53 :::*                                2731/dnsmasq

yes, this is a newer package
how do i compile this package?

Post #21, above shows the patches (changes) that I made to the Makefile that refer to the newer sources. The lines that start with - are removed, the ones with + are added (but not the - or +). That version builds with the OpenSSL libraries, which it should build if needed when you build redsocks2.

now if I choose in make menuconfig OpenSSL instead mbedTLS. I got an error
make -j1 V=s

Collected errors:
 * check_data_file_clashes: Package libustream-openssl wants to install file /home/user/openwrt/build_dir/target-mips_24kc_musl/root-ar71xx/lib/libustream-ssl.so
	But that file is already provided by package  * libustream-mbedtls
 * opkg_install_cmd: Cannot install package libustream-openssl.
 * check_data_file_clashes: Package libustream-openssl wants to install file /home/user/openwrt/build_dir/target-mips_24kc_musl/root-ar71xx/lib/libustream-ssl.so
	But that file is already provided by package  * libustream-mbedtls
 * opkg_install_cmd: Cannot install package luci-ssl-openssl.
make[2]: *** [package/install] Error 255
make[2]: Leaving directory `/home/user/openwrt'
make[1]: *** [/home/user/openwrt/staging_dir/target-mips_24kc_musl/stamp/.package_install] Error 2
make[1]: Leaving directory `/home/user/openwrt'
make: *** [world] error 2

it's because I first installed with mbedTLS ?

Likely, yes -- Personally, I add openssl "first" when creating build configs. You'll probably need the luci-ssl-openssl collection, or at least the OpenSSL-based version of uhttpd (and probably things like curl/wget if you add those). I have found it easier to "start over" if I've got the "wrong" TLS package in my config, rather than try to figure out all the things to remove to get the dependencies right. For example, you probably can't remove mbedTLS until you remove a bunch of other things.

started all over again

.....
 make[3] -C package/openwrt-redsocks2 compile
make -r world: build failed. Please re-run make with -j1 V=s or V=sc for a higher verbosity level to see what's going on
make: *** [world] Error 1

/openwrt$ make -j1 V=s

.....
SHELL= flock /home/user/openwrt/tmp/.root-copy.flock -c 'cp -fpR /home/user/openwrt/build_dir/target-mips_24kc_musl/uclient-2018-11-24-3ba74ebc/.pkgdir/uclient-fetch/. /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/'
touch /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/stamp/.uclient-fetch_installed
echo "uclient-fetch" >> /home/user/openwrt/staging_dir/target-mips_24kc_musl/pkginfo/uclient.default.install
make[3]: Leaving directory `/home/user/openwrt/package/libs/uclient'
time: package/libs/uclient/compile#0.29#0.68#0.94
make[3]: Entering directory `/home/user/openwrt/package/network/config/swconfig'
mkdir -p /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/stamp
SHELL= flock /home/user/openwrt/tmp/.root-copy.flock -c 'cp -fpR /home/user/openwrt/build_dir/target-mips_24kc_musl/swconfig/.pkgdir/swconfig/. /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/'
touch /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/stamp/.swconfig_installed
echo "swconfig" >> /home/user/openwrt/staging_dir/target-mips_24kc_musl/pkginfo/swconfig.default.install
make[3]: Leaving directory `/home/user/openwrt/package/network/config/swconfig'
time: package/network/config/swconfig/compile#0.09#0.23#0.32
make[3]: Entering directory `/home/user/openwrt/package/network/ipv6/odhcp6c'
mkdir -p /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/stamp
SHELL= flock /home/user/openwrt/tmp/.root-copy.flock -c 'cp -fpR /home/user/openwrt/build_dir/target-mips_24kc_musl/odhcp6c-2018-07-14-67ae6a71/.pkgdir/odhcp6c/. /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/'
touch /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/stamp/.odhcp6c_installed
echo "odhcp6c" >> /home/user/openwrt/staging_dir/target-mips_24kc_musl/pkginfo/odhcp6c.default.install
make[3]: Leaving directory `/home/user/openwrt/package/network/ipv6/odhcp6c'
time: package/network/ipv6/odhcp6c/compile#0.26#0.57#0.81
make[3]: Entering directory `/home/user/openwrt/package/network/services/dnsmasq'
mkdir -p /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/stamp
SHELL= flock /home/user/openwrt/tmp/.root-copy.flock -c 'cp -fpR /home/user/openwrt/build_dir/target-mips_24kc_musl/dnsmasq-nodhcpv6/dnsmasq-2.80/.pkgdir/dnsmasq/. /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/'
touch /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/stamp/.dnsmasq_installed
echo "dnsmasq" >> /home/user/openwrt/staging_dir/target-mips_24kc_musl/pkginfo/dnsmasq.nodhcpv6.install
make[3]: Leaving directory `/home/user/openwrt/package/network/services/dnsmasq'
time: package/network/services/dnsmasq/nodhcpv6/compile#0.12#0.21#0.33
make[3]: Entering directory `/home/user/openwrt/package/network/services/dropbear'
mkdir -p /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/stamp
SHELL= flock /home/user/openwrt/tmp/.root-copy.flock -c 'cp -fpR /home/user/openwrt/build_dir/target-mips_24kc_musl/dropbear-2017.75/.pkgdir/dropbear/. /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/'
touch /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/stamp/.dropbear_installed
echo "dropbear" >> /home/user/openwrt/staging_dir/target-mips_24kc_musl/pkginfo/dropbear.default.install
make[3]: Leaving directory `/home/user/openwrt/package/network/services/dropbear'
time: package/network/services/dropbear/compile#0.14#0.16#1.05
make[3]: Entering directory `/home/user/openwrt/package/network/services/odhcpd'
mkdir -p /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/stamp
SHELL= flock /home/user/openwrt/tmp/.root-copy.flock -c 'cp -fpR /home/user/openwrt/build_dir/target-mips_24kc_musl/odhcpd-ipv6only/odhcpd-1.12/.pkgdir/odhcpd-ipv6only/. /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/'
touch /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/stamp/.odhcpd-ipv6only_installed
echo "odhcpd-ipv6only" >> /home/user/openwrt/staging_dir/target-mips_24kc_musl/pkginfo/odhcpd.ipv6only.install
make[3]: Leaving directory `/home/user/openwrt/package/network/services/odhcpd'
time: package/network/services/odhcpd/ipv6only/compile#0.12#0.19#0.29
make[3]: Entering directory `/home/user/openwrt/package/libs/libpcap'
make[3]: Leaving directory `/home/user/openwrt/package/libs/libpcap'
time: package/libs/libpcap/compile#0.14#0.20#0.35
make[3]: Entering directory `/home/user/openwrt/package/network/utils/linux-atm'
make[3]: Leaving directory `/home/user/openwrt/package/network/utils/linux-atm'
time: package/network/utils/linux-atm/compile#0.17#0.20#0.41
make[3]: Entering directory `/home/user/openwrt/package/network/utils/resolveip'
make[3]: Nothing to be done for `compile'.
make[3]: Leaving directory `/home/user/openwrt/package/network/utils/resolveip'
time: package/network/utils/resolveip/compile#0.08#0.12#0.18
make[3]: Entering directory `/home/user/openwrt/package/network/services/ppp'
mkdir -p /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/stamp
SHELL= flock /home/user/openwrt/tmp/.root-copy.flock -c 'cp -fpR /home/user/openwrt/build_dir/target-mips_24kc_musl/ppp-default/ppp-2.4.7/.pkgdir/ppp/. /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/'
touch /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/stamp/.ppp_installed
echo "ppp" >> /home/user/openwrt/staging_dir/target-mips_24kc_musl/pkginfo/ppp.default.install
mkdir -p /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/stamp
SHELL= flock /home/user/openwrt/tmp/.root-copy.flock -c 'cp -fpR /home/user/openwrt/build_dir/target-mips_24kc_musl/ppp-default/ppp-2.4.7/.pkgdir/ppp-mod-pppoe/. /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/'
touch /home/user/openwrt/staging_dir/target-mips_24kc_musl/root-ar71xx/stamp/.ppp-mod-pppoe_installed
echo "ppp-mod-pppoe" >> /home/user/openwrt/staging_dir/target-mips_24kc_musl/pkginfo/ppp.default.install
make[3]: Leaving directory `/home/user/openwrt/package/network/services/ppp'
time: package/network/services/ppp/default/compile#0.14#0.25#0.41
make[3]: Entering directory `/home/user/openwrt/package/openwrt-redsocks2'
touch /home/user/openwrt/build_dir/target-mips_24kc_musl/redsocks2//redsocks2-2018-09-27/.prepared_a9807c9407f8a49921945e50da0e7470_6664517399ebbbc92a37c5bb081b5c53_check
. /home/user/openwrt/include/shell.sh; xzcat /home/user/openwrt/dl/redsocks2-2018-09-27.tar.xz | tar -C /home/user/openwrt/build_dir/target-mips_24kc_musl/redsocks2//redsocks2-2018-09-27/.. -xf - 
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
make[3]: *** [/home/user/openwrt/build_dir/target-mips_24kc_musl/redsocks2//redsocks2-2018-09-27/.prepared_a9807c9407f8a49921945e50da0e7470_6664517399ebbbc92a37c5bb081b5c53] Error 2
make[3]: Leaving directory `/home/user/openwrt/package/openwrt-redsocks2'
time: package/openwrt-redsocks2/compile#0.09#0.17#0.27
make[2]: *** [package/openwrt-redsocks2/compile] Error 2
make[2]: Leaving directory `/home/user/openwrt'
make[1]: *** [/home/user/openwrt/staging_dir/target-mips_24kc_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory `/home/user/openwrt'
make: *** [world] Error 2

can compile with mbedTLS package? everything worked with mbedTLS OK.

makefile

#
# Copyright (C) 2014 OpenWrt-dist
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=redsocks2
PKG_VERSION:=2018-09-27
PKG_RELEASE=1


PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/semigodking/redsocks
PKG_SOURCE_VERSION:=4133bcf5f9ee7dd7687ab55bd36c051d149eb3ea
PKG_SOURCE_DATE:=2018-09-27
# make package/openwrt-redsocks2/check
# WARNING: PKG_MIRROR_HASH is missing, set to f100249533ff792df5ed20e4f148d244e91ae2eb8a3edbc181e9481ee3f16ee3
PKG_MIRROR_HASH:=f100249533ff792df5ed20e4f148d244e91ae2eb8a3edbc181e9481ee3f16ee3

PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Zhuofei Wang <SemigodKing@gmail.com>

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)

include $(INCLUDE_DIR)/package.mk

define Package/redsocks2
	SECTION:=net
	CATEGORY:=Network
	TITLE:=Redirect any TCP connection to a SOCKS or HTTPS proxy server
	URL:=https://github.com/semigodking/redsocks
	DEPENDS:=+libevent2 +libopenssl
endef

define Package/redsocks2/description
This is a modified version of original redsocks. \
The name is changed to be REDSOCKS2 since this release to distinguish with original redsocks. \
This variant is useful for anti-GFW (Great Fire Wall).
endef

define Package/redsocks2/conffiles
/etc/config/redsocks2
endef

define Package/redsocks2/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/redsocks2 $(1)/usr/bin
	$(INSTALL_DIR) $(1)/etc/config
	$(INSTALL_DATA) ./files/redsocks2.config $(1)/etc/config/redsocks2
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_BIN) ./files/redsocks2.init $(1)/etc/init.d/redsocks2
	$(INSTALL_DIR) $(1)/etc/redsocks2
	$(INSTALL_DATA) ./files/redsocks2.template $(1)/etc/redsocks2/config.template
endef

$(eval $(call BuildPackage,redsocks2))

/openwrt/package/openwrt-redsocks2$ git diff HEAD^

diff --git a/Makefile b/Makefile
index b973745..baca193 100644
--- a/Makefile
+++ b/Makefile
@@ -8,12 +8,17 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=redsocks2
-PKG_VERSION:=0.60
-PKG_RELEASE=2
+PKG_VERSION:=2018-09-27
+PKG_RELEASE=1
 
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=https://github.com/aa65535/openwrt-redsocks2/releases/download/v$(PKG_VERSION)
-PKG_MD5SUM:=b88bf23bf75fa7642f8d230db21f73b9
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/semigodking/redsocks
+PKG_SOURCE_VERSION:=4133bcf5f9ee7dd7687ab55bd36c051d149eb3ea
+PKG_SOURCE_DATE:=2018-09-27
+# make package/openwrt-redsocks2/check
+# WARNING: PKG_MIRROR_HASH is missing, set to f100249533ff792df5ed20e4f148d244e91ae2eb8a3edbc181e9481ee3f16ee3
+PKG_MIRROR_HASH:=f100249533ff792df5ed20e4f148d244e91ae2eb8a3edbc181e9481ee3f16ee3
 
 PKG_LICENSE:=GPLv2
 PKG_LICENSE_FILES:=LICENSE
@@ -28,7 +33,7 @@ define Package/redsocks2
        CATEGORY:=Network
        TITLE:=Redirect any TCP connection to a SOCKS or HTTPS proxy server
        URL:=https://github.com/semigodking/redsocks
-       DEPENDS:=+libevent2
+       DEPENDS:=+libevent2 +libopenssl
 endef
 
 define Package/redsocks2/description
@@ -37,7 +42,7 @@ The name is changed to be REDSOCKS2 since this release to distinguish with origi
 This variant is useful for anti-GFW (Great Fire Wall).
 endef
 
-define Package/shadowsocks-libev-spec/conffiles
+define Package/redsocks2/conffiles
 /etc/config/redsocks2
 endef