Update to gcc11

Change to openssl
Clean up some `C` for HitchHiker specific utils
This commit is contained in:
Nathan Fisher 2022-01-28 11:44:56 -05:00
parent 6f7db66683
commit 2feff2a5d3
26 changed files with 30474 additions and 186 deletions

View File

@ -72,6 +72,7 @@ mpc-${mpc_version}.tar.gz \
mpfr-${mpfr_version}.tar.xz \
musl-$(musl_version).tar.gz \
musl-fts-$(musl-fts_version).tar.gz \
openssl-${openssl_version}.tar.gz \
ncurses-${ncurses_version}.tar.gz \
netbsd-curses-${netbsd-curses_version}.tar.xz \
ninja-${ninja_version}.tar.gz \
@ -440,6 +441,11 @@ ninja: ninja-${ninja_version}.tar.gz
ninja-${ninja_version}.tar.gz:
wget -c ${github}/ninja-build/ninja/archive/v${ninja_version}/$@
openssl: openssl-${openssl_version}.tar.gz
openssl-${openssl_version}.tar.gz:
wget -c https://www.openssl.org/source/$@
patch: patch-${patch_version}.tar.xz
patch-${patch_version}.tar.xz:

View File

@ -4,7 +4,7 @@
include versions.mk
os_name = Hitch Hiker Linux
os_abbrev = hhl
os_version = 2021q2
os_version = 2021q4
basedir = /src
include $(basedir)/config.mk
@ -68,7 +68,7 @@ objdir ?= $(global_objdir)/$(distfullname)
tooldir = $(basedir)/build/toolchain-$(arch)
export LC_ALL = POSIX
export PATH = $(tooldir)/bin:$(tooldir)/sbin:/usr/bin:/usr/sbin:/bin:/sbin
export PATH = $(tooldir)/bin:$(tooldir)/sbin:/usr/bin:/usr/bin/core_perl:/usr/sbin:/bin:/sbin
_dhcpcd ?= 1
_wireless ?= 1

View File

@ -9,7 +9,7 @@ attr_version = 2.4.48
autoconf_version = 2.71
automake_version = 1.16.3
bc_version = 3.2.5
binutils_version = 2.36.1
binutils_version = 2.37
bison_version = 3.7.5
busybox_version = 1.31.1
bzip2_version = 1.0.8
@ -25,11 +25,11 @@ elfutils_version = 0.182
eudev_version = 3.2.9
execline_version = 2.7.0.1
expat_version = 2.2.10
file_version = 5.39
file_version = 5.40
findutils_version = 4.8.0
flex_version = 2.6.4
gawk_version = 5.1.0
gcc_version = 10.2.0
gawk_version = 5.1.1
gcc_version = 11.2.0
gdbm_version = 1.19
gettext_version = 0.21
gettext-tiny_version = 0.3.2
@ -38,7 +38,7 @@ gmp_version = 6.2.1
gperf_version = 3.1
grep_version = 3.6
groff_version = 1.22.4
grub_version = 2.04
grub_version = 2.06
gzip_version = 1.10
haveged_version = 1.9.14
iana-etc_version = 20210115
@ -56,9 +56,9 @@ libnl_version = 3.5.0
libressl_version = 3.0.2
libtool_version = 2.4.6
libz_version = 1.2.8.2015.12.26
linux_version = 5.11.5
linux_version = 5.16.1
linux_rpi_version = 5.4.45
m4_version = 1.4.18
m4_version = 1.4.19
make_version = 4.3
man-pages_version = 5.10
mandoc_version = 1.14.5
@ -67,15 +67,16 @@ mpc_version = 1.2.1
mpfr_version = 4.1.0
musl_version = 1.2.2
musl-fts_version = 1.2.7
openssl_version = 3.0.1
ncurses_version = 6.2
netbsd-curses_version = 0.3.1
ninja_version = 1.10.2
patch_version = 2.7.6
pcre_version = 8.44
pcre_version = 8.45
perl_version = 5.32.1
perl-cross_version = 1.3.5
pkg-config_version = 0.29.2
pkgsrc_version = 2020Q2
pkgsrc_version = 2020Q3
procps-ng_version = 3.3.16
psmisc_version = 23.3
python_version = 3.9.1
@ -87,13 +88,13 @@ shadow_version = 4.8.1
skalibs_version = 2.10.0.1
sysklogd_version = 1.5.1
tar_version = 1.33
texinfo_version = 6.7
texinfo_version = 6.8
tzdata_version = 2021a
u-boot_version = 2021.01
udev-lfs_version = 20171102
util-linux_version = 2.36.1
vim_version = 8.2.2433
wget_version = 1.21.1
wget_version = 1.21.2
wireless_tools_version = 29
wpa_supplicant_version = 2.9
XML-Parser_version = 2.46

