From 205c9659cffb5f5e7632cabd20938038e7ba2c7b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 18 Feb 2010 12:46:48 -0700 Subject: mklib: Teach mklib to fail build if link fails on cygwin Signed-off-by: Jon TURNEY Signed-off-by: Brian Paul (cherry picked from commit 551c96979e643b409535afe868c42cac0d2285ad) --- bin/mklib | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'bin/mklib') diff --git a/bin/mklib b/bin/mklib index 9e6e46de8b..2ef902287d 100755 --- a/bin/mklib +++ b/bin/mklib @@ -977,6 +977,11 @@ case $ARCH in # make lib ${LINK} ${OPTS} ${LDFLAGS} -o ${CYGNAME}-${MAJOR}.dll ${OBJECTS} ${DEPS} + # make build fail if link failed + es=$? + if [ "$es" -ne "0" ]; then + exit $es + fi # make usual symlinks ln -s ${LIBNAME}-${MAJOR}.dll.a ${LIBNAME}.dll.a # finish up -- cgit v1.2.3 From d6f55492af3cb82b0113fe6beac0f3494b6e2956 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Thu, 18 Feb 2010 19:25:56 +0000 Subject: Make mklib propogate all errors Signed-off-by: Jon TURNEY Signed-off-by: Brian Paul --- bin/mklib | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'bin/mklib') diff --git a/bin/mklib b/bin/mklib index 2ef902287d..68d22052c9 100755 --- a/bin/mklib +++ b/bin/mklib @@ -24,6 +24,12 @@ # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# propagate any errors +function errtrap { + es=$? + exit $es +} +trap errtrap ERR # Given a list of files, look for .a archives and unpack them. # Return the original list of files minus the .a files plus the unpacked files. -- cgit v1.2.3 From cc66847c1095d01fe766e004ad1d5dbf8c77b380 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 18 Feb 2010 13:02:59 -0700 Subject: mklib: remove unused -contents_of_archives(), add comments --- bin/mklib | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) (limited to 'bin/mklib') diff --git a/bin/mklib b/bin/mklib index 68d22052c9..fa0c82bf56 100755 --- a/bin/mklib +++ b/bin/mklib @@ -24,6 +24,7 @@ # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + # propagate any errors function errtrap { es=$? @@ -31,8 +32,11 @@ function errtrap { } trap errtrap ERR + # Given a list of files, look for .a archives and unpack them. # Return the original list of files minus the .a files plus the unpacked files. +# first param: name of a temp directory (to be deleted when finished) +# remaining params: list of .o and .a files expand_archives() { DIR=$1 shift @@ -66,27 +70,6 @@ expand_archives() { } -# Given a list of files, look for .a archives and return a list of all objects -# in the .a archives. -contents_of_archives() { - FILES=$@ - NEWFILES="" - for FILE in $FILES ; do - case $FILE in - *.a) - # get list of members in this .a archive - MEMBERS=`ar t $FILE` - NEWFILES="$NEWFILES $MEMBERS" - ;; - *) - # skip other file types - ;; - esac - done - echo $NEWFILES -} - - # Make static library with 'ar' # params: # options to ar -- cgit v1.2.3 From 79cc455cb8f2da1155e4d7fd4ddb9c1914ea5889 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 18 Feb 2010 14:48:53 -0800 Subject: Revert "Make mklib propogate all errors" This reverts commit d6f55492af3cb82b0113fe6beac0f3494b6e2956. It's both not portable and not safe to trap & exit on ERR. This will need to use a more invasive approach that tests return code only for selected, important commands. --- bin/mklib | 8 -------- 1 file changed, 8 deletions(-) (limited to 'bin/mklib') diff --git a/bin/mklib b/bin/mklib index fa0c82bf56..c4b3478c79 100755 --- a/bin/mklib +++ b/bin/mklib @@ -25,14 +25,6 @@ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# propagate any errors -function errtrap { - es=$? - exit $es -} -trap errtrap ERR - - # Given a list of files, look for .a archives and unpack them. # Return the original list of files minus the .a files plus the unpacked files. # first param: name of a temp directory (to be deleted when finished) -- cgit v1.2.3 From e3114d3f0ff45f6e3ef38c59cceb9b6923b7b0eb Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Fri, 19 Feb 2010 22:38:00 +0000 Subject: Cygwin build fix: Fix linkage Fix the way we make static convenience libraries, such as libmesa.a, to be the same as linux etc. Putting archives inside archives doesn't make the objects inside the archive linkable, so use expand_archives() to get all the objects inside an archive out again before linking. Signed-off-by: Jon TURNEY Signed-off-by: Brian Paul --- bin/mklib | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'bin/mklib') diff --git a/bin/mklib b/bin/mklib index c4b3478c79..06e8029cb6 100755 --- a/bin/mklib +++ b/bin/mklib @@ -936,7 +936,14 @@ case $ARCH in if [ "${ALTOPTS}" ] ; then OPTS=${ALTOPTS} fi - FINAL_LIBS=`make_ar_static_lib ${OPTS} 1 ${LIBNAME} ${OBJECTS}` + + # expand .a into .o files + NEW_OBJECTS=`expand_archives ${LIBNAME}.obj $OBJECTS` + + FINAL_LIBS=`make_ar_static_lib ${OPTS} 1 ${LIBNAME} ${NEW_OBJECTS}` + + # remove temporary extracted .o files + rm -rf ${LIBNAME}.obj else OPTS="-shared -Wl,--enable-auto-image-base -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a" if [ "${ALTOPTS}" ] ; then -- cgit v1.2.3 From edd85bcd6bc92beaf266a602da76d2aefe836a8e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 21 Feb 2010 14:30:00 -0800 Subject: bin/mklib: Clear CDPATH to avoid damaging expand_archive output The bash 'cd' command tends to emit random stuff to stdout when the CDPATH variable is set, so clear it to keep extra filenames from being emitted from the expand_archive function, which would otherwise cause mklib to fail. Signed-off-by: Keith Packard Reviewed-by: Dan Nicholson Signed-off-by: Brian Paul --- bin/mklib | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'bin/mklib') diff --git a/bin/mklib b/bin/mklib index 06e8029cb6..7f2272584e 100755 --- a/bin/mklib +++ b/bin/mklib @@ -25,6 +25,10 @@ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# Clear CDPATH as the 'cd' command will echo stuff +# to stdout if it is set +unset CDPATH + # Given a list of files, look for .a archives and unpack them. # Return the original list of files minus the .a files plus the unpacked files. # first param: name of a temp directory (to be deleted when finished) -- cgit v1.2.3 From 54f9c509a1eddfa7b2600ef4e4c18c2e212f6d51 Mon Sep 17 00:00:00 2001 From: Alex Weiss Date: Sat, 27 Feb 2010 14:47:43 -0500 Subject: Fixed mklib to properly merge static libraries on darwin. Signed-off-by: Dan Nicholson --- bin/mklib | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'bin/mklib') diff --git a/bin/mklib b/bin/mklib index 7f2272584e..08ef99ec10 100755 --- a/bin/mklib +++ b/bin/mklib @@ -743,12 +743,20 @@ case $ARCH in if [ $STATIC = 1 ] ; then LIBNAME="lib${LIBNAME}.a" echo "mklib: Making Darwin static library: " ${LIBNAME} - LINK="ar" OPTS="-ruvs" if [ "${ALTOPTS}" ] ; then OPTS=${ALTOPTS} fi - ${LINK} ${OPTS} ${LIBNAME} ${OBJECTS} + + # expand .a into .o files + NEW_OBJECTS=`expand_archives ${LIBNAME}.obj $OBJECTS` + + # make static lib + FINAL_LIBS=`make_ar_static_lib ${OPTS} 1 ${LIBNAME} ${NEW_OBJECTS}` + + # remove temporary extracted .o files + rm -rf ${LIBNAME}.obj + FINAL_LIBS=${LIBNAME} else # On Darwin a .bundle is used for a library that you want to dlopen -- cgit v1.2.3