Recipe for sed

This commit is contained in:
Ian Douglas Scott 2017-07-13 16:24:17 -07:00
parent 53653625f3
commit 81afdbacab
No known key found for this signature in database
GPG Key ID: 4924E10E199B5959
2 changed files with 73 additions and 0 deletions

37
recipes/sed/recipe.sh Normal file
View File

@ -0,0 +1,37 @@
VERSION=4.4
TAR=http://ftp.gnu.org/gnu/sed/sed-$VERSION.tar.xz
HOST=x86_64-elf-redox
function recipe_version {
echo "$VERSION"
skip=1
}
function recipe_update {
echo "skipping update"
skip=1
}
function recipe_build {
autoreconf
./configure --host=${HOST} --prefix=/
make
skip=1
}
function recipe_test {
echo "skipping test"
skip=1
}
function recipe_clean {
make clean
skip=1
}
function recipe_stage {
dest="$(realpath $1)"
make DESTDIR="$dest" install
skip=1
}

36
recipes/sed/sed.patch Normal file
View File

@ -0,0 +1,36 @@
diff -ru source/lib/getprogname.c source-new/lib/getprogname.c
--- source/lib/getprogname.c 2017-01-16 21:36:00.000000000 -0800
+++ source-new/lib/getprogname.c 2017-07-13 16:13:35.966956860 -0700
@@ -43,13 +43,11 @@
# include <string.h>
#endif
-#ifdef __sgi
# include <string.h>
# include <unistd.h>
# include <stdio.h>
# include <fcntl.h>
-# include <sys/procfs.h>
-#endif
+# include <limits.h>
#include "dirname.h"
@@ -178,7 +176,16 @@
}
return NULL;
# else
-# error "getprogname module not ported to this OS"
+ char filename[PATH_MAX];
+ int fd = open ("sys:exe", O_RDONLY);
+ if (fd > 0) {
+ int len = read(fd, filename, PATH_MAX-1);
+ if (len > 0) {
+ filename[len] = '\0';
+ return strdup(filename);
+ }
+ }
+ return NULL;
# endif
}