2012-01-08 09:58:54 +04:00
|
|
|
#!/bin/bash
|
|
|
|
# Mesa-O-Matic
|
|
|
|
# Copyright 2011, Alexander von Gluck IV
|
|
|
|
|
|
|
|
# This script creates an optional package containing the
|
|
|
|
# the headers and binary code needed by the opengl kit
|
|
|
|
# to link libGL.so
|
|
|
|
|
|
|
|
# This script is run against a *COMPILED* Mesa source tree
|
|
|
|
|
|
|
|
echo " Welcome to Mesa-O-Matic!"
|
|
|
|
echo "-=-=-=-=-=-=-=-=-=-=-=-=-="
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
# These are the Mesa headers and libraries used by the opengl kit
|
|
|
|
# Headers are probed for dependencies, only specify ones referenced
|
|
|
|
# by the opengl kit.
|
2012-02-13 20:14:35 +04:00
|
|
|
MESA_PRIVATE_HEADERS="glheader.h glapi.h glapitable.h glapitemp.h glapi_priv.h context.h driverfuncs.h meta.h colormac.h buffers.h framebuffer.h renderbuffer.h state.h version.h swrast.h swrast_setup.h tnl.h t_context.h t_pipeline.h vbo.h extensions.h s_spantemp.h s_renderbuffer.h s_context.h formats.h cpuinfo.h"
|
|
|
|
|
|
|
|
DEBUG=0
|
2012-01-08 09:58:54 +04:00
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
# END CONFIG DATA, Dragons below!
|
|
|
|
#######################################################################
|
|
|
|
|
|
|
|
if [[ $( uname ) != "Haiku" ]]; then
|
|
|
|
echo "*************************************"
|
|
|
|
echo " I need to be run on a Haiku system!!"
|
|
|
|
echo "*************************************"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z $1 ]]; then
|
|
|
|
echo ""
|
|
|
|
echo "Usage: $0 <compiled mesa location>"
|
|
|
|
echo ""
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
MESA_TOP="$1"
|
|
|
|
|
|
|
|
GCC_VER=`gcc -v 2>&1 | tail -1 | awk '{print $3}' | cut -d. -f1`
|
|
|
|
MESA_VER=`cat $MESA_TOP/Makefile |grep VERSION\= | cut -d= -f2`
|
|
|
|
|
2012-02-13 20:14:35 +04:00
|
|
|
DATESTAMP=`date +"%Y-%m-%d"`
|
|
|
|
|
2012-01-08 09:58:54 +04:00
|
|
|
echo "Bundling gcc$GCC_VER build of Mesa $MESA_VER..."
|
|
|
|
|
|
|
|
cd $MESA_TOP
|
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
# Create Mesa optional pacakge
|
|
|
|
|
|
|
|
findInTree() {
|
|
|
|
RESULT=`find . -name "$1"`
|
|
|
|
if [[ $? -ne 0 || -z $RESULT ]]; then
|
|
|
|
echo "$i"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo $RESULT
|
|
|
|
}
|
|
|
|
|
|
|
|
# Directories to search for matching headers
|
|
|
|
MESA_INCLUDES="-I./include -I./src -I./src/mapi -I./src/mesa"
|
2012-01-23 23:23:16 +04:00
|
|
|
MESA_DEFINES="-DUSE_X86_ASM -DUSE_PPC_ASM -DUSE_SPARC_ASM"
|
|
|
|
MESA_DEFINES="$MESA_DEFINES -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -DUSE_X86_64_ASM"
|
2012-01-08 09:58:54 +04:00
|
|
|
|
|
|
|
ZIP_HEADERS=""
|
|
|
|
echo "Collecting required Mesa private headers..."
|
|
|
|
for i in $MESA_PRIVATE_HEADERS
|
|
|
|
do
|
|
|
|
FOUND=$(findInTree $i)
|
|
|
|
if [[ $GCC_VER -eq 2 ]]; then
|
|
|
|
# gcc2 isn't very good at -MM
|
|
|
|
setgcc gcc4
|
|
|
|
fi
|
2012-01-23 23:23:16 +04:00
|
|
|
HEADERS_RAW=`gcc -MM $MESA_INCLUDES $MESA_DEFINES $FOUND`
|
2012-01-08 09:58:54 +04:00
|
|
|
if [[ $GCC_VER -eq 2 ]]; then
|
|
|
|
setgcc gcc2
|
|
|
|
fi
|
|
|
|
|
2012-01-17 18:51:55 +04:00
|
|
|
for y in $( echo "$HEADERS_RAW" | cut -d':' -f2 | sed 's/\\//g' | tr -d '\n' )
|
|
|
|
do
|
|
|
|
CLEAN_HEADER=$( echo "$y" | grep -v "include/GL" )
|
|
|
|
ZIP_HEADERS="$ZIP_HEADERS $CLEAN_HEADER"
|
|
|
|
done
|
|
|
|
done
|
2012-01-08 09:58:54 +04:00
|
|
|
|
|
|
|
echo "Collecting required Mesa libraries..."
|
2012-01-17 18:51:55 +04:00
|
|
|
rm -rf lib.haiku
|
|
|
|
mkdir -p lib.haiku
|
|
|
|
for i in $( find . -name "*.a" )
|
2012-01-08 09:58:54 +04:00
|
|
|
do
|
2012-01-17 18:51:55 +04:00
|
|
|
cp $i lib.haiku/
|
2012-01-08 09:58:54 +04:00
|
|
|
done
|
|
|
|
|
2012-02-13 20:14:35 +04:00
|
|
|
if [[ $DEBUG -eq 0 ]]; then
|
|
|
|
echo "Stripping debug symbols from Mesa libraries..."
|
|
|
|
find lib.haiku -exec strip --strip-debug {} \; ;
|
|
|
|
MESADBG=""
|
|
|
|
else
|
|
|
|
MESADBG="dbg"
|
|
|
|
fi
|
2012-01-17 18:51:55 +04:00
|
|
|
|
2012-01-08 09:58:54 +04:00
|
|
|
echo "Creating Mesa OptionalPackage..."
|
|
|
|
PLATFORM=$( uname -m )
|
2012-02-13 20:14:35 +04:00
|
|
|
ZIP_FILENAME="../mesa-${MESA_VER}${MESADBG}-x86-gcc${GCC_VER}-${DATESTAMP}.zip"
|
2012-01-17 18:55:26 +04:00
|
|
|
zip -r -9 $ZIP_FILENAME $ZIP_HEADERS ./include/GL/* ./lib.haiku/*
|
2012-01-08 09:58:54 +04:00
|
|
|
|
|
|
|
echo "Great Success! $ZIP_FILENAME created."
|