Fix #13196 - Honor SHARED in configure-plugins ##build

This commit is contained in:
pancake 2022-05-18 09:06:30 +02:00 committed by GitHub
parent 3bb3b2dfe2
commit 5ee2c92830
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 45 additions and 47 deletions

View File

@ -8,6 +8,8 @@
LANG=C
LC_ALL=C
LOADLIBS=1
EXT=so
[ "`uname`" = Darwin ] && EXT=dylib
export LANG
export LC_ALL
@ -61,11 +63,7 @@ generate_configh () {
if [ ! "$oldlib" = "$lib" ]; then
[ -n "$oldlib" ] && echo " 0"
oldlib=$lib
if type perl > /dev/null 2>&1 ; then
uclib=$(echo $lib | perl -pe 'tr/[a-z]/[A-Z]/')
else
uclib=$(echo $lib | tr '[a-z]' '[A-Z]')
fi
uclib=$(echo $lib | tr '[a-z]' '[A-Z]')
echo
echo "#define R_${uclib}_STATIC_PLUGINS \\"
plugins="${plugins} __${uclib}"
@ -74,17 +72,13 @@ generate_configh () {
done
[ -n "$oldlib" ] && echo " 0"
# FILL EMPTY PLUGIN ARRAYS WITH LOVE
# CAREFULLY FILL EMPTY PLUGIN ARRAYS
for a in ${SHARED} ; do
lib=$(echo $a | cut -d . -f 1) # library
plg=$(echo $a | cut -d . -f 2) # plugin name
if [ ! "$oldlib" = "$lib" ]; then
oldlib=$lib
if type perl > /dev/null 2>&1; then
uclib=$(echo $lib | perl -pe 'tr/[a-z]/[A-Z]/')
else
uclib=$(echo $lib | tr '[a-z]' '[A-Z]')
fi
uclib=$(echo $lib | tr '[a-z]' '[A-Z]')
if [ -z "`echo ${plugins} | grep __${uclib}`" ]; then
plugins="${plugins} __${uclib}"
echo
@ -105,40 +99,35 @@ generate_asmdinc() {
}
generate_configmk () {
splugins=""
plugins=""
oldlib=""
for a in ${STATIC} ; do
for a in `echo "${STATIC} ${SHARED}" | tr " " "\n" | sort` ; do
lib=$(echo $a | cut -d . -f 1) # library
plg=$(echo $a | cut -d . -f 2) # plugin name
if [ ! "$oldlib" = "$lib" ]; then
[ -n "$oldlib" ] && printf "\n"
oldlib=$lib
if type perl > /dev/null 2>&1 ; then
uclib=$(echo $lib | perl -pe 'tr/[a-z]/[A-Z]/')
else
uclib=$(echo $lib | tr '[a-z]' '[A-Z]')
fi
printf "STATIC_${uclib}_PLUGINS= "
uclib=$(echo $lib | tr '[a-z]' '[A-Z]')
printf "STATIC_${uclib}_PLUGINS="
plugins="${plugins} __${uclib}"
fi
printf "p/${plg}.mk "
printf " p/${plg}.mk"
done
echo
# fill the holes with love
for a in ${SHARED} ; do
lib=$(echo $a | cut -d . -f 1) # library
if type perl > /dev/null 2>&1 ; then
uclib=$(echo $lib | perl -pe 'tr/[a-z]/[A-Z]/')
else
uclib=$(echo $lib | tr '[a-z]' '[A-Z]')
fi
if [ -z "`echo ${plugins} | grep __${uclib}`" ]; then
plugins="${plugins} __${uclib}"
echo "STATIC_${uclib}_PLUGINS="
plg=$(echo $a | cut -d . -f 2) # plugin name
uclib=$(echo $lib | tr '[a-z]' '[A-Z]')
if [ -z "`echo ${splugins} | grep __${uclib}`" ]; then
splugins="${splugins} __${uclib}"
printf "SHARED_${uclib}_TARGETS="
fi
printf " p/io_${plg}.${EXT}"
done
echo
}
generate () {
@ -167,7 +156,6 @@ sub () {
n="" ; for a in $1 ; do [ $a = $2 ] && continue ; n="$n $a" ; done ; echo $n
}
echo | sort -t. > /dev/null 2>&1
if [ $? = 0 ]; then
SORT="sort -t."
@ -197,11 +185,23 @@ make_shared () {
make_ () { : ; }
MODE=""
DONOTHING=0
DEFCFG=dist/plugins-cfg/plugins.def.cfg
check_conflicts () {
CONFLICT=0
for a in $STATIC ; do
for b in $SHARED ; do
if [ "$a" = "$b" ]; then
echo "\x1b[1mError\x1b[0m: Conflict \x1b[44m$a\x1b[0m is defined as STATIC and SHARED"
CONFLICT=1
fi
done
done
return $CONFLICT
}
rmstatic() {
C=0
if [ -z "$1" ]; then
@ -255,6 +255,8 @@ if [ - != "${RMSTATIC}" ]; then
exit 0
fi
check_conflicts || exit 1
[ ${DONOTHING} = 0 ] && generate
echo SHARED: ${SHARED}

View File

@ -1,5 +1,4 @@
STATIC="
io.malloc
io.default
bin.any
bin.elf

View File

@ -257,7 +257,6 @@ io.procpid
io.ptrace
io.rap
io.self
io.shm
io.w32
io.w32dbg
io.winkd

View File

@ -32,7 +32,6 @@ bp.mips
cmd.dummy
egg.exec
egg.xor
io.debug
io.malloc
io.sparse
io.default

View File

@ -247,7 +247,6 @@ io.procpid
io.ptrace
io.rap
io.self
io.shm
io.w32
io.w32dbg
io.winedbg
@ -281,4 +280,4 @@ parse.wasm_pseudo
parse.avr_pseudo
parse.x86_pseudo
parse.z80_pseudo"
SHARED="io.shm"
SHARED=""

View File

@ -224,7 +224,6 @@ io.procpid
io.ptrace
io.rap
io.self
io.shm
io.w32
io.w32dbg
io.winkd

View File

@ -106,7 +106,6 @@ io.procpid
io.ptrace
io.rap
io.self
io.shm
io.w32
io.w32dbg
io.winkd

View File

@ -198,7 +198,6 @@ io.procpid
io.ptrace
io.rap
io.self
io.shm
io.w32
io.w32dbg
io.winkd

View File

@ -254,4 +254,4 @@ parse.wasm_pseudo
parse.avr_pseudo
parse.x86_pseudo
parse.z80_pseudo"
SHARED="io.shm"
SHARED=""

View File

@ -57,7 +57,6 @@ io.default
parse.arm_pseudo
parse.att2intel
parse.wasm_pseudo
parse.6502_pseudo
parse.z80_pseudo
"
SHARED="

View File

@ -27,9 +27,12 @@ ifeq (${BUILD_OS},dragonfly)
LDFLAGS+=-lkvm
endif
.PHONY: pre
.PHONY: pre pos
pre: libr_io.${EXT_SO} libr_io.${EXT_AR}
@${MAKE} -C p
@$(MAKE) -C p
$(MAKE) pos
pos: $(SHARED_IO_TARGETS)
include ${STATIC_IO_PLUGINS}
include $(LTOP)/rules.mk

View File

@ -1,10 +1,11 @@
N=shm
OBJ_SHM=io_shm.o
CSRC_SHM=$(subst .o,.c,$(OBJ_SHM))
STATIC_OBJ+=${OBJ_SHM}
TARGET_SHM=io_shm.${EXT_SO}
ALL_TARGETS+=${TARGET_SHM}
#ALL_TARGETS+=${TARGET_SHM}
# only for shm_open
ifeq (${OSTYPE},gnulinux)
LDFLAGS+=-lrt
endif
@ -17,6 +18,5 @@ LINKFLAGS+=-L../../util -lr_util
LINKFLAGS+=-L.. -lr_io
endif
${TARGET_SHM}: ${OBJ_SHM}
${CC_LIB} $(call libname,io_shm) ${CFLAGS} $(LDFLAGS) \
-o ${TARGET_SHM} ${OBJ_SHM} ${LINKFLAGS}
$(N) p/${TARGET_SHM}: p/${OBJ_SHM}
cd p && $(CC) $(CFLAGS) -shared -L.. $(CSRC_SHM) -fPIC -o $(TARGET_SHM) -I../../include -I../../../shlr/sdb/src $(LINKFLAGS)

View File

@ -33,6 +33,7 @@ LDFLAGS_LIB=${LDFLAGS} -shared
#endif
LDFLAGS_SONAME=-Wl,-soname=
endif
LDFLAGS_LIB+=-fPIC
# XXX
#LDFLAGS_SONAME=-D_