Skip to content

Instantly share code, notes, and snippets.

@Guest007
Forked from spvkgn/far2l-OpenWrt.md
Created April 16, 2023 12:20
Show Gist options
  • Save Guest007/d826e747c431b8d1b4f044fee40be4c0 to your computer and use it in GitHub Desktop.
Save Guest007/d826e747c431b8d1b4f044fee40be4c0 to your computer and use it in GitHub Desktop.
Build far2l for OpenWrt

Build Far2L using OpenWrt SDK toolchain

  • wget https://downloads.openwrt.org/releases/21.02.3/targets/ramips/mt7621/openwrt-sdk-21.02.3-ramips-mt7621_gcc-8.4.0_musl.Linux-x86_64.tar.xz

  • tar xvf $(ls openwrt-sdk-*.tar.xz) && cd $(ls -d openwrt-sdk-*/) && mkdir -p package/far2l && nano package/far2l/Makefile

include $(TOPDIR)/rules.mk

PKG_NAME:=far2l
PKG_VERSION:=2.5.0-beta

PKG_LICENSE:=GPL-2
PKG_LICENSE_FILES:=LICENSE.txt

#PKG_REV:=master
PKG_REV:=v_$(shell echo $(PKG_VERSION) | cut -d- -f1)
PKG_SOURCE:=$(PKG_REV).tar.gz
PKG_SOURCE_URL:=https://github.com/elfmz/far2l/archive/
PKG_HASH:=skip
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_REV)
PKG_BUILD_PARALLEL:=1

CMAKE_INSTALL:=1

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk

define Package/far2l
	SECTION:=utils
	CATEGORY:=Utilities
	DEPENDS:=+libstdcpp
	TITLE:=Far2L File Manager
	URL:=https://github.com/elfmz/far2l
endef

define Package/far2l/install
	$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/far2l $(1)/usr/share/far2l
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/far2l $(1)/usr/bin
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/far2l/* $(1)/usr/lib/far2l/
	$(CP) $(PKG_INSTALL_DIR)/usr/share/far2l/* $(1)/usr/share/far2l/
endef

#TARGET_LDFLAGS += -static-libstdc++

CMAKE_OPTIONS += \
	-DUSEUCD=OFF \
	-DUSEWX=OFF \
	-DCOLORER=OFF \
	-DNETROCKS=OFF \
#	-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON

ifdef CONFIG_USE_MUSL
	CMAKE_OPTIONS += -DMUSL=ON
endif

ifdef CONFIG_PACKAGE_busybox
	CMAKE_OPTIONS += -DTAR_LIMITED_ARGS=ON
endif

$(eval $(call BuildPackage,far2l))
  • mkdir -p package/far2l/patches && wget https://github.com/unxed/far2l-deb/raw/master/portable/tty_tweaks.patch -P package/far2l/patches
cat << "EOF" > package/far2l/patches/series
tty_tweaks.patch
EOF
  • make V=s -j `nproc` package/far2l/compile

    • < Exit >< Yes >
  • cp ./bin/packages/*/base/far2l_*.ipk .. ; fakeroot tar czvf ../$(basename ../far2l_*.ipk .ipk).tar.gz -C build_dir/target-*/far2l-*/.pkgdir/far2l ./usr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment