Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d3590221
Commit
d3590221
authored
Oct 09, 2000
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated version from Donn Cave <donn@oz.net>.
This closes SourceForge patch #101778.
parent
04f4943d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
151 deletions
+58
-151
BeOS/ar-fake
BeOS/ar-fake
+58
-151
No files found.
BeOS/ar-fake
View file @
d3590221
#!
/bin/sh
#!/bin/sh
#
# Fake "ar" to build the Python shared library on BeOS. This "ar"
# manipulates a .ar-libname file listing all the objects and regenerates
# the shared lib every time it's called. This is probably only suitable
# for things that get built like Python, and you'll probably have to make
# some small modifications here and there.
# Truly fake ar, using a directory to store object files.
#
# This stupid hackery is necessary due to the brain-damaged __declspec()
# semantics on x86; on PowerPC, we could just build a static library
# and turn that into a shared library using an exports list. On x86, you'd
# need to use a fake table of pointers to every symbol you wanted to
# export, otherwise you'd end up with an empty shared lib. This is
# progress?
#
# Called via:
#
# ar-fake cr lib-name objects
# ar-fake d lib-name objects
#
# This fake "ar" DOES NOT support any other POSIX "ar" commands! DO NOT
# expect it to behave very intelligently, it's designed to build Python,
# not any old shared lib.
AR_COMMAND
=
$1
;
shift
AR_LIB
=
$1
;
shift
AR_LIB_NAME
=
$(
basename
$AR_LIB
)
AR_SO_LIB_NAME
=
${
AR_LIB_NAME
/.a/.so
}
AR_LIB_PATH
=
${
AR_LIB
/
$AR_LIB_NAME
/
}
if
[
"
$AR_LIB_PATH
"
=
""
]
;
then
AR_LIB_PATH
=
"."
fi
AR_CRUD
=
${
AR_LIB_PATH
}
/.ar-
${
AR_LIB_NAME
}
AR_CWD
=
$(
pwd
)
# Donn Cave, donn@oz.net
# Function to tell is if the arg is an absolute path. Use it like this:
#
# if is_abs pathname ; then ...
is_abs
()
{
if
[
"
$1
"
!=
"
$(
echo
$1
|
sed
-e
"s,^/,,"
)
"
]
;
then
return
0
fi
return
1
}
usage
=
'Usage: ar-fake cr libpython.dir obj.o ...
ar-fake d libpython.dir obj.o ...
ar-fake so libpython.dir libpython.so'
# Function to build the shared library. It does the right thing for
# PowerPC or x86 systems running BeOS.
build_lib
()
{
LIB
=
$1
;
shift
SO_LIB
=
${
LIB
/.a/.so
}
SO_NAME
=
$1
;
shift
CRUD_NAME
=
$1
;
shift
case
$#
in
0|1|2
)
echo
"
$usage
"
>
&2
exit
1
;;
esac
# maybe too much...
EXTRA_LIBS
=
"-lroot -lbe -lnet"
command
=
$1
library
=
$2
shift
2
case
$command
in
cr
)
if
test
-d
$library
then
:
else
mkdir
$library
fi
if
cp
-p
$*
$library
then
# To force directory modify date, create or delete a file.
if
test
-e
$library
/.tch
then
rm
$library
/.tch
else
echo
tch
>
$library
/.tch
fi
exit
0
fi
;;
d
)
if
test
-d
$library
then
cd
$library
rm
-f
$*
fi
;;
so
)
case
$BE_HOST_CPU
in
ppc
)
case
$(
uname
-r
)
in
4.0
*
)
AR_CC
=
"mwcc -xms -export pragma -nodup"
;;
*
)
AR_CC
=
"mwcc -shared -export pragma -nodup"
;;
esac
GLUE_LOC
=
/boot/develop/lib/ppc
AR_GLUE
=
"
${
GLUE_LOC
}
/glue-noinit.a
${
GLUE_LOC
}
/init_term_dyn.o
${
GLUE_LOC
}
/start_dyn.o"
mwld
-xms
-export
pragma
-nodup
-o
$1
$library
/
*
;;
x86
)
AR_CC
=
"gcc -nostart -Wl,-soname=
${
SO_NAME
}
"
AR_GLUE
=
;;
*
)
# Send me the mystery system (soo-pah aitch!), then we'll talk...
echo
"No, no, no...
$0
doesn't support
$BE_HOST_CPU
"
exit
2
gcc
-nostart
-Wl
,-soname
=
$(
basename
$1
)
-o
$1
$library
/
*
;;
esac
# Build a list of the objects...
PARTS
=
""
while
read
OBJ_FILE OBJ_PATH
;
do
PARTS
=
"
$PARTS
${
OBJ_PATH
}${
OBJ_FILE
}
"
done
<
$CRUD_NAME
$AR_CC
-o
$SO_LIB
$PARTS
$AR_GLUE
$EXTRA_LIBS
>
/dev/null 2>&1
return
0
}
# Make a backup of the old AR_CRUD file, just to be nice, and clean up
# any of our temp files that may be laying around.
if
[
-e
$AR_CRUD
]
;
then
mv
-f
$AR_CRUD
${
AR_CRUD
}
.old
cp
${
AR_CRUD
}
.old
$AR_CRUD
else
touch
$AR_CRUD
fi
if
[
-e
${
AR_CRUD
}
.grepper
]
;
then
rm
-f
${
AR_CRUD
}
.grepper
fi
case
$AR_COMMAND
in
cr
)
# Add the extra bits to the $AR_CRUD file.
for
OBJECT
in
"
$@
"
;
do
OBJ_NAME
=
$(
basename
$OBJECT
)
OBJ_PATH
=
${
OBJECT
%
$OBJ_NAME
}
if
!
is_abs
$OBJ_PATH
;
then
OBJ_PATH
=
${
AR_CWD
}
/
${
OBJECT
}
OBJ_PATH
=
${
OBJ_PATH
%
$OBJ_NAME
}
fi
# If this is already in there, we have to blow it away so
# we can replace it with the new one.
if
egrep
-q
"^
$OBJ_NAME
"
$AR_CRUD
;
then
egrep
-v
"^
$OBJ_NAME
"
<
$AR_CRUD
>
${
AR_CRUD
}
.grepper
mv
-f
${
AR_CRUD
}
.grepper
$AR_CRUD
fi
echo
$OBJ_NAME
$OBJ_PATH
>>
$AR_CRUD
done
# Now build a library from the files.
build_lib
$AR_LIB
$AR_SO_LIB_NAME
$AR_CRUD
status
=
$?
cd
$(
dirname
$1
)
ln
-sf
$PWD
lib
exit
$status
;;
d
)
# Remove files from the $AR_CRUD file. This isn't terribly
# efficient.
for
OBJECT
in
"
$@
"
;
do
OBJ_NAME
=
$(
basename
$OBJECT
)
OBJ_PATH
=
${
OBJECT
%
$OBJ_NAME
}
if
!
is_abs
$OBJ_PATH
;
then
OBJ_PATH
=
${
AR_CWD
}
/
${
OBJECT
}
OBJ_PATH
=
${
OBJ_PATH
%
$OBJ_NAME
}
fi
# Strip the objects from the list, if they're in there.
egrep
-v
"^
$OBJ_NAME
"
<
$AR_CRUD
>
${
AR_CRUD
}
.grepper
mv
-f
${
AR_CRUD
}
.grepper
$AR_CRUD
done
# Now build a library from the remaining objects.
build_lib
$AR_LIB
$AR_SO_LIB_NAME
$AR_CRUD
;;
*
)
echo
"
$0
error:"
echo
" Unsupported command:
$AR_COMMAND
"
*
)
echo
"
$usage
"
>
&2
exit
1
;;
esac
# If we make it here, all went well. Hopefully.
exit
0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment