#!/bin/bash # # Copyright 2006-2009 Michael Shulze # Copyright 2006-2009 Jon Grosshart # All Rights Reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. CWD=`pwd` VERSION=X11R7.4 BASEVER=`echo $VERSION | sed 's/X11R//'` URL=http://xorg.freedesktop.org/releases RELEASE=$URL/$VERSION/src/ INDIVIDUAL=$URL/individual XCB=http://xcb.freedesktop.org/dist/ DOWNLOADSOURCE=yes REMOVETMP=yes # Define a static version for the xcb's # FYI, Newer proto wants python. LIBXCB=1.1 XCBPROTO=1.1 # I'm looking for i*86. TARGET=$(gcc -dumpmachine | sed 's/-.*//') # Lets have an option to override the xorg-server version [[ $BASEVER == 7.3 ]] && XSERVER=1.4.2 [[ $BASEVER == 7.4 ]] && XSERVER=1.5.3 # START with a clean TMP directory: rm -rf $CWD/$VERSION/tmp.* # wget WGET="wget" ######################################################################### # Begin Changelog # # FYI, I'm not testing on anything other than x86... # This function is for anything you don't want to build; # including, but not limited to, the $RELEASE directory. function dont_build() { # Deprecated. [[ $BASEVER > 7.1 ]] && \ echo "mkcfm xkbdata" >> dont-build # 7.3 additions: # i810 was obsoleted by intel [[ $BASEVER > 7.2 ]] && \ echo "xf86-video-i810" >> dont-build # These are new. [[ $BASEVER < 7.3 ]] && \ echo "xbacklight pixman xf86-video-intel xf86-video-glide xf86-video-vermilion" >> dont-build # 7.4 additions: # amd was obsoleted by geode [[ $BASEVER > 7.3 ]] && \ echo "xf86-video-amd" >> dont-build # mach64 and r128 were split from the ati driver... # The rest are new(ish). [[ $BASEVER < 7.4 ]] && \ echo "libpciaccess xf86-video-mach64 xf86-video-r128 xf86-video-openchrome xf86-input-synaptics xf86-video-geode xf86-video-xgi xf86-video-xgixp xinput dri2proto" >> dont-build ###################################################### # General Tweaks. Not Version Related: # Let's take the opportunity to weed out some drivers: # If your on a sun platform, comment the below... echo "xf86-video-sunbw2 xf86-video-suncg14 xf86-video-suncg3 xf86-video-suncg6 xf86-video-sunffb xf86-video-sunleo xf86-video-suntcx" >> dont-build # Solaris/BSD echo "xf86-video-wsfb" >> dont-build # non-x86 cachectl.h - SGI Octane echo "xf86-video-impact" >> dont-build # These are Apple and Windows related: echo "applewmproto windowswmproto libAppleWM libWindowsWM" >> dont-build # Seems to be x86 only on the build. Maybe {_64} too. [[ $TARGET != i*86 ]] && \ echo "xf86-input-vmmouse" >> dont-build } function fix() { if [ "$BASEVER" = "7.3" ]; then # These drivers are just plain broken and need to be updated. if [ "$series" = "driver" ]; then sed -i 's/xf86-input-acecad-1.2.0/xf86-input-acecad-1.2.1/' final.ver sed -i 's/xf86-input-calcomp-1.1.0/xf86-input-calcomp-1.1.1/' final.ver sed -i 's/xf86-input-citron-2.2.0/xf86-input-citron-2.2.1/' final.ver sed -i 's/xf86-input-dmc-1.1.0/xf86-input-dmc-1.1.1/' final.ver sed -i 's/xf86-input-dynapro-1.1.0/xf86-input-dynapro-1.1.1/' final.ver sed -i 's/xf86-input-elo2300-1.1.0/xf86-input-elo2300-1.1.1/' final.ver sed -i 's/xf86-input-evdev-1.1.2/xf86-input-evdev-1.2.0/' final.ver sed -i 's/xf86-input-magellan-1.1.0/xf86-input-magellan-1.1.1/' final.ver sed -i 's/xf86-input-microtouch-1.1.0/xf86-input-microtouch-1.1.1/' final.ver sed -i 's/xf86-input-penmount-1.2.0/xf86-input-penmount-1.2.1/' final.ver sed -i 's/xf86-input-spaceorb-1.1.0/xf86-input-spaceorb-1.1.1/' final.ver sed -i 's/xf86-input-vmmouse-12.4.1/xf86-input-vmmouse-12.4.3/' final.ver sed -i 's/xf86-input-void-1.1.0/xf86-input-void-1.1.1/' final.ver # No glide.h sed -i "/^xf86-video-glide/d" final.ver fi fi if [ "$BASEVER" = "7.4" ]; then if [ "$series" = "proto" ]; then # This was updated on the release page but not in the source directory: sed -i 's/randrproto-1.2.1/randrproto-1.2.2/' final.ver fi if [ "$series" = "driver" ]; then # Still no companion proto module & mesa doesn't ship it. sed -i "/^xf86-video-glide/d" final.ver # http://lists.freedesktop.org/archives/xorg/2008-July/036911.html sed -i "/^xf86-video-cyrix/d" final.ver sed -i "/^xf86-video-imstt/d" final.ver sed -i "/^xf86-video-vermilion/d" final.ver sed -i "/^xf86-video-via/d" final.ver # Upgrade this. Anything newer requires GEM. Anything # less uses XF86DRI_MM. Be on the lookout for a new libdrm. sed -i 's/xf86-video-intel-2.4.2/xf86-video-intel-2.4.98.0/' final.ver # Not sure what's up with this one. sed -i "/^xf86-video-xgixp/d" final.ver fi fi } # End Changelog #################################################################### ######################################### # Don't change anything below this line # ######################################### function grab_latest() { local LATEST # will eventually contain the latest archive local -a LATEST_VER=( 0 ) # and its version, fields separated in an array while read CURRENT do # split version information into an array local -a VER=( $(echo $CURRENT | sed -r 's/^.*-([[:digit:].]+)\.tar\.gz/\1/;s/\./ /g') ) # iterate over fields of that array for (( i=0; i < ${#VER[*]}; i++ )) do # compare current field and replace LATEST if appropriate if (( VER[i] != LATEST_VER[i] )) then if (( VER[i] > LATEST_VER[i] )) then LATEST=$CURRENT LATEST_VER=( ${VER[*]} ) fi break fi done done echo $LATEST } # Module versions gathered from this function will be the latest versions # which _could_ cause problems. function version() { DATAFILE=new2 # file handle 3 will deliver the package names (without version info) that we'll process exec 3< <( sed -n 's/-[[:digit:].]\+tar\.gz$//p' $DATAFILE | sort | uniq ) while read <&3 do grep "^$REPLY-[[:digit:].]\+tar\.gz$" $DATAFILE | grab_latest >> individual.ver done } function order() { DATAFILE=release.ver # file handle 3 will now sort them according to our static order file exec 3< $ORDERFILE while read <&3 do grep "^$REPLY-[[:digit:].]\+tar\.gz$" $DATAFILE | grab_latest >> final.ver done } # Determine the $VERSION packages. echo echo "Retrieving package list for $VERSION... Please wait." for series in font xserver app data driver lib proto util ; do rm -rf $CWD/$VERSION/source/$series.lst mkdir -p $CWD/$VERSION/{tmp.$series,source/$series} cd $CWD/$VERSION/tmp.$series wget $RELEASE/$series > /dev/null 2>&1 grep -o 'f=".*gz' index.html > new sed -e 's/f="//' -e 's/".*//' -e 's/X11R7.*-//' new > release.ver rm -f index.html new # Now determine what was left out or is contributed: if [ -f $CWD/extras/$series-order ]; then sed 's/-[[:digit:].]\+tar\.gz//g' release.ver > release.nover cat $CWD/extras/$series-order release.nover | sort | uniq -u > misc # Grab a monolithic package list for version() wget $INDIVIDUAL/$series > /dev/null 2>&1 grep -o 'f=".*gz' index.html > new sed -e 's/f="//' -e 's/".*//' new > new2 version rm -f index.html new new2 # Find out what is deprecated in this $VERSION. # Basically, anything that's not in $RELEASE, but # can still be found in $series-order. dont_build cat misc dont-build | sort | uniq -d > not-in-release # Filter out not-in-release from misc. for module in $(cat not-in-release); do sed -i "s/$module//" misc sed -i '/^$/d' misc done # Now, whatever is left, scoot it over to release.ver for name in $(cat misc); do grep $name individual.ver >> release.ver sed -i '/^$/d' release.ver done # Add libxcb and xcb-proto... Is util even used for anything? if [ "$series" = "lib" ]; then echo "libxcb-$LIBXCB.tar.gz" >> release.ver elif [ "$series" = "proto" ]; then echo "xcb-proto-$XCBPROTO.tar.gz" >> release.ver fi # Sort it according to our build order. ORDERFILE=$CWD/extras/$series-order order # Now compare it with dont-build one last time to catch # stuff like the sun drivers. Stuff that was listed in # $RELEASE but you just don't want. Yep, seems a little # redundant but misc dictates we do it again. for module in $(cat dont-build); do sed -i "/^$module/d" final.ver done # Read fix() comments: fix sed -i '/^$/d' final.ver cp final.ver $CWD/$VERSION/source/$series.lst else # Must be xserver if [ "$XSERVER" != "" ]; then sed -i "s/^xorg.*/xorg-server-$XSERVER.tar.gz/" release.ver fi cp release.ver $CWD/$VERSION/source/$series.lst fi done # Clean up: if [ "$REMOVETMP" = "yes" ]; then rm -rf $CWD/$VERSION/tmp.* fi # Grab the tarballs: if [ "$DOWNLOADSOURCE" = "yes" ]; then echo echo "Retrieving source tarballs for $VERSION..." echo for series in driver font lib app data proto util xserver; do # I should probably go back to using bz2 for everything and then # sed the compiz bz2 to gz here... All these gzips are killin me. # Make a conditional $pkgname for compiz below I guess... That or # tar\.* for tarball in $(cat $CWD/$VERSION/source/$series.lst); do if [ ! -f $CWD/$VERSION/source/$series/$tarball ]; then cd $CWD/$VERSION/source/$series pkgname=$(echo $tarball | sed 's/-[[:digit:].]\+tar\.gz//') if [ "$pkgname" = "libxcb" ]; then $WGET $XCB/$tarball elif [ "$pkgname" = "xcb-proto" ]; then $WGET $XCB/$tarball else $WGET $INDIVIDUAL/$series/$tarball fi fi done done fi echo "All Done!" echo exit 1