diff --git a/extra/00-qnx-build.patch b/extra/00-qnx-build.patch new file mode 100644 index 00000000..5d8beece --- /dev/null +++ b/extra/00-qnx-build.patch @@ -0,0 +1,77 @@ +diff --git a/include/strutils.h b/include/strutils.h +index a7177fc23..175f1ba66 100644 +--- a/include/strutils.h ++++ b/include/strutils.h +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + #include + + #include "c.h" +diff --git a/include/ttyutils.h b/include/ttyutils.h +index 46df3cddd..25d63a3c8 100644 +--- a/include/ttyutils.h ++++ b/include/ttyutils.h +@@ -166,7 +166,11 @@ static inline void reset_virtual_console(struct termios *tp, int flags) + tp->c_oflag &= ~(OLCUC | OCRNL | ONOCR | ONLRET | OFILL | \ + NLDLY|CRDLY|TABDLY|BSDLY|VTDLY|FFDLY); + tp->c_lflag |= (ISIG | ICANON | IEXTEN | ECHO|ECHOE|ECHOK|ECHOKE|ECHOCTL); ++#ifdef __QNX__ ++ tp->c_lflag &= ~(ECHONL| NOFLSH | TOSTOP); ++#else + tp->c_lflag &= ~(ECHONL|ECHOPRT | NOFLSH | TOSTOP); ++#endif + + if ((flags & UL_TTY_KEEPCFLAGS) == 0) { + tp->c_cflag |= (CREAD | CS8 | HUPCL); +diff --git a/lib/logindefs.c b/lib/logindefs.c +index 4fee83957..1ce16dc9a 100644 +--- a/lib/logindefs.c ++++ b/lib/logindefs.c +@@ -26,7 +26,11 @@ + #include + #include + #include ++#ifdef __QNX__ ++#include ++#else + #include ++#endif + #include + #include + #include +diff --git a/lib/path.c b/lib/path.c +index a828aea49..9f5a46704 100644 +--- a/lib/path.c ++++ b/lib/path.c +@@ -868,7 +868,11 @@ int ul_path_read_majmin(struct path_cxt *pc, dev_t *res, const char *path) + if (rc != 2) + return -1; + if (res) ++#ifdef __QNX__ ++ *res = makedev(0, maj, min); ++#else + *res = makedev(maj, min); ++#endif + return 0; + } + +diff --git a/lib/sysfs.c b/lib/sysfs.c +index c888617b7..273834621 100644 +--- a/lib/sysfs.c ++++ b/lib/sysfs.c +@@ -876,7 +876,11 @@ static dev_t read_devno(const char *path) + return 0; + + if (fscanf(f, "%d:%d", &maj, &min) == 2) ++#ifdef __QNX__ ++ dev = makedev(0, maj, min); ++#else + dev = makedev(maj, min); ++#endif + fclose(f); + return dev; + } + diff --git a/extra/APKBUILD b/extra/APKBUILD new file mode 100644 index 00000000..56e06693 --- /dev/null +++ b/extra/APKBUILD @@ -0,0 +1,114 @@ +# Alpine-Contributor: Sören Tempel +# Alpine-Contributor: Leonardo Arena +# Alpine-Maintainer: Natanael Copa +# Maintainer: jscaffidi +pkgname=util-linux +pkgver=2.41.3 +pkgrel=0 +pkgdesc="Random collection of Linux utilities" +url="https://git.kernel.org/cgit/utils/util-linux/util-linux.git" +arch="all" +license="GPL-3.0-or-later AND GPL-2.0-or-later AND GPL-2.0-only AND + GPL-1.0-only AND LGPL-2.1-or-later AND BSD-1-Clause AND + BSD-3-Clause AND BSD-4-Clause-UC AND MIT AND Public-Domain" +subpackages=" + libuuid:_mv_lib + uuidgen:_mv_bin + " +# TODO + # $pkgname-bash-completion + # $pkgname-static + # $pkgname-dev + + +subpackages="$subpackages" +makedepends="ncurses-dev zlib-dev meson bison flex" +builddir="$srcdir/util-linux-$pkgver" +options="!check" + +case $pkgver in + *.*.*) _v=${pkgver%.*};; + *.*) _v=$pkgver;; +esac +source=" +https://www.kernel.org/pub/linux/utils/util-linux/v$_v/util-linux-$pkgver.tar.xz +ttydefaults.h +00-qnx-build.patch +" + +prepare() { + default_prepare + + mkdir -p "$builddir/sys" + + cp "$srcdir/ttydefaults.h" "$builddir/sys/ttydefaults.h" +} + +build() { + export C_INCLUDE_PATH="$C_INCLUDE_PATH:$builddir" + + echo "$C_INCLUDE_PATH" + + # Inspiration taken from https://cgit.freebsd.org/ports/tree/misc/libuuid since we are not linux, we don't support as much stuff + meson setup build \ + --auto-features=disabled \ + -Dallow-32bit-time=true \ + -Dbuild-libuuid=enabled\ + -Ddefault_library=both \ + -Dprogram-tests=false \ + -Dprefix=/usr \ + -Dsbindir=/usr/bin + + meson compile -C build +} + +package() { + DESTDIR="$pkgdir" meson install -C build +} + +_mv_bin() { + local binname=$subpkgname + pkgdesc="$binname tool from util-linux" + depends= + install_if="$pkgname=$pkgver-r$pkgrel" + + case "$binname" in + uuidgen) + license="GPL-1.0-only" + pkgdesc="UUID generator from util-linux" + ;; + esac + local dir; for dir in usr/bin usr/sbin bin sbin; do + if [ -e "$pkgdir"/$dir/$binname ]; then + amove $dir/$binname + return 0 + fi + done + return 1 +} + + +_mv_lib() { + local libname=$subpkgname + pkgdesc="$libname library from util-linux" + depends= + + echo "here1" + + case "$libname" in + libuuid) + license="BSD-3-Clause" + pkgdesc="DCE compatible Universally Unique Identifier library" + ;; + esac + echo "here2" + amove "usr/lib/$libname.so.*" + echo "here3" +} + + +sha512sums=" +3d299f0e05a4c982a04dbcbaaeff1222152feedf51c56c5dbdeb75999c68269d652a994f5cdf4c1ee42bb7b28475dd0792192c299fd9bc3b45198c5b153dad00 util-linux-2.41.3.tar.xz +feef9454b7865dc12b0f15e34b446555491f32be91ff34965ed390eddd74d6beeaea6221871a375f4b121afbe67e5eea0051a5ff5e01a6ef1d4c7ddf61d5defa ttydefaults.h +29d5928c5dbcafcb26f7efb8cd8019bb81109696458578b296fbd1a42b333637f85dd303c2edff54031410abbb23cddcf4b7f50c056a83a24dc3bb5ef981a9dd 00-qnx-build.patch +" diff --git a/extra/ttydefaults.h b/extra/ttydefaults.h new file mode 100644 index 00000000..0a63a56a --- /dev/null +++ b/extra/ttydefaults.h @@ -0,0 +1,105 @@ +/*- + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ttydefaults.h 8.4 (Berkeley) 1/21/94 + */ + +/* + * System wide defaults for terminal state. Linux version. + */ +#ifndef _SYS_TTYDEFAULTS_H_ +#define _SYS_TTYDEFAULTS_H_ + +/* + * QNX + */ +#define XTABS 0x1800 /* from termios.h TAB3 - expand tabs on output */ + +/* + * Defaults on "first" open. + */ +#define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY) +#define TTYDEF_OFLAG (OPOST | ONLCR | XTABS) +#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL) +#define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL) +#define TTYDEF_SPEED (B9600) + +/* + * Control Character Defaults + */ +#define CTRL(x) (x&037) +#define CEOF CTRL('d') +#ifdef _POSIX_VDISABLE +# define CEOL _POSIX_VDISABLE +#else +# define CEOL '\0' /* XXX avoid _POSIX_VDISABLE */ +#endif +#define CERASE 0177 +#define CINTR CTRL('c') +#ifdef _POSIX_VDISABLE +# define CSTATUS _POSIX_VDISABLE +#else +# define CSTATUS '\0' /* XXX avoid _POSIX_VDISABLE */ +#endif +#define CKILL CTRL('u') +#define CMIN 1 +#define CQUIT 034 /* FS, ^\ */ +#define CSUSP CTRL('z') +#define CTIME 0 +#define CDSUSP CTRL('y') +#define CSTART CTRL('q') +#define CSTOP CTRL('s') +#define CLNEXT CTRL('v') +#define CDISCARD CTRL('o') +#define CWERASE CTRL('w') +#define CREPRINT CTRL('r') +#define CEOT CEOF +/* compat */ +#define CBRK CEOL +#define CRPRNT CREPRINT +#define CFLUSH CDISCARD + +/* PROTECTED INCLUSION ENDS HERE */ +#endif /* !_SYS_TTYDEFAULTS_H_ */ + +/* + * #define TTYDEFCHARS to include an array of default control characters. + */ +#ifdef TTYDEFCHARS +cc_t ttydefchars[NCCS] = { + CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT, + _POSIX_VDISABLE, CINTR, CQUIT, CSUSP, CDSUSP, CSTART, CSTOP, CLNEXT, + CDISCARD, CMIN, CTIME, CSTATUS, _POSIX_VDISABLE +}; +#undef TTYDEFCHARS +#endif