10438
kernel/config-x86-mine Normal file

File diff suppressed because it is too large Load Diff

9907
kernel/config-x86-mine.old Normal file

File diff suppressed because it is too large Load Diff

9952
kernel/config-x86_64-mine Normal file

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,9 @@ endif
ifeq ($(build_python), 1)
subdirs += python
endif
ifeq ($(build_file), 1)
subdirs += file
endif
subdirs += binutils
subdirs += gcc-pass1
subdirs += linux-headers

8
toolchain/file/Makefile Normal file
View File

@ -0,0 +1,8 @@
# Makefile - hhl - /usr/src/world/gawk
# Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com>
#
distname = file
distext = gz
include toolchain.mk
config_opts += --disable-nls
include targets.mk

View File

@ -44,10 +44,11 @@ subdirs += expat
subdirs += kmod
subdirs += gettext
# for musl
subdirs += argp-standalone
#subdirs += argp-standalone
subdirs += elfutils
subdirs += libffi
subdirs += libressl
#subdirs += libressl
subdirs += openssl
subdirs += wget
#subdirs += python
#subdirs += ninja
@ -65,8 +66,6 @@ subdirs += texinfo
subdirs += procps-ng
subdirs += util-linux
# for musl
#subdirs += argp-standalone
# for musl
#subdirs += musl-fts
subdirs += e2fsprogs
subdirs += haveged

View File

