Skip to content

Commit

Permalink
ports: Update recipes to use new stripping method and misc changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mintsuki committed Dec 28, 2023
1 parent 3d5c52c commit 2cec0b2
Show file tree
Hide file tree
Showing 111 changed files with 331 additions and 125 deletions.
3 changes: 3 additions & 0 deletions host-recipes/autoconf
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ build() {

package() {
DESTDIR="${dest_dir}" make install

strip_command=strip \
post_package_strip
}
3 changes: 3 additions & 0 deletions host-recipes/autoconf-2.69
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ build() {

package() {
DESTDIR="${dest_dir}" make install

strip_command=strip \
post_package_strip
}
2 changes: 2 additions & 0 deletions host-recipes/autoconf-archive
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ revision=1
package() {
mkdir -p "${dest_dir}${prefix}"/share/aclocal
cp -r "${source_dir}"/m4/. "${dest_dir}${prefix}"/share/aclocal/

post_package_strip
}
5 changes: 4 additions & 1 deletion host-recipes/automake
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ build() {
}

package() {
DESTDIR="${dest_dir}" make install-strip
DESTDIR="${dest_dir}" make install

cp -pv /usr/local/share/autoconf/build-aux/config.sub "${dest_dir}${prefix}"/share/automake-1.16/
cp -pv /usr/local/share/autoconf/build-aux/config.guess "${dest_dir}${prefix}"/share/automake-1.16/

strip_command=strip \
post_package_strip
}
5 changes: 4 additions & 1 deletion host-recipes/binutils
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ build() {
}

package() {
DESTDIR="${dest_dir}" make install-strip
DESTDIR="${dest_dir}" make install

strip_command=strip \
post_package_strip
}
3 changes: 3 additions & 0 deletions host-recipes/cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ build() {
package() {
DESTDIR="${dest_dir}" make install
echo 'include(Platform/UnixPaths)' > "${dest_dir}${prefix}/share/cmake-3.27/Modules/Platform/Vinix.cmake"

strip_command=strip \
post_package_strip
}
3 changes: 3 additions & 0 deletions host-recipes/gcc
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ build() {
package() {
cd build
DESTDIR="${dest_dir}" make install-gcc

strip_command=strip \
post_package_strip
}
5 changes: 4 additions & 1 deletion host-recipes/libtool
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ build() {
}

package() {
DESTDIR="${dest_dir}" make install-strip
DESTDIR="${dest_dir}" make install

cp -pv /usr/local/share/autoconf/build-aux/config.sub "${dest_dir}${prefix}"/share/libtool/build-aux/
cp -pv /usr/local/share/autoconf/build-aux/config.guess "${dest_dir}${prefix}"/share/libtool/build-aux/

strip_command=strip \
post_package_strip
}
5 changes: 4 additions & 1 deletion host-recipes/limine
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ build() {
}

package() {
DESTDIR="${dest_dir}" make install-strip
DESTDIR="${dest_dir}" make install

strip_command=strip \
post_package_strip
}
5 changes: 4 additions & 1 deletion host-recipes/pkg-config
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build() {
}

package() {
DESTDIR="${dest_dir}" make install-strip
DESTDIR="${dest_dir}" make install
mkdir -p "${dest_dir}${prefix}/share/pkgconfig/personality.d"
cat <<EOF >"${dest_dir}${prefix}/share/pkgconfig/personality.d/${OS_TRIPLET}.personality"
Triplet: ${OS_TRIPLET}
Expand All @@ -22,4 +22,7 @@ SystemIncludePaths: ${sysroot_dir}/usr/include
SystemLibraryPaths: ${sysroot_dir}/usr/lib
EOF
ln -s pkgconf "${dest_dir}${prefix}/bin/${OS_TRIPLET}-pkg-config"

strip_command=strip \
post_package_strip
}
3 changes: 3 additions & 0 deletions host-recipes/v
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ package() {

mkdir -p "${dest_dir}${prefix}"/bin
ln -sf ../v/v "${dest_dir}${prefix}"/bin/v

strip_command=strip \
post_package_strip
}
5 changes: 4 additions & 1 deletion host-recipes/xorg-font-util
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ build() {
}

package() {
DESTDIR="${dest_dir}" make install-strip
DESTDIR="${dest_dir}" make install

strip_command=strip \
post_package_strip
}
5 changes: 4 additions & 1 deletion host-recipes/xorg-macros
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ build() {
}

package() {
DESTDIR="${dest_dir}" make install-strip
DESTDIR="${dest_dir}" make install

strip_command=strip \
post_package_strip
}
5 changes: 4 additions & 1 deletion host-recipes/xtrans
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ build() {
}

package() {
DESTDIR="${dest_dir}" make install-strip
DESTDIR="${dest_dir}" make install

strip_command=strip \
post_package_strip
}
16 changes: 16 additions & 0 deletions jinx-config
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ export CXXFLAGS="${CFLAGS}"

OS_TRIPLET=x86_64-vinix

post_package_strip() {
if [ -z "$strip_command" ]; then
strip_command=${OS_TRIPLET}-strip
fi

for f in $(find "${dest_dir}"); do
if file "$f" | grep 'not stripped' >/dev/null; then
echo "* stripping '$f'..."
stripped_file=$(mktemp)
$strip_command "$f" -o "$stripped_file"
chmod --reference="$f" "$stripped_file"
mv -f "$stripped_file" "$f"
fi
done
}

autotools_recursive_regen() {
for f in $(find . -name configure.ac); do
echo "* autotools regen in '$(dirname $f)'..."
Expand Down
2 changes: 1 addition & 1 deletion kernel/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ distclean: clean
.PHONY: install
install:
install -d "$(DESTDIR)$(PREFIX)/boot"
install -s --strip-program=x86_64-vinix-strip $(KERNEL) "$(DESTDIR)$(PREFIX)/boot/"
install $(KERNEL) "$(DESTDIR)$(PREFIX)/boot/"

blob.o: $(VFILES) freestanding_headers flanterm-c c/printf
$(V) $(VFLAGS) $(INTERNALVFLAGS) -o blob.c .
Expand Down
18 changes: 10 additions & 8 deletions patches/mlibc/jinx-working-patch.patch
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ index 524350c..c2e00db 100644
rtdl_include_dirs += include_directories('sysdeps/lyre/include')
diff --git mlibc-workdir/sysdeps/vinix/generic/entry.cpp mlibc-workdir/sysdeps/vinix/generic/entry.cpp
new file mode 100644
index 0000000..5345d0e
index 0000000..cadab22
--- /dev/null
+++ mlibc-workdir/sysdeps/vinix/generic/entry.cpp
@@ -0,0 +1,119 @@
@@ -0,0 +1,120 @@
+#include <stdint.h>
+#include <stdlib.h>
+#include <bits/ensure.h>
Expand All @@ -231,6 +231,7 @@ index 0000000..5345d0e
+void __mlibc_initLocale();
+
+extern "C" uintptr_t *__dlapi_entrystack();
+extern "C" void __dlapi_enter(uintptr_t *);
+
+extern char **environ;
+static mlibc::exec_stack_data __mlibc_stack_data;
Expand Down Expand Up @@ -329,10 +330,10 @@ index 0000000..5345d0e
+ __builtin_unreachable();
+}
+
+extern "C" void __mlibc_entry(int (*main_fn)(int argc, char *argv[], char *env[])) {
+extern "C" void __mlibc_entry(uintptr_t *entry_stack, int (*main_fn)(int argc, char *argv[], char *env[])) {
+ mlibc::sys_sigentry((void *)__mlibc_sigentry);
+
+ // TODO: call __dlapi_enter, otherwise static builds will break (see Linux sysdeps)
+ __dlapi_enter(entry_stack);
+ auto result = main_fn(__mlibc_stack_data.argc, __mlibc_stack_data.argv, environ);
+ exit(result);
+}
Expand Down Expand Up @@ -2680,15 +2681,16 @@ index 0000000..0713674
+
diff --git mlibc-workdir/sysdeps/vinix/x86_64/crt-src/crt0.S mlibc-workdir/sysdeps/vinix/x86_64/crt-src/crt0.S
new file mode 100644
index 0000000..d16a46f
index 0000000..9b77ee7
--- /dev/null
+++ mlibc-workdir/sysdeps/vinix/x86_64/crt-src/crt0.S
@@ -0,0 +1,7 @@
@@ -0,0 +1,8 @@
+.section .text
+.global _start
+_start:
+ mov $main, %rdi
+ call __mlibc_entry
+ mov %rsp, %rdi
+ mov $main, %rsi
+ call __mlibc_entry
+.section .note.GNU-stack,"",%progbits
+
diff --git mlibc-workdir/sysdeps/vinix/x86_64/crt-src/crti.S mlibc-workdir/sysdeps/vinix/x86_64/crt-src/crti.S
Expand Down
4 changes: 3 additions & 1 deletion recipes/bash
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ build() {
}

package() {
make install-strip DESTDIR="${dest_dir}"
make install DESTDIR="${dest_dir}"
ln -s bash "${dest_dir}${prefix}"/bin/sh

post_package_strip
}
4 changes: 3 additions & 1 deletion recipes/binutils
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ build() {
}

package() {
DESTDIR="${dest_dir}" make install-strip
DESTDIR="${dest_dir}" make install

# Remove unnecessary directory
rm -rf "${dest_dir}${prefix}"/${OS_TRIPLET}

# Remove static libraries
rm -rf "${dest_dir}${prefix}"/lib/*.a

post_package_strip
}
8 changes: 5 additions & 3 deletions recipes/bzip2
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ build() {

package() {
mkdir -p "${dest_dir}${prefix}/bin" "${dest_dir}${prefix}/lib" "${dest_dir}${prefix}/lib/pkgconfig" "${dest_dir}${prefix}/include"
install -s --strip-program=${OS_TRIPLET}-strip bzip2-shared "${dest_dir}${prefix}/bin/bzip2"
install -s --strip-program=${OS_TRIPLET}-strip bzip2recover "${dest_dir}${prefix}/bin/"
install -s --strip-program=${OS_TRIPLET}-strip libbz2.so.1.0.8 "${dest_dir}${prefix}/lib/"
install bzip2-shared "${dest_dir}${prefix}/bin/bzip2"
install bzip2recover "${dest_dir}${prefix}/bin/"
install libbz2.so.1.0.8 "${dest_dir}${prefix}/lib/"
install -m 644 bzlib.h "${dest_dir}${prefix}/include/"
ln -sf libbz2.so.1.0.8 "${dest_dir}${prefix}/lib/libbz2.so.1.0"
ln -sf libbz2.so.1.0 "${dest_dir}${prefix}/lib/libbz2.so.1"
Expand Down Expand Up @@ -56,4 +56,6 @@ Requires:
Libs: -L${prefix}/lib -lbz2
Cflags: -I${prefix}/include
EOF

post_package_strip
}
4 changes: 3 additions & 1 deletion recipes/coreutils
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ build() {
}

package() {
DESTDIR="${dest_dir}" make install-strip
DESTDIR="${dest_dir}" make install

post_package_strip
}
2 changes: 2 additions & 0 deletions recipes/cxxshim
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ build() {

package() {
DESTDIR="${dest_dir}" ninja install

post_package_strip
}
2 changes: 2 additions & 0 deletions recipes/dejavu
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ build() {
package() {
mkdir -p "${dest_dir}${prefix}/share/fonts/truetype"
cp -r ttf/* "${dest_dir}${prefix}/share/fonts/truetype/"

post_package_strip
}
4 changes: 3 additions & 1 deletion recipes/diffutils
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ build() {
}

package() {
DESTDIR="${dest_dir}" make install-strip
DESTDIR="${dest_dir}" make install

post_package_strip
}
4 changes: 3 additions & 1 deletion recipes/findutils
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ build() {
}

package() {
DESTDIR="${dest_dir}" make install-strip
DESTDIR="${dest_dir}" make install

post_package_strip
}
4 changes: 3 additions & 1 deletion recipes/fontconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ build() {
}

package() {
DESTDIR="${dest_dir}" make install-strip
DESTDIR="${dest_dir}" make install

post_package_strip
}
3 changes: 2 additions & 1 deletion recipes/freetype
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ build() {

package() {
DESTDIR="${dest_dir}" make install
${OS_TRIPLET}-strip "${dest_dir}${prefix}/lib/libfreetype.so.6.20.1"

post_package_strip
}
2 changes: 2 additions & 0 deletions recipes/frigg
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ build() {

package() {
DESTDIR="${dest_dir}" ninja install

post_package_strip
}
4 changes: 3 additions & 1 deletion recipes/gawk
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ build() {
}

package() {
DESTDIR="${dest_dir}" make install-strip
DESTDIR="${dest_dir}" make install

post_package_strip
}
4 changes: 3 additions & 1 deletion recipes/gcc
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ build() {
}

package() {
DESTDIR="${dest_dir}" make install-strip-gcc
DESTDIR="${dest_dir}" make install-gcc

ln -s gcc "${dest_dir}${prefix}"/bin/cc
# Remove static libraries
rm -rf "${dest_dir}${prefix}"/lib/*.a

post_package_strip
}
4 changes: 3 additions & 1 deletion recipes/gmp
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ build() {
}

package() {
DESTDIR="${dest_dir}" make install-strip
DESTDIR="${dest_dir}" make install

post_package_strip
}
4 changes: 3 additions & 1 deletion recipes/grep
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ build() {
}

package() {
DESTDIR="${dest_dir}" make install-strip
DESTDIR="${dest_dir}" make install

post_package_strip
}
4 changes: 3 additions & 1 deletion recipes/gzip
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ build() {
}

package() {
DESTDIR="${dest_dir}" make install-strip
DESTDIR="${dest_dir}" make install

post_package_strip
}
4 changes: 3 additions & 1 deletion recipes/init
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@ build() {

package() {
install -d "${dest_dir}/usr/bin"
install -s --strip-program=x86_64-vinix-strip init "${dest_dir}/usr/bin/"
install init "${dest_dir}/usr/bin/"

post_package_strip
}
Loading

0 comments on commit 2cec0b2

Please sign in to comment.