From 8ba2cc8384cb661cb6e572a32aa1d3ad33ae3b38 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Nov 30 2007 20:43:30 +0000 Subject: - Fix restoration of resolution when leaving fullscreen - Don't use macros in cvs co instructions --- diff --git a/.cvsignore b/.cvsignore index e69de29..6c79ebd 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +BlockOutII-2.3.tar.bz2 diff --git a/BlockOutII-2.3-64bit.patch b/BlockOutII-2.3-64bit.patch new file mode 100644 index 0000000..02d02f1 --- /dev/null +++ b/BlockOutII-2.3-64bit.patch @@ -0,0 +1,30 @@ +diff -up BlockOutII-2.3/contrib/ImageLib/src/jpg/jpegdecoder.cpp~ BlockOutII-2.3/contrib/ImageLib/src/jpg/jpegdecoder.cpp +--- BlockOutII-2.3/contrib/ImageLib/src/jpg/jpegdecoder.cpp~ 2007-11-25 22:43:11.000000000 +0100 ++++ BlockOutII-2.3/contrib/ImageLib/src/jpg/jpegdecoder.cpp 2007-11-25 22:43:11.000000000 +0100 +@@ -106,7 +106,7 @@ void *jpeg_decoder::alloc(int n) + blocks[i] = q; + + // Round to qword boundry, to avoid misaligned accesses with MMX code +- return ((void *)(((uint)q + 7) & ~7)); ++ return ((void *)(((unsigned long)q + 7) & ~7)); + } + //------------------------------------------------------------------------------ + // Clear buffer to word values. +@@ -1884,7 +1884,7 @@ void jpeg_decoder::init_frame(void) + q = (uchar *)alloc(max_blocks_per_row * 64 * sizeof(BLOCK_TYPE) + 8); + + // Align to 8-byte boundry, for MMX code +- q = (uchar *)(((uint)q + 7) & ~7); ++ q = (uchar *)(((unsigned long)q + 7) & ~7); + + // The block_seg[] array's name dates back to the + // 16-bit assembler implementation. "seg" stood for "segment". +@@ -1894,7 +1894,7 @@ void jpeg_decoder::init_frame(void) + for (i = 0; i < max_blocks_per_row; i++) + block_max_zag_set[i] = 64; + +- Psample_buf = (uchar *)(((uint)alloc(max_blocks_per_row * 64 + 8) + 7) & ~7); ++ Psample_buf = (uchar *)(((unsigned long)alloc(max_blocks_per_row * 64 + 8) + 7) & ~7); + + total_lines_left = image_y_size; + diff --git a/BlockOutII-2.3-bl2Home.patch b/BlockOutII-2.3-bl2Home.patch new file mode 100644 index 0000000..0a97b38 --- /dev/null +++ b/BlockOutII-2.3-bl2Home.patch @@ -0,0 +1,18 @@ +diff -up BlockOutII-2.3/BlockOut_GL/Utils.cpp~ BlockOutII-2.3/BlockOut_GL/Utils.cpp +--- BlockOutII-2.3/BlockOut_GL/Utils.cpp~ 2007-11-25 23:01:12.000000000 +0100 ++++ BlockOutII-2.3/BlockOut_GL/Utils.cpp 2007-11-25 23:01:12.000000000 +0100 +@@ -162,13 +162,7 @@ BOOL CheckEnv() { + return FALSE; + } + +- char *blockoutHome = getenv("BL2_HOME"); +- if( blockoutHome==NULL ) { +- printf("BL2_HOME environement variable if not defined !\n"); +- printf("Please set the BL2_HOME to the BlockOut II installation directory (ex: BL2_HOME=/usr/local/bl2).\n"); +- return FALSE; +- } +- strcpy( bl2Home , blockoutHome ); ++ strcpy( bl2Home , "/usr/share/BlockOutII" ); + + char bl2Dir[512]; + sprintf(bl2Dir,"%s/.bl2",homePath); diff --git a/BlockOutII-2.3-music.patch b/BlockOutII-2.3-music.patch new file mode 100644 index 0000000..ef995c9 --- /dev/null +++ b/BlockOutII-2.3-music.patch @@ -0,0 +1,12 @@ +diff -up BlockOutII-2.3/BlockOut_GL/SoundManager.cpp~ BlockOutII-2.3/BlockOut_GL/SoundManager.cpp +--- BlockOutII-2.3/BlockOut_GL/SoundManager.cpp~ 2007-11-25 23:13:00.000000000 +0100 ++++ BlockOutII-2.3/BlockOut_GL/SoundManager.cpp 2007-11-25 23:13:00.000000000 +0100 +@@ -142,7 +142,7 @@ void SoundManager::PlayHit() { + void SoundManager::PlayMusic() { + + if( creditsMusic==NULL ) { +- creditsMusic = Mix_LoadMUS( LID("sounds/music.mp3") ); ++ creditsMusic = Mix_LoadMUS( LID("sounds/music.ogg") ); + if( !creditsMusic ) { + printf("Music cannot be played: %s\n",SDL_GetError()); + return; diff --git a/BlockOutII-2.3-restore-resolution.patch b/BlockOutII-2.3-restore-resolution.patch new file mode 100644 index 0000000..b4c02d9 --- /dev/null +++ b/BlockOutII-2.3-restore-resolution.patch @@ -0,0 +1,57 @@ +diff -up BlockOutII-2.3/BlockOut_GL/GLApp/GLApp.cpp.fs BlockOutII-2.3/BlockOut_GL/GLApp/GLApp.cpp +--- BlockOutII-2.3/BlockOut_GL/GLApp/GLApp.cpp.fs 2007-08-02 15:44:10.000000000 +0200 ++++ BlockOutII-2.3/BlockOut_GL/GLApp/GLApp.cpp 2007-11-30 20:46:53.000000000 +0100 +@@ -20,30 +20,8 @@ GLApplication::GLApplication() { + + int GLApplication::ToggleFullscreen() { + +- int errCode; +- +- InvalidateDeviceObjects(); +- +- m_bWindowed = !m_bWindowed; +- +- Uint32 flags; +- if( m_bWindowed ) flags = SDL_OPENGL; +- else flags = SDL_OPENGL | SDL_FULLSCREEN; +- +- if( SDL_SetVideoMode( m_screenWidth, m_screenHeight, 0, flags ) == NULL ) +- { +- printf("SDL_SetVideoMode() failed.\n"); +- return GL_FAIL; +- } +- +- SDL_Surface *vSurf = SDL_GetVideoSurface(); +- m_bitsPerPixel = vSurf->format->BitsPerPixel; +- +- errCode = RestoreDeviceObjects(); +- if( !errCode ) { +- printGlError(); +- exit(1); +- } ++ if (SDL_WM_ToggleFullScreen(SDL_GetVideoSurface())) ++ m_bWindowed = !m_bWindowed; + + return GL_OK; + +@@ -69,6 +47,8 @@ int GLApplication::Create(int width, int + printf("SDL_Init() failed : %s\n" , SDL_GetError() ); + return GL_FAIL; + } ++ ++ atexit(SDL_Quit); + + //SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 0); + SDL_EnableUNICODE( 1 ); +diff -up BlockOutII-2.3/BlockOut_GL/BlockOut.cpp.fs BlockOutII-2.3/BlockOut_GL/BlockOut.cpp +--- BlockOutII-2.3/BlockOut_GL/BlockOut.cpp.fs 2007-08-02 15:44:09.000000000 +0200 ++++ BlockOutII-2.3/BlockOut_GL/BlockOut.cpp 2007-11-30 20:44:24.000000000 +0100 +@@ -120,7 +120,7 @@ int BlockOut::FrameMove() + break; + case 100: // Exit + InvalidateDeviceObjects(); +- _exit(0); ++ exit(0); + break; + } + break; diff --git a/BlockOutII-2.3-syslibs.patch b/BlockOutII-2.3-syslibs.patch new file mode 100644 index 0000000..e4aa68f --- /dev/null +++ b/BlockOutII-2.3-syslibs.patch @@ -0,0 +1,42 @@ +diff -up BlockOutII-2.3/contrib/ImageLib/src/Makefile~ BlockOutII-2.3/contrib/ImageLib/src/Makefile +--- BlockOutII-2.3/contrib/ImageLib/src/Makefile~ 2007-11-25 22:38:29.000000000 +0100 ++++ BlockOutII-2.3/contrib/ImageLib/src/Makefile 2007-11-25 22:38:29.000000000 +0100 +@@ -9,25 +9,11 @@ + # All source files needed for the library + # + +-SRC = gif/gif.c CImage.cpp png/zlib/adler32.c png/zlib/compress.c \ +- png/zlib/crc32.c png/zlib/deflate.c png/zlib/gzio.c png/zlib/infback.c \ +- png/zlib/inffast.c png/zlib/inflate.c png/zlib/inftrees.c png/zlib/trees.c \ +- png/zlib/uncompr.c png/zlib/zutil.c png/png/png.c png/png/pngerror.c \ +- png/png/pnggccrd.c png/png/pngget.c png/png/pngmem.c png/png/pngpread.c \ +- png/png/pngread.c png/png/pngrio.c png/png/pngrtran.c png/png/pngrutil.c \ +- png/png/pngset.c png/png/pngtrans.c png/png/pngvcrd.c png/png/pngwio.c \ +- png/png/pngwrite.c png/png/pngwtran.c png/png/pngwutil.c png/hpng.c \ ++SRC = gif/gif.c CImage.cpp png/hpng.c \ + jpg/H2v2.cpp jpg/idct.cpp jpg/jpegdecoder.cpp jpg/jpegdecodermain.cpp + + +-OBJ= gif/gif.o CImage.o png/zlib/adler32.o png/zlib/compress.o \ +- png/zlib/crc32.o png/zlib/deflate.o png/zlib/gzio.o png/zlib/infback.o \ +- png/zlib/inffast.o png/zlib/inflate.o png/zlib/inftrees.o png/zlib/trees.o \ +- png/zlib/uncompr.o png/zlib/zutil.o png/png/png.o png/png/pngerror.o \ +- png/png/pnggccrd.o png/png/pngget.o png/png/pngmem.o png/png/pngpread.o \ +- png/png/pngread.o png/png/pngrio.o png/png/pngrtran.o png/png/pngrutil.o \ +- png/png/pngset.o png/png/pngtrans.o png/png/pngvcrd.o png/png/pngwio.o \ +- png/png/pngwrite.o png/png/pngwtran.o png/png/pngwutil.o png/hpng.o \ ++OBJ= gif/gif.o CImage.o png/hpng.o \ + jpg/H2v2.o jpg/idct.o jpg/jpegdecoder.o jpg/jpegdecodermain.o + + #--------------------------------------------------------------------- +diff -up BlockOutII-2.3/contrib/ImageLib/src/png/hpng.c~ BlockOutII-2.3/contrib/ImageLib/src/png/hpng.c +--- BlockOutII-2.3/contrib/ImageLib/src/png/hpng.c~ 2007-11-25 22:39:13.000000000 +0100 ++++ BlockOutII-2.3/contrib/ImageLib/src/png/hpng.c 2007-11-25 22:39:13.000000000 +0100 +@@ -1,6 +1,6 @@ + #include + #include +-#include "png/png.h" ++#include + #include "hpng.h" + + char PngErrorMessage[1024]; diff --git a/BlockOutII.desktop b/BlockOutII.desktop new file mode 100644 index 0000000..192db9d --- /dev/null +++ b/BlockOutII.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=BlockOut II +Comment=BlockOut II is a free adaptation of the original BlockOut DOS game +Exec=BlockOutII +Icon=BlockOutII +Terminal=false +Type=Application +Categories=Game;BlocksGame; diff --git a/BlockOutII.png b/BlockOutII.png new file mode 100644 index 0000000..58b0bc2 Binary files /dev/null and b/BlockOutII.png differ diff --git a/BlockOutII.spec b/BlockOutII.spec new file mode 100644 index 0000000..9d19a27 --- /dev/null +++ b/BlockOutII.spec @@ -0,0 +1,129 @@ +# Copyright (c) 2007 oc2pus +# Copyright (c) 2007 Hans de Goede +# This file and all modifications and additions to the pristine +# package are under the same license as the package itself. + +Name: BlockOutII +Version: 2.3 +Release: 3%{?dist} +Summary: A free adaptation of the original BlockOut DOS game +Group: Amusements/Games +License: GPLv2+ +URL: http://www.blockout.net/blockout2/ +# To regenerate: +# cvs -z3 -d:pserver:anonymous@blockout.cvs.sourceforge.net:/cvsroot/blockout co -D 2007-11-25 -P blockout +# mv blockout BlockOutII-2.3 +# cd BlockOutII-2.3 +# rm -r `find -name CVS` contrib/dxsdk8.rar contrib/D3DTools BlockOut/setup +# rm -r CVSROOT contrib/ImageLib/src/png/png contrib/ImageLib/src/png/zlib +# mp32ogg BlockOut/sounds/music.mp3 +# cd .. +# tar cvfj BlockOutII-2.3.tar.bz2 BlockOutII-2.3 +Source0: %{name}-%{version}.tar.bz2 +Source1: %{name}.desktop +Source2: %{name}.png +Patch0: BlockOutII-2.3-syslibs.patch +Patch1: BlockOutII-2.3-64bit.patch +Patch2: BlockOutII-2.3-bl2Home.patch +Patch3: BlockOutII-2.3-music.patch +Patch4: BlockOutII-2.3-restore-resolution.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: SDL_mixer-devel libpng-devel desktop-file-utils +Requires: hicolor-icon-theme + +%description +BlockOut II is a free adaptation of the original BlockOut +DOS game edited by California Dreams in 1989. BlockOut II +has the same features than the original game with few graphic +improvements. The score calculation is also nearly similar to +the original game. BlockOut II has been designed by an addicted +player for addicted players. BlockOut II is an open source +project available for both Windows and Linux. + +Blockout is a registered trademark of Kadon Enterprises, Inc., +used by permission for the BlockOut II application by Jean-Luc +Pons. + + +%prep +%setup -q +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 -z .fs +chmod -x `find -type f` +iconv -f ISO8859-1 -t UTF8 BlockOut/README.txt > t; mv t BlockOut/README.txt + + +%build +pushd contrib/ImageLib/src +make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS -Dlinux -c" \ + CXXFLAGS="$RPM_OPT_FLAGS -Dlinux -c" +popd + +pushd BlockOut_GL +make %{?_smp_mflags} \ + CXXFLAGS="$RPM_OPT_FLAGS -Dlinux `sdl-config --cflags` -I../contrib/ImageLib/src -c" \ + SDL_ROOT=%{_prefix} LIBS="-L../contrib/ImageLib/src -lpng -lz" \ + IMGLIB_ROOT=../contrib/ImageLib/src +popd + + +%install +rm -rf $RPM_BUILD_ROOT +mkdir -p $RPM_BUILD_ROOT%{_bindir} +mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}/images +mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}/sounds + +install -m 755 BlockOut_GL/blockout $RPM_BUILD_ROOT%{_bindir}/%{name} +install -p -m 644 BlockOut/images/* $RPM_BUILD_ROOT%{_datadir}/%{name}/images +install -p -m 644 BlockOut/sounds/* $RPM_BUILD_ROOT%{_datadir}/%{name}/sounds + +# below is the desktop file and icon stuff. +mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications +desktop-file-install --vendor fedora \ + --dir $RPM_BUILD_ROOT%{_datadir}/applications \ + %{SOURCE1} +mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps +install -p -m 644 %{SOURCE2} \ + $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps + + +%clean +rm -rf $RPM_BUILD_ROOT + + +%post +touch --no-create %{_datadir}/icons/hicolor || : +if [ -x %{_bindir}/gtk-update-icon-cache ]; then + %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || : +fi + +%postun +touch --no-create %{_datadir}/icons/hicolor || : +if [ -x %{_bindir}/gtk-update-icon-cache ]; then + %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || : +fi + + +%files +%defattr(-,root,root,-) +%doc BlockOut/README.txt +%{_bindir}/%{name} +%{_datadir}/%{name} +%{_datadir}/applications/fedora-%{name}.desktop +%{_datadir}/icons/hicolor/32x32/apps/%{name}.png + + +%changelog +* Thu Nov 29 2007 Hans de Goede 2.3-3 +- Fix restoration of resolution when leaving fullscreen +- Don't use macros in cvs co instructions + +* Mon Nov 26 2007 Hans de Goede 2.3-2 +- Add missing libpng-devel BR (bz 398791) +- Add include date in CVS tarbal reproduction instructions (bz 398791) + +* Sat Nov 24 2007 Hans de Goede 2.3-1 +- Initial Fedora Package based on the packman package diff --git a/sources b/sources index e69de29..9388d0f 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +2aeac4d00a36ae570a12b5561832de6a BlockOutII-2.3.tar.bz2