Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

gdev: Fix user-space build

  • Loading branch information...
commit f7bc741c07b4af6d69702db36bc35032a03222cd 1 parent e71db4a
@shinpei0208 shinpei0208 authored
Showing with 43 additions and 49 deletions.
  1. +7 −40 common/autogen.sh
  2. +35 −9 lib/configure
  3. +1 −0  lib/user/gdev/Makefile
View
47 common/autogen.sh
@@ -1,51 +1,21 @@
#!/bin/sh
-target=$1
-driver=$2
-
-## cflags for each driver
-nvrm_CFLAGS=''
-pscnv_CFLAGS=''
-nouveau_CFLAGS="-I /usr/include/libdrm"
-
-## object for each driver
-nvrm_OBJS="nvrm_gdev.o nvrm.o ioctl.o mthd.o handle.o channel.o memory.o"
-pscnv_OBJS="pscnv_gdev.o libpscnv.o libpscnv_ib.o"
-nouveau_OBJS="nouveau_gdev.o libnouveau.o libnouveau_ib.o"
-
-## library for each driver
-nvrm_LIBS=''
-pscnv_LIBS=''
-nouveau_LIBS="-ldrm_nouveau"
-
-if [ $(echo ${#driver}) -eq 0 ] ; then
- # detect the driver
- if [ ! $(lsmod | grep nvidia | wc -l) -eq 0 ] ; then
+# detect the driver
+if [ ! $(lsmod | grep nvidia | wc -l) -eq 0 ] ; then
driver="nvrm"
- elif [ ! $(lsmod | grep nouveau | wc -l) -eq 0 ] ; then
+elif [ ! $(lsmod | grep nouveau | wc -l) -eq 0 ] ; then
driver="nouveau"
- elif [ ! $(zgrep NOUVEAU /proc/config.gz | grep y | wc -l) -eq 0 ] ; then
+elif [ ! $(zgrep NOUVEAU /proc/config.gz | grep y | wc -l) -eq 0 ] ; then
driver="nouveau"
- elif [ ! $(lsmod | grep pscnv | wc -l) -eq 0 ] ; then
+elif [ ! $(lsmod | grep pscnv | wc -l) -eq 0 ] ; then
driver="pscnv"
- else
+else
echo "Device driver not found"
exit
- fi
- echo "Device driver detected: $driver"
-else
- echo "Device driver selected: $driver"
-fi
-
-if [ $(echo ${#target}) -ne 0 ] ; then
- if [ $target = 'user' ] ; then
- eval EXTRA_CFLAGS="EXTRA_CFLAGS?="'$'$driver"_CFLAGS"
- eval EXTRA_OBJS="EXTRA_OBJS="'$'$driver"_OBJS"
- eval EXTRA_LIBS="EXTRA_LIBS="'$'$driver"_LIBS"
- fi
fi
+echo "Device driver detected: $driver"
# create Driver.mk
cat > Driver.mk << EOF
@@ -57,9 +27,6 @@ cat > Driver.mk << EOF
#
DRIVER_NAME=$driver
-$EXTRA_CFLAGS
-$EXTRA_OBJS
-$EXTRA_LIBS
EOF
DRIVER=$(echo $driver | tr "a-z" "A-Z")
View
44 lib/configure
@@ -1,13 +1,25 @@
#!/bin/sh
-
topdir='../..'
common='common'
-driver=''
target='kernel'
debug=0
+## cflags for each driver
+nvrm_CFLAGS=''
+pscnv_CFLAGS=''
+nouveau_CFLAGS="-I /usr/include/libdrm"
+
+## object for each driver
+nvrm_OBJS="nvrm_gdev.o nvrm.o ioctl.o mthd.o handle.o channel.o memory.o"
+pscnv_OBJS="pscnv_gdev.o libpscnv.o libpscnv_ib.o"
+nouveau_OBJS="nouveau_gdev.o libnouveau.o libnouveau_ib.o"
+
+## library for each driver
+nvrm_LIBS=''
+pscnv_LIBS=''
+nouveau_LIBS="-ldrm_nouveau"
# parse the given options.
for option
@@ -20,8 +32,6 @@ do
case "$option" in
--target=*)
target="$optarg" ;;
- --driver=*)
- driver="$optarg" ;;
--debug)
debug=1 ;;
esac
@@ -38,14 +48,30 @@ elif [ $target = 'user' ] ; then
cp -f ../user/gdev/* .
cp -f $topdir/$common/* .
# detect which driver to be used
- sh ./autogen.sh $target $driver
- # include $DRIVER_NAME
- # . ./Driver.mk
+ sh ./autogen.sh
+ # get $DRIVER_NAME
+ . ./Driver.mk
# copy driver-dependent files
- cp -f ../user/$driver/* .
-
+ cp -f ../user/$DRIVER_NAME/* .
+ # extra flags for Makefile
+ eval EXTRA_CFLAGS="EXTRA_CFLAGS?="'$'$DRIVER_NAME"_CFLAGS"
+ eval EXTRA_OBJS="EXTRA_OBJS="'$'$DRIVER_NAME"_OBJS"
+ eval EXTRA_LIBS="EXTRA_LIBS="'$'$DRIVER_NAME"_LIBS"
else
echo "Error: invalid target '$target'"
fi
+# create Extra.mk
+cat > Extra.mk << EOF
+#
+# Copyright (C) Shinpei Kato
+# All Rights Reserved
+#
+# This is automatically generated by autogen.sh script.
+#
+
+$EXTRA_CFLAGS
+$EXTRA_OBJS
+$EXTRA_LIBS
+EOF
View
1  lib/user/gdev/Makefile
@@ -1,6 +1,7 @@
# Makefile
include Driver.mk
+include Extra.mk
CC = gcc
TARGET = libgdev
Please sign in to comment.
Something went wrong with that request. Please try again.