openbsd.makedev: init (#360332)
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
diff --git a/etc/MAKEDEV.common b/etc/MAKEDEV.common
|
||||
index 1e7bb3d235a..1cc64a38985 100644
|
||||
--- a/etc/MAKEDEV.common
|
||||
+++ b/etc/MAKEDEV.common
|
||||
@@ -315,10 +315,10 @@ _mkdev(pty, pty*, {-if [ $U -gt 15 ]; then
|
||||
echo bad unit for pty in: $i
|
||||
continue
|
||||
fi
|
||||
- set -A letters p q r s t u v w x y z P Q R S T
|
||||
- set -A suffixes 0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q \
|
||||
+ letters=(p q r s t u v w x y z P Q R S T)
|
||||
+ suffixes=(0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q \
|
||||
r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X \
|
||||
- Y Z
|
||||
+ Y Z)
|
||||
|
||||
name=${letters[$U]}
|
||||
n=0
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
mkDerivation,
|
||||
runtimeShell,
|
||||
m4,
|
||||
}:
|
||||
|
||||
mkDerivation {
|
||||
pname = "MAKEDEV";
|
||||
path = "etc";
|
||||
|
||||
patches = [ ./bash.patch ];
|
||||
|
||||
extraNativeBuildInputs = [
|
||||
m4
|
||||
];
|
||||
|
||||
preBuild = ''
|
||||
mkdir -p $out/share/doc
|
||||
'';
|
||||
buildTargets = [ "MAKEDEV" ];
|
||||
|
||||
# patch some build artifacts
|
||||
# gnu m4 doesn't seem to recognize the expr() macro but it's only used for simple arithmetic so we convert it to bash
|
||||
postBuild = ''
|
||||
substituteInPlace etc.$TARGET_MACHINE_ARCH/MAKEDEV --replace-fail "/bin/sh -" "${runtimeShell}"
|
||||
sed -E -i -e '/^PATH=.*/d' -e 's/expr\((.*)\)/$((\1))/g' etc.$TARGET_MACHINE_ARCH/MAKEDEV
|
||||
'';
|
||||
|
||||
# The install procedure is also weird since this is supposed to live in /dev
|
||||
postInstall = ''
|
||||
mkdir -p $out/bin
|
||||
cp etc.$TARGET_MACHINE_ARCH/MAKEDEV $out/bin
|
||||
chmod +x $out/bin/MAKEDEV
|
||||
'';
|
||||
|
||||
meta.mainProgram = "MAKEDEV";
|
||||
}
|
||||
Reference in New Issue
Block a user