lang/gcc/8: include all libs in adastrap

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

lang/gcc/8: include all libs in adastrap

Christian Weisgerber
The adastrap depends on several libraries (libc, libm, libz, libgmp,
libmpfr, libmpc), but currently only libc and libm ship with it.
If one of the other libs changes, boom, the build breaks.  Also,
having to manually specify the library versions in the Makefile is
cumbersome.

I have revised the adastrap build such that it extract the list of
required shared libraries directly from the cc1 binary and includes
all of them in the new bootstrap.  I successfully built a new
adastrap with this and used it to re-build gcc.

OK?

Once this is in, new adastraps should be built for all architectures.
(I can do aarch64, amd64, and maybe i386.)

The trigger for all of this is that I would like to update libmpfr
and libmpc...


Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/gcc/8/Makefile,v
retrieving revision 1.23
diff -u -p -r1.23 Makefile
--- Makefile 7 Sep 2019 23:32:43 -0000 1.23
+++ Makefile 8 Nov 2019 20:14:15 -0000
@@ -20,26 +20,12 @@ REVISION = 4
 FULL_VERSION = $V
 FULL_PKGVERSION = $V
 
-ADASTRAP_LIBC-amd64 = 95.1
-ADASTRAP_LIBM-amd64 = 10.1
 ADASTRAP-amd64 = adastrap-amd64-$V-1.tar.xz
-ADASTRAP_LIBC-arm = 88.0
-ADASTRAP_LIBM-arm = 9.0
 ADASTRAP-arm = adastrap-arm-4.9.4-0.tar.xz
-ADASTRAP_LIBC-hppa = 95.0
-ADASTRAP_LIBM-hppa = 10.1
 ADASTRAP-hppa = adastrap-hppa-$V-0.tar.xz
-ADASTRAP_LIBC-i386 = 95.1
-ADASTRAP_LIBM-i386 = 10.1
 ADASTRAP-i386 = adastrap-i386-$V-1.tar.xz
-ADASTRAP_LIBC-mips64 = 95.1
-ADASTRAP_LIBM-mips64 = 10.1
 ADASTRAP-mips64 = adastrap-mips64-$V-0.tar.xz
-ADASTRAP_LIBC-powerpc = 95.1
-ADASTRAP_LIBM-powerpc = 10.1
 ADASTRAP-powerpc = adastrap-powerpc-$V-1.tar.xz
-ADASTRAP_LIBC-sparc64 = 93.0
-ADASTRAP_LIBM-sparc64 = 10.1
 ADASTRAP-sparc64 = adastrap-sparc64-6.5.0-0.tar.xz
 
 PKGNAME-main =  gcc-${FULL_PKGVERSION}
