Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plan9perl setup.rc script update #22844

Open
wants to merge 1 commit into
base: blead
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 79 additions & 31 deletions plan9/setup.rc
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,103 @@
# appropriate permissions.
# First modified 6/30/96 by:
# Luther Huffman, Strategic Computer Solutions, Inc., [email protected]
# Last modified May 2020 by:
# Modified May 2020 by:
# David Romano, [email protected]
# Last Modified December 2024 by:
# e. alvarez, ~eax/[email protected]

# these default paths can be overridden by environment variables
if (! ~ $privroot '') privroot=/sys/lib/perl
if (! ~ $builddir '') builddir=`{cd .. ; pwd}

required_files = (plan9.c plan9ish.h mkfile ../patchlevel.h 9front.patch)
for(file in $required_files){
if (! test -e $file) {
echo 'Error: Required file not found: $file' >[1=2]
exit
}
}

# Get the Perl version information
awk -f versnum ../patchlevel.h
if (! test -e buildinfo) {
echo 'Error: buildinfo file is missing.' >[1=2]
exit
}
. buildinfo

builddir = `{ cd .. ; pwd }

# 'typestr' is used by /sys/src/cmd/cc/lex.c, but not sure when/if it is ever used.
# Patch sv.c from afar, which uses 'typestr' as a variable name, and uses bit-fields.
# Also patch some other things:
echo 'Applying patch...'
status=`{cd $builddir; ape/patch -p1 <plan9/9front.patch}
if (! ~ $status 0) {
echo 'Error: Patching failed.' >[1=2]
exit
}

if (~ $#* 0) platforms = $objtype
if not switch($1) {
case -a ; platforms = (386 68000 68020 arm arm amd64 mips power power64 sparc sparc64 spim)
case * ; echo 'Usage: setup.rc [-a]' >[1=2] ; exit
case -a ; platforms = (386 68000 68020 arm arm amd64 mips power power64 sparc sparc64 spim)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'arm' value is listed twice.

case * ; echo 'Usage: setup.rc [-a]' >[1=2] ; exit
}

# Update some files
echo 'Updating build files...'
cp plan9.c plan9ish.h mkfile $builddir
if (! ~ $? 0) {
echo 'Error: Failed to copy files to build directory.' >[1=2]
exit
}

exit;
# Why is this done during setup and not during 'mk install'?
# Build library directories
echo Building library directories ...
privroot=/sys/lib/perl
echo 'Creating library directories...'
privlib=$privroot/$p9pvers
sitelib=$privlib/site_perl

if (test ! -d $privroot) mkdir $privroot
if (test ! -d $privlib) mkdir $privlib
if (test ! -d $privlib/auto) mkdir $privlib/auto
if (test ! -d $sitelib) mkdir $sitelib
for(dir in $privroot $privlib $privlib/auto $sitelib){
if (! test -d $dir) {
mkdir $dir
if (! ~ $? 0) {
echo 'Error: Failed to create directory: $dir' >[1=2]
exit
}
}
}

for(i in $platforms){
archroot=/$i/lib/perl
archlib=$archroot/$p9pvers
sitearch=$archlib/site_perl
corelib=$archlib/CORE
arpalib=$corelib/arpa
if (test ! -d $archroot) mkdir $archroot
if (test ! -d $archlib) mkdir $archlib
if (test ! -d $sitearch) mkdir $sitearch
if (test ! -d $corelib) mkdir $corelib
if (test ! -d $arpalib) mkdir $arpalib
cp $builddir/*.h *.h $corelib
cp arpa/*.h $arpalib
}

# Populate library directories
echo "Creating directories for platform: $i..."
archroot=/$i/lib/perl
archlib=$archroot/$p9pvers
sitearch=$archlib/site_perl
corelib=$archlib/CORE
arpalib=$corelib/arpa

for(dir in $archroot $archlib $sitearch $corelib $arpalib){
if (! test -d $dir) {
mkdir $dir
if (! ~ $? 0) {
echo 'Error: Failed to create directory: $dir' >[1=2]
exit
}
}
}

cp $builddir/*.h *.h $corelib
if (! ~ $? 0) {
echo 'Error: Failed to copy header files to $corelib' >[1=2]
exit
}
cp arpa/*.h $arpalib
if (! ~ $? 0) {
echo 'Error: Failed to copy arpa headers to $arpalib' >[1=2]
exit
}
}

echo 'Populating private libraries...'
{cd $builddir/lib ; tar c . } | {cd $privlib ; tar x }
if (! ~ $? 0) {
echo 'Error: Failed to populate private libraries.' >[1=2]
exit
}

echo 'Setup completed successfully.'

Loading