@ -29,7 +29,8 @@
#define _GNU_SOURCE // getline, getopt
#include <ctype.h> // isprint
#include <err.h> // err
#include <err.h> // err, perror
#include <errno.h> // errno
#include <inttypes.h> // uint*_t
#include <libgen.h> // basename
#include <stdio.h> // fclose, fopen, getline, nread, perror, printf
@ -87,6 +88,23 @@ void _head(char *file) {
}
}
long parselong(char *buf) {
errno = 0;
char *endptr;
int num = strtol(optarg, &endptr, 10);
if (errno != 0) {
perror("Error parsing integer from input: ");
exit(EXIT_FAILURE);
} else if (num == 0 && endptr == optarg) {
fprintf(stderr, "Error: invalid input: %s\n", optarg);
exit(EXIT_FAILURE);
} else if (*endptr != '\0') {
fprintf(stderr, "Error: invalid input: %s\n", optarg);
exit(EXIT_FAILURE);
}
return num;
}
int main(int argc, char *argv[]) {
int c, index;
__progname = basename(argv[0]);
@ -109,7 +127,7 @@ int main(int argc, char *argv[]) {
switch (c) {
case 'c':
cflag = 1;
chars = (int)strtol(optarg, NULL, 10);
chars = (int)parselong(optarg);
break;
case 'q':
qflag = 1;
@ -124,7 +142,7 @@ int main(int argc, char *argv[]) {
exit(EXIT_SUCCESS);
case 'n':
nflag = 1;
lines = (int)strtol(optarg, NULL, 10);
lines = (int)parselong(optarg);
break;
case '0':
case '1':

View File

@ -28,13 +28,13 @@
#define _DEFAULT_SOURCE
#include <sys/param.h>
#include <sys/param.h> // HOST_NAME_MAX
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <libgen.h> // basename
#include <stdio.h> // printf, fprintf
#include <stdlib.h> // exit
#include <string.h> // strlen
#include <unistd.h> // gethostname, sethostname, getopt
static const char *__progname;

View File

@ -2,6 +2,7 @@
# Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com>
#
distname = gcc
patches = gcc-nostdinc.patch
include world.mk
ifeq ($(arch),x86_64)

View File

@ -0,0 +1,11 @@
--- gcc-11.2.0.orig/configure 2021-07-28 02:55:06.628278148 -0400
+++ gcc-11.2.0.new/configure 2021-10-19 11:51:51.300514740 -0400
@@ -16478,7 +16478,7 @@
fi
-RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET"
+RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET -nostdinc++"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the target ar" >&5
$as_echo_n "checking where to find the target ar... " >&6; }

View File

@ -2,7 +2,6 @@
# Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com>
#
distname = m4
patches = m4-glibc-fixes.patch
include world.mk
config_opts += --host=$(tgt)
CFLAGS += --sysroot=$(DESTDIR)

View File

@ -1,107 +0,0 @@
diff -Naur m4-1.4.18.orig/lib/fflush.c m4-1.4.18/lib/fflush.c
--- m4-1.4.18.orig/lib/fflush.c 2016-12-31 08:54:41.000000000 -0500
+++ m4-1.4.18/lib/fflush.c 2020-05-19 16:21:43.578036277 -0400
@@ -33,7 +33,7 @@
#undef fflush
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
/* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */
static void
@@ -72,7 +72,7 @@
#endif
-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
+#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
# if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
@@ -148,7 +148,7 @@
if (stream == NULL || ! freading (stream))
return fflush (stream);
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
clear_ungetc_buffer_preserving_position (stream);
diff -Naur m4-1.4.18.orig/lib/fpending.c m4-1.4.18/lib/fpending.c
--- m4-1.4.18.orig/lib/fpending.c 2016-12-31 08:54:41.000000000 -0500
+++ m4-1.4.18/lib/fpending.c 2020-05-19 16:21:43.578036277 -0400
@@ -32,7 +32,7 @@
/* Most systems provide FILE as a struct and the necessary bitmask in
<stdio.h>, because they need it for implementing getc() and putc() as
fast macros. */
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
return fp->_IO_write_ptr - fp->_IO_write_base;
#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
diff -Naur m4-1.4.18.orig/lib/fpurge.c m4-1.4.18/lib/fpurge.c
--- m4-1.4.18.orig/lib/fpurge.c 2016-12-31 08:54:41.000000000 -0500
+++ m4-1.4.18/lib/fpurge.c 2020-05-19 16:21:43.578036277 -0400
@@ -62,7 +62,7 @@
/* Most systems provide FILE as a struct and the necessary bitmask in
<stdio.h>, because they need it for implementing getc() and putc() as
fast macros. */
-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
fp->_IO_read_end = fp->_IO_read_ptr;
fp->_IO_write_ptr = fp->_IO_write_base;
/* Avoid memory leak when there is an active ungetc buffer. */
diff -Naur m4-1.4.18.orig/lib/freadahead.c m4-1.4.18/lib/freadahead.c
--- m4-1.4.18.orig/lib/freadahead.c 2016-12-31 08:54:41.000000000 -0500
+++ m4-1.4.18/lib/freadahead.c 2020-05-19 16:21:43.578036277 -0400
@@ -25,7 +25,7 @@
size_t
freadahead (FILE *fp)
{
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
if (fp->_IO_write_ptr > fp->_IO_write_base)
return 0;
return (fp->_IO_read_end - fp->_IO_read_ptr)
diff -Naur m4-1.4.18.orig/lib/freading.c m4-1.4.18/lib/freading.c
--- m4-1.4.18.orig/lib/freading.c 2016-12-31 08:54:41.000000000 -0500
+++ m4-1.4.18/lib/freading.c 2020-05-19 16:21:43.578036277 -0400
@@ -31,7 +31,7 @@
/* Most systems provide FILE as a struct and the necessary bitmask in
<stdio.h>, because they need it for implementing getc() and putc() as
fast macros. */
-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
return ((fp->_flags & _IO_NO_WRITES) != 0
|| ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
&& fp->_IO_read_base != NULL));
diff -Naur m4-1.4.18.orig/lib/fseeko.c m4-1.4.18/lib/fseeko.c
--- m4-1.4.18.orig/lib/fseeko.c 2016-12-31 08:54:41.000000000 -0500
+++ m4-1.4.18/lib/fseeko.c 2020-05-19 16:21:43.578036277 -0400
@@ -47,7 +47,7 @@
#endif
/* These tests are based on fpurge.c. */
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
if (fp->_IO_read_end == fp->_IO_read_ptr
&& fp->_IO_write_ptr == fp->_IO_write_base
&& fp->_IO_save_base == NULL)
@@ -123,7 +123,7 @@
return -1;
}
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
fp->_flags &= ~_IO_EOF_SEEN;
fp->_offset = pos;
#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
diff -Naur m4-1.4.18.orig/lib/stdio-impl.h m4-1.4.18/lib/stdio-impl.h
--- m4-1.4.18.orig/lib/stdio-impl.h 2016-12-31 08:54:42.000000000 -0500
+++ m4-1.4.18/lib/stdio-impl.h 2020-05-19 16:21:43.601369662 -0400
@@ -138,3 +138,4 @@
# define _IOERR 0x10
#endif
+#define _IO_IN_BACKUP 0x100

37
world/openssl/Makefile Normal file
View File

@ -0,0 +1,37 @@
# Makefile - hhl - /usr/src/world/openssl
# Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com>
#
distname = openssl
distext = gz
include world.mk
config_cmd = cd $(objdir) && $(srcdir)/Configure $(config_opts)
export CFLAGS = --sysroot=$(DESTDIR)
ifeq (aarch64, $(arch))
config_opts += linux-aarch64
endif
ifeq (riscv64, $(arch))
config_opts += linux64-riscv64
endif
ifeq (x86_64, $(arch))
config_opts += linux-x86_64
endif
ifeq ($(filter i486 i586 i686, $(arch)), $(arch))
config_opts += linux-x86
endif
ifeq (i486, $(arch))
export CFLAGS = -latomic
endif
ifeq (armv7l, $(arch))
config_opts += linux-generic32
export CFLAGS = -latomic
endif
config_opts += --cross-compile-prefix=$(tgt)-
config_opts += --openssldir=/etc/ssl
config_opts += --libdir=/usr/lib
config_opts += shared
consif_opts += zlib-dynamic
include targets.mk

View File

@ -28,12 +28,11 @@
#define _GNU_SOURCE
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <dirent.h> // opendir, rewinddir, readdir
#include <stdio.h> // fopen, fclose, fwrite
#include <stdlib.h> // exit, srand
#include <string.h> // strncat, strcmp, strdup
#include <time.h> // time
#include "config.h"

View File

@ -28,12 +28,12 @@
#define _XOPEN_SOURCE
#include <err.h>
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <err.h> // err
#include <libgen.h> // basename
#include <stdio.h> // fprintf, puts
#include <stdlib.h> // exit
#include <string.h> // strlen, strcmp
#include <unistd.h> // getopt
static const char *__progname;

View File

@ -28,12 +28,11 @@
#define _XOPEN_SOURCE
#include <err.h>
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <err.h> // err
#include <libgen.h> // basename, dirname
#include <stdio.h> // fprintf, puts
#include <stdlib.h> // exit
#include <unistd.h> // getopt
static const char *__progname;

View File

@ -27,11 +27,11 @@
*/
#define _XOPEN_SOURCE
#include <ctype.h>
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h> // isprint
#include <libgen.h> // basename
#include <stdio.h> // fprintf
#include <stdlib.h> // exit
#include <unistd.h> // getopt, link
static const char *__progname;

View File

@ -28,13 +28,13 @@
#define _DEFAULT_SOURCE
#include <sys/sysinfo.h>
#include <sys/sysinfo.h> // get_nprocs, get_nprocs_conf
#include <ctype.h>
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h> // isprint
#include <libgen.h> // basename
#include <stdio.h> // fprintf, printf
#include <stdlib.h> // exit
#include <unistd.h> // getopt
static const char *__progname;

View File

@ -28,13 +28,12 @@
#define _DEFAULT_SOURCE
#include <err.h>
#include <libgen.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <err.h> // warn
#include <libgen.h> // basename
#include <limits.h> // realpath
#include <stdio.h> // fprintf
#include <stdlib.h> // exit, realpath
#include <unistd.h> // getopt, access
static const char *__progname;

View File

@ -27,13 +27,14 @@
*/
#define _XOPEN_SOURCE
#include <ctype.h>
#include <inttypes.h>
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h> // isprint
#include <errno.h> // errno
#include <stdint.h> // uint8_t
#include <libgen.h> // basename
#include <stdio.h> // fopen, fclose, fseek, ftell, fflush, fwrite
#include <stdlib.h> // exit, system
#include <string.h> // strcomp
#include <unistd.h> // getopt
static const char *__progname;
const int slice = 4096; // read/write 4k at a time
@ -204,6 +205,23 @@ int _unlinkit(char *file) {
}
}
long parselong(char *buf) {
errno = 0;
char *endptr;
int num = strtol(optarg, &endptr, 10);
if (errno != 0) {
perror("Error parsing integer from input: ");
exit(EXIT_FAILURE);
} else if (num == 0 && endptr == optarg) {
fprintf(stderr, "Error: invalid input: %s\n", optarg);
exit(EXIT_FAILURE);
} else if (*endptr != '\0') {
fprintf(stderr, "Error: invalid input: %s\n", optarg);
exit(EXIT_FAILURE);
}
return num;
}
int main(int argc, char *argv[]) {
unsigned int index;
unsigned int c;
@ -216,7 +234,7 @@ int main(int argc, char *argv[]) {
return 0;
break;
case 'n':
pass = strtol(optarg, NULL, 10);
pass = parselong(optarg);
break;
case 'S':
Sflag = 1;

View File

@ -28,11 +28,11 @@
#define _XOPEN_SOURCE
#include <ctype.h>
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h> // isprint
#include <libgen.h> // basename
#include <stdio.h> // fprintf, printf
#include <stdlib.h> // exit
#include <unistd.h> // getopt, unlink
static const char *__progname;
int vflag;

View File

@ -26,7 +26,7 @@
*
*/
#include <stdio.h>
#include <stdio.h> // puts
int main(int argc, char * argv[]) {
char * y;