dos2unix: add new package
authorTianling Shen <cnsztl@immortalwrt.org>
Sat, 29 Oct 2022 16:55:35 +0000 (00:55 +0800)
committerRosen Penev <rosenp@gmail.com>
Fri, 4 Nov 2022 20:13:28 +0000 (13:13 -0700)
dos2unix - text file format converters

includes:
dos2unix - DOS/Mac to Unix text file format converter (dos2unix/mac2unix)
unix2dos - Unix to DOS/Mac text file format converter (unix2dos/unix2mac)

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
utils/dos2unix/Makefile [new file with mode: 0644]
utils/dos2unix/test.sh [new file with mode: 0644]

diff --git a/utils/dos2unix/Makefile b/utils/dos2unix/Makefile
new file mode 100644 (file)
index 0000000..2326e0c
--- /dev/null
@@ -0,0 +1,53 @@
+# SPDX-License-Identifier: GPL-3.0-only
+#
+# Copyright (C) 2022 ImmortalWrt.org
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=dos2unix
+PKG_VERSION:=7.4.3
+PKG_RELEASE:=$(AUTORELEASE)
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://waterlan.home.xs4all.nl/dos2unix/ \
+                @SF/dos2unix
+PKG_HASH:=b68db41956daf933828423aa30510e00c12d29ef5916e715e8d4e694fe66ca72
+
+PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
+PKG_LICENSE:=BSD-2-Clause
+PKG_LICENSE_FILES:=COPYING.txt
+
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+MAKE_FLAGS+= D2U_OS=Linux
+
+define dos2unix/template
+  define Package/$(1)
+    SECTION:=utils
+    CATEGORY:=Utilities
+    TITLE:=Text file format converters ($(1))
+    URL:=https://waterlan.home.xs4all.nl/dos2unix.html
+    PROVIDES:=$(2)
+  endef
+
+  define Package/$(1)/description
+  Convert text files with DOS or Mac line breaks to Unix line breaks
+  and vice versa.
+
+  This package contains the $(1).
+  endef
+
+  define Package/$(1)/install
+       $$(INSTALL_DIR) $$(1)/usr/bin
+       $$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin/
+       $$(LN) $(1) $$(1)/usr/bin/$(2)
+  endef
+
+  $$(eval $$(call BuildPackage,$(1)))
+endef
+
+$(eval $(call dos2unix/template,dos2unix,mac2unix))
+$(eval $(call dos2unix/template,unix2dos,unix2mac))
diff --git a/utils/dos2unix/test.sh b/utils/dos2unix/test.sh
new file mode 100644 (file)
index 0000000..233259e
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+"$1" --version | grep "$2"