@@ -258,33 +244,19 @@ ADA_PACKAGE = ${PACKAGE_REPOSITORY}/${MA
 GCC_PACKAGE = ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all/${FULLPKGNAME-main}.tgz
 GXX_PACKAGE = ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all/${FULLPKGNAME-c++}.tgz
 
+.PHONY: adastrap
+
 adastrap: ${ADA_PACKAGE} ${GCC_PACKAGE} ${GXX_PACKAGE}
-.if !defined(ADASTRAP_LIBC-${MACHINE_ARCH}) || \
- !defined(ADASTRAP_LIBM-${MACHINE_ARCH})
- @echo 1>&2 "Error: you must specify libc and libm to bundle"
- @exit 1
-.else
  mkdir -p ${WRKDIR}/prepare/bootstrap/system-libs
- cp /usr/lib/libc.so.${ADASTRAP_LIBC-${MACHINE_ARCH}} \
- ${WRKDIR}/prepare/bootstrap/system-libs
- cp /usr/lib/libm.so.${ADASTRAP_LIBM-${MACHINE_ARCH}} \
- ${WRKDIR}/prepare/bootstrap/system-libs
- cd ${WRKDIR}/prepare/bootstrap && tar zxf ${ADA_PACKAGE}
- cd ${WRKDIR}/prepare/bootstrap && tar zxf ${GCC_PACKAGE}
- cd ${WRKDIR}/prepare/bootstrap && tar zxf ${GXX_PACKAGE}
+ cd ${WRKDIR}/prepare/bootstrap && tar xzf ${ADA_PACKAGE}
+ cd ${WRKDIR}/prepare/bootstrap && tar xzf ${GCC_PACKAGE}
+ cd ${WRKDIR}/prepare/bootstrap && tar xzf ${GXX_PACKAGE}
  rm -rf ${WRKDIR}/prepare/bootstrap/{+*,info,man,share}
- rm -rf ${WRKDIR}/prepare/bootstrap/lib/gcc/*-unknown-openbsd*/$V/include-fixed
- if ! ldd ${WRKDIR}/prepare/bootstrap/bin/egcc | \
- fgrep libc.so.${ADASTRAP_LIBC-${MACHINE_ARCH}} >/dev/null; then \
- echo 1>&2 "Error: adastrap egcc linked against unbundled libc"; \
- exit 1; \
- fi
- if ! ldd ${WRKDIR}/prepare/bootstrap/bin/egcc | \
- fgrep libm.so.${ADASTRAP_LIBM-${MACHINE_ARCH}} >/dev/null; then \
- echo 1>&2 "Error: adastrap egcc linked against unbundled libm"; \
- exit 1; \
- fi
+ rm -rf ${WRKDIR}/prepare/bootstrap/lib/gcc/*-openbsd*/$V/include-fixed
+ for f in \
+    `ldd ${WRKDIR}/prepare/bootstrap/libexec/gcc/*-openbsd*/$V/cc1 | \
+    awk '$$3 == "rlib" { print $$7 }'`; do \
+ cp $$f ${WRKDIR}/prepare/bootstrap/system-libs/; \
+ done
  cd ${WRKDIR}/prepare && tar cf - bootstrap | \
- xz > ${FULLDISTDIR}/${ADASTRAP-${MACHINE_ARCH}}
-.endif
-
+ xz -T0 > ${FULLDISTDIR}/${ADASTRAP-${MACHINE_ARCH}}
--
Christian "naddy" Weisgerber                          [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: lang/gcc/8: include all libs in adastrap

Stuart Henderson
On 2019/11/08 21:27, Christian Weisgerber wrote:

> The adastrap depends on several libraries (libc, libm, libz, libgmp,
> libmpfr, libmpc), but currently only libc and libm ship with it.
> If one of the other libs changes, boom, the build breaks.  Also,
> having to manually specify the library versions in the Makefile is
> cumbersome.
>
> I have revised the adastrap build such that it extract the list of
> required shared libraries directly from the cc1 binary and includes
> all of them in the new bootstrap.  I successfully built a new
> adastrap with this and used it to re-build gcc.
>
> OK?

Yes please, I think I've had problems with this in the past, and this is
in line with other ports shipping bootstraps. OK

Reply | Threaded
Open this post in threaded view
|

Re: lang/gcc/8: include all libs in adastrap

Pascal Stumpf-2
In reply to this post by Christian Weisgerber
On Fri, 8 Nov 2019 21:27:08 +0100, Christian Weisgerber wrote:

> The adastrap depends on several libraries (libc, libm, libz, libgmp,
> libmpfr, libmpc), but currently only libc and libm ship with it.
> If one of the other libs changes, boom, the build breaks.  Also,
> having to manually specify the library versions in the Makefile is
> cumbersome.
>
> I have revised the adastrap build such that it extract the list of
> required shared libraries directly from the cc1 binary and includes
> all of them in the new bootstrap.  I successfully built a new
> adastrap with this and used it to re-build gcc.
>
> OK?

This looks good.  OK.

> Once this is in, new adastraps should be built for all architectures.
> (I can do aarch64, amd64, and maybe i386.)

I'll get on it for powerpc, hppa and arm.  visa@, can you look at
mips64?

> The trigger for all of this is that I would like to update libmpfr
> and libmpc...
>
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/lang/gcc/8/Makefile,v
> retrieving revision 1.23
> diff -u -p -r1.23 Makefile
> --- Makefile 7 Sep 2019 23:32:43 -0000 1.23
> +++ Makefile 8 Nov 2019 20:14:15 -0000
> @@ -20,26 +20,12 @@ REVISION = 4
>  FULL_VERSION = $V
>  FULL_PKGVERSION = $V
>  
> -ADASTRAP_LIBC-amd64 = 95.1
> -ADASTRAP_LIBM-amd64 = 10.1
>  ADASTRAP-amd64 = adastrap-amd64-$V-1.tar.xz
> -ADASTRAP_LIBC-arm = 88.0
> -ADASTRAP_LIBM-arm = 9.0
>  ADASTRAP-arm = adastrap-arm-4.9.4-0.tar.xz
> -ADASTRAP_LIBC-hppa = 95.0
> -ADASTRAP_LIBM-hppa = 10.1
>  ADASTRAP-hppa = adastrap-hppa-$V-0.tar.xz
> -ADASTRAP_LIBC-i386 = 95.1
> -ADASTRAP_LIBM-i386 = 10.1
>  ADASTRAP-i386 = adastrap-i386-$V-1.tar.xz
> -ADASTRAP_LIBC-mips64 = 95.1
> -ADASTRAP_LIBM-mips64 = 10.1
>  ADASTRAP-mips64 = adastrap-mips64-$V-0.tar.xz
> -ADASTRAP_LIBC-powerpc = 95.1
> -ADASTRAP_LIBM-powerpc = 10.1
>  ADASTRAP-powerpc = adastrap-powerpc-$V-1.tar.xz
> -ADASTRAP_LIBC-sparc64 = 93.0
> -ADASTRAP_LIBM-sparc64 = 10.1
>  ADASTRAP-sparc64 = adastrap-sparc64-6.5.0-0.tar.xz
>  
>  PKGNAME-main =  gcc-${FULL_PKGVERSION}
> @@ -258,33 +244,19 @@ ADA_PACKAGE = ${PACKAGE_REPOSITORY}/${MA
>  GCC_PACKAGE = ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all/${FULLPKGNAME-main}.tgz
>  GXX_PACKAGE = ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all/${FULLPKGNAME-c++}.tgz
>  
> +.PHONY: adastrap
> +
>  adastrap: ${ADA_PACKAGE} ${GCC_PACKAGE} ${GXX_PACKAGE}
> -.if !defined(ADASTRAP_LIBC-${MACHINE_ARCH}) || \
> - !defined(ADASTRAP_LIBM-${MACHINE_ARCH})
> - @echo 1>&2 "Error: you must specify libc and libm to bundle"
> - @exit 1
> -.else
>   mkdir -p ${WRKDIR}/prepare/bootstrap/system-libs
> - cp /usr/lib/libc.so.${ADASTRAP_LIBC-${MACHINE_ARCH}} \
> - ${WRKDIR}/prepare/bootstrap/system-libs
> - cp /usr/lib/libm.so.${ADASTRAP_LIBM-${MACHINE_ARCH}} \
> - ${WRKDIR}/prepare/bootstrap/system-libs
> - cd ${WRKDIR}/prepare/bootstrap && tar zxf ${ADA_PACKAGE}
> - cd ${WRKDIR}/prepare/bootstrap && tar zxf ${GCC_PACKAGE}
> - cd ${WRKDIR}/prepare/bootstrap && tar zxf ${GXX_PACKAGE}
> + cd ${WRKDIR}/prepare/bootstrap && tar xzf ${ADA_PACKAGE}
> + cd ${WRKDIR}/prepare/bootstrap && tar xzf ${GCC_PACKAGE}
> + cd ${WRKDIR}/prepare/bootstrap && tar xzf ${GXX_PACKAGE}
>   rm -rf ${WRKDIR}/prepare/bootstrap/{+*,info,man,share}
> - rm -rf ${WRKDIR}/prepare/bootstrap/lib/gcc/*-unknown-openbsd*/$V/include-fixed
> - if ! ldd ${WRKDIR}/prepare/bootstrap/bin/egcc | \
> - fgrep libc.so.${ADASTRAP_LIBC-${MACHINE_ARCH}} >/dev/null; then \
> - echo 1>&2 "Error: adastrap egcc linked against unbundled libc"; \
> - exit 1; \
> - fi
> - if ! ldd ${WRKDIR}/prepare/bootstrap/bin/egcc | \
> - fgrep libm.so.${ADASTRAP_LIBM-${MACHINE_ARCH}} >/dev/null; then \
> - echo 1>&2 "Error: adastrap egcc linked against unbundled libm"; \
> - exit 1; \
> - fi
> + rm -rf ${WRKDIR}/prepare/bootstrap/lib/gcc/*-openbsd*/$V/include-fixed
> + for f in \
> +    `ldd ${WRKDIR}/prepare/bootstrap/libexec/gcc/*-openbsd*/$V/cc1 | \
> +    awk '$$3 == "rlib" { print $$7 }'`; do \
> + cp $$f ${WRKDIR}/prepare/bootstrap/system-libs/; \
> + done
>   cd ${WRKDIR}/prepare && tar cf - bootstrap | \
> - xz > ${FULLDISTDIR}/${ADASTRAP-${MACHINE_ARCH}}
> -.endif
> -
> + xz -T0 > ${FULLDISTDIR}/${ADASTRAP-${MACHINE_ARCH}}
> --
> Christian "naddy" Weisgerber                          [hidden email]