• Stars
    star
    165
  • Rank 224,407 (Top 5 %)
  • Language
    C
  • License
    Other
  • Created over 6 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Alternative to GNU coreutils using software from FreeBSD

bsdutils

This project contains a GNU coreutils-like collection of utilities from the FreeBSD source code tree.

The project began in October 2017 and initially ported code from the OpenBSD source tree. The original objective was to see how much work was involved and to compare relative sizes of built executables with those found in GNU coreutils and other projects. In an effort to gain more featureful BSD commands and to possibly work more easily with dotfiles for users on MacOS X systems, the project started over by porting the commands from FreeBSD in April 2021.

Importing A New Release Of FreeBSD

When a new release of FreeBSD is made, the import-src.sh script should be used to update the source tree. First edit upstream.conf and then run the import-src.sh script. The script will fetch the new release source and copy in the source for the commands we have. Any patches in patches/ will be applied. These may need updating between releases, so keep that in mind. The workflow is basically:

  1. Change VER in upstream.conf

  2. Verify URL in upstream.conf works (FreeBSD may move things around).

  3. Run ./import-src.sh.

  4. Do an initial commit of this import and tag it as X.Y-RELEASE-import. For example, importing source from FreeBSD 13.1 would have a tag named 13.1-RELEASE-import in the tree.

    • NOTE: The tree should have Makefile.bsd files in it right now, but those should not be committed. Leave them in place for now.
  5. Use git to gather the changes between the previous X.[Y-1]-RELEASE-import tag and the previous commit. Apply these to the tree now. This is mostly easy, but some patches will have to be manually applied. What I tend to do is generate a large patch with git and then run splitdiff on that to get individual patches for each source file. I then have a script that tries to apply each of those and for any that fail, I retain them. If the patch applied successfully, I remove the patch. The remaining set I need to apply by hand.

  6. After applying patches, run make. Fix anything that fails. This is the step that updates the patches for the new FreeBSD source.

  7. Now check each Makefile.bsd file to see if our meson.build files need updating. There may be new compiler flags or macros to define. Likewise there may be new source files that should be listed. Use this step to also remove any source files that no longer exist (the Makefile.bsd file won't reference the file, so you can remove it and update the meson.build file).

  8. Now commit these changes.

Push the changes and check that CI passes. After some testing, it's probably time for a release.

Build Requirements

You will need GNU-compatible C and C++ compilers, typically gcc/g++ or clang/clang++. You will also need flex (or some other lex as long as it is compatible with flex), byacc or bison, meson and ninja/samurai. If you wish to use the top-level Makefile (which is just a simple wrapper around meson), you will need GNU make. Most distributions have all these tools already available in their repositories.

gcc/g++        https://gcc.gnu.org/
clang/clang++  https://llvm.org/
GNU make       https://www.gnu.org/software/make/
meson          https://mesonbuild.com/
ninja          https://ninja-build.org/
flex           https://github.com/westes/flex
byacc          https://invisible-island.net/byacc/byacc.html

Additionally you will need the following shared libraries to build all of the programs in this project:

terminfo       https://invisible-mirror.net/archives/ncurses/
libedit        http://thrysoee.dk/editline/
openssl        https://www.openssl.org/
libxo          https://github.com/Juniper/libxo

The terminfo library may be either standalone (libtinfo) or a part of the curses library, dependending on build. The ls(1) command needs this. bc(1) needs libedit, which is the BSD alternative to GNU readline. dc(1) uses libcrypto which comes from OpenSSL. seq(1) needs libm, but that comes from your C library. df(1) and wc(1) use libxo for outputting to multiple formats.

Users of musl-based Linux systems also need libfts and librpmatch installed.

Bugs

Probably. The FreeBSD code is pretty solid. But remember this project is a port of that code to Linux systems. Pull requests welcome for any bugs found. Also you can just open an issue on the project page and we will try to get to it.

More Repositories

1

pyparted

Python bindings for GNU parted (libparted)
C
83
star
2

pycoreutils

Python implementation of basic Unix utilities, modeled to support GNU coreutils features.
Python
52
star
3

vpncwatch

vpnc keepalive daemon for Linux systems
C
38
star
4

ldap-for-dhcp

OpenLDAP support for dhcpd in ISC dhcp
Perl
25
star
5

darwin-free

Command line memory status tool for MacOS X, similar to free(1) on Linux.
C
15
star
6

netstat

Fork of Linux net-tools and reduced to just netstat(8)
C
5
star
7

denag

Suppress the MIPSpro license nag screen when invoking cc, CC, or c89 on IRIX
Shell
5
star
8

guests

qemu virtual guest management script for OpenBSD
4
star
9

radiofiles

Motorola radio codeplugs, notes, and other files
4
star
10

mystuff

My local OpenBSD ports collection (/usr/ports/mystuff)
Shell
2
star
11

.dotfiles

Configuration files for my home directory. See .dotfiles/README for more info.
Python
2
star
12

backup-tools

My scripts and config files for my local backup system.
Shell
2
star
13

socialfixer

Social Fixer configuration
JavaScript
1
star
14

cvs

Concurrent Versions System
C
1
star
15

historical-linux

Historical Linux distributions and scripts to use them in qemu
1
star
16

warhw

C
1
star
17

no

Forbid installation of software on yum-based systems by package name or author.
Python
1
star
18

dcsysvinit

The classic Linux sysvinit software, updated for the 21st century.
C
1
star
19

kmod

Fork of the Linux kmod project ported to build and run on macOS. Obviously without module loading and unloading, but modinfo and related functions work if you want to examine built Linux kernel modules on macOS.
C
1
star