live-bootstrap/steps/perl-5.10.1/mk/main.mk
fosslinux 6ed2e09f3a Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
  time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
  occuring when there is a change in kernel, but not from builder-hex0
  to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
  more difficult to understand.
- This puts everything down into one folder and has a manifest file that
  is used to generate the build scripts on the fly rather than using
  coded scripts.
- This is created in the "seed" stage.

stage0-posix -- (calls) --> seed -- (generates) --> main steps

Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.

- Creating a rootfs has become much simpler and is defined as code in
  go.sh. The new structure, for an about-to-be booted system, is

/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*

- There is no longer such a thing as /usr/include/musl, this didn't
  really make any sense, as musl is the final libc used. Rather, to
  separate musl and mes, we have /usr/include/mes, which is much easier
  to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
  checksum-transcriber, simple-patch, kexec-fiwix have all been given
  fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
  but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
  etc. This avoids manual definition of passes.
  - Ditto with patches; default directory is patches, but then any patch
    series specific to a pass are named patches-passX.
2023-12-15 21:43:19 +11:00

137 lines
3.6 KiB
Makefile

# SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-License-Identifier: GPL-3.0-or-later
# Note: This makefile is not currently parallel-safe.
VERSION=5.10.1
PRIVLIB_EXP=$(PREFIX)/lib/perl5/$(VERSION)
CC = gcc
AR = ar
CFLAGS = -DPRIVLIB_EXP=\"$(PRIVLIB_EXP)\" \
-DPERL_CORE=1 \
-I. \
-DVERSION=\"$(VERSION)\" \
-DNO_PPPORT_H
MINICFLAGS = -DPERL_EXTERNAL_GLOB
.PHONY: all
LIBPERL_SRC = av scope op doop doio dump gv hv mg reentr mro perl perly pp \
pp_hot pp_ctl pp_sys regcomp regexec utf8 sv taint toke util \
deb run universal xsutils pad globals perlio perlapi numeric \
mathoms locale pp_pack pp_sort
LIBPERL_OBJ = $(addsuffix .o, $(LIBPERL_SRC))
EXTENSIONS = File/Glob Digest/SHA Data/Dumper Cwd
EXTENSIONS_A := $(foreach f,$(EXTENSIONS), lib/auto/$f/$(notdir $f).a)
EXTENSIONS_PM = ext/File/Glob/Glob.pm ext/Digest/SHA/lib/Digest/SHA.pm \
ext/Data/Dumper/Dumper.pm
all: perl
# miniperl
opmini.c: op.c
cp op.c opmini.c
perlmini.c: perl.c
cp perl.c perlmini.c
generate_uudmap: generate_uudmap.o
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
uudmap.h: generate_uudmap
./generate_uudmap > $@
git_version.h: lib/Config_git.pl
lib/Config_git.pl:
perl make_patchnum.pl
globals.o: uudmap.h
perl.o: git_version.h
perlmini.o: git_version.h
libperl.a: $(LIBPERL_OBJ)
$(AR) cr $@ $^
miniperl: miniperlmain.o opmini.o perlmini.o libperl.a
$(CC) $(CFLAGS) $(MINICFLAGS) $^ $(LDFLAGS) -o $@
# An extremely dodgy hack
sed -i 's/va\.a\.a/v5.8.1/' miniperl
chmod +x miniperl
# full perl
lib/re.pm:
cp ext/re/re.pm lib/re.pm
lib/Config.pm: config.sh miniperl configpm lib/re.pm
./miniperl -Ilib configpm
writemain: writemain.SH
spitshell=cat eunicefix=true ./$<
perlmain.c: writemain $(EXTENSIONS_A)
./writemain $(EXTENSIONS_A) > $@
perl: perlmain.o libperl.a $(EXTENSIONS_A) lib/File/Glob.pm lib/Digest/SHA.pm \
lib/DynaLoader.pm lib/XSLoader.pm lib/Data/Dumper.pm
$(CC) $(CFLAGS) perlmain.o libperl.a $(EXTENSIONS_A) -o $@
# An extremely dodgy hack (v2)
sed -i 's/va\.a\.a/v5.8.1/' perl
chmod +x perl
# extensions
autosplit.pl: lib/re.pm lib/Config.pm miniperl
echo 'use AutoSplit; autosplit_lib_modules(@ARGV)' > $@
ext/DynaLoader/DynaLoader.pm: miniperl lib/Config.pm
./miniperl -Ilib ext/DynaLoader/DynaLoader_pm.PL DynaLoader.pm
mv DynaLoader.pm $@
ext/DynaLoader/XSLoader.pm: miniperl lib/Config.pm
./miniperl -Ilib ext/DynaLoader/XSLoader_pm.PL XSLoader.pm
mv XSLoader.pm $@
lib/DynaLoader.pm: ext/DynaLoader/DynaLoader.pm
install $< $@
lib/XSLoader.pm: ext/DynaLoader/XSLoader.pm
install $< $@
lib/File/Glob.pm: ext/File/Glob/Glob.pm
install $< $@
lib/Digest/SHA.pm: ext/Digest/SHA/lib/Digest/SHA.pm
install $< $@
lib/Data:
mkdir $@
lib/Data/Dumper.pm: ext/Data/Dumper/Dumper.pm lib/Data
install $< $@
define build_rule
lib/auto/$1/$(notdir $1).a: ext/$1/$(notdir $1).o $(patsubst %.c,%.o,$(wildcard ext/$1/*.c)) $(EXTENSIONS_PM)
mkdir -p lib/auto/$1
$(AR) cr lib/auto/$1/$(notdir $1).a ext/$1/$(notdir $1).o $(patsubst %.c,%.o,$(wildcard ext/$1/*.c))
ext/$1/$(notdir $1).c: miniperl lib/Config.pm
cd ext/$1; \
$(CURDIR)/miniperl -I$(CURDIR)/lib Makefile.PL; \
$(CURDIR)/miniperl -I$(CURDIR)/lib $(CURDIR)/lib/ExtUtils/xsubpp -noprototypes -typemap $(CURDIR)/lib/ExtUtils/typemap `echo $(notdir $1) | sed 's/.*-//'`.xs > $(notdir $1).c
endef
$(foreach f,$(EXTENSIONS),$(eval $(call build_rule,$f)))
install: all
install -D perl "$(DESTDIR)$(PREFIX)/bin/perl"
mkdir -p "$(DESTDIR)$(PRIVLIB_EXP)"
cp -r lib/* "$(DESTDIR)$(PRIVLIB_EXP)"