Building 64-bit FreeType libraries for OpenJDK 6 on Windows

The FreeType build for Windows amd64 is similar to the i586 build but has a much more complex configuration. Contrary to the i586 version, the amd64 library can be built with freely available tools using Microsoft Visual Studio 2005 Express Edition with the Windows Server 2003 SP1 Platform SDK.

Getting ready

For this recipe, we need to have Windows 7 SP1 amd64 running.

How to do it...

The following steps will help us in building FreeType:

  1. Download the Visual Studio 2005 Express Edition from http://www.microsoft.com/en-in/default.aspx and install it to the default location. The messages about Windows 7 compatibility problems may be ignored.
  2. Install VS80sp1-KB926748-X86-INTL and VS80sp1-KB932232-X86-ENU Visual Studio updates.
  3. Download Windows Server 2003 SP1 Platform SDK from http://www.microsoft.com/en-in/default.aspx and install it using the default installation path. AMD-64 components are required for the build.
  4. Perform steps 2, 3, and 4 from the previous recipe to download and adjust FreeType sources.
  5. From the Start menu go to Microsoft Platform SDK for Windows Server 2003 SP1 | Open Build Environment Window | Windows Server 2003 64-bit Build Environment | Set Win Svr 2003 x64 Build Env (Retail).
  6. From the cmd.exe window that appears, run (the administrator permissions warning may be ignored):
    >"C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\VCExpress.exe"
    
  7. In the main menu navigate to Tools | Options | Projects and Solutions | VC++ Directories and adjust the following directories:
    Executable files:
    
    C:\Program Files\Microsoft Platform SDK\Bin\win64\x86\AMD64
    C:\Program Files\Microsoft Platform SDK\Bin
    C:\Windows\System32
    
    Include files:
    C:\Program Files\Microsoft Platform SDK\Include
    C:\Program Files\Microsoft Platform SDK\Include\crt
    
    Library files:
    C:\Program Files\Microsoft Platform SDK\Lib\AMD64
  8. Open the FreeType solution at this path freetype-2.5.2\builds\windows\vc2005\freetype.sln.
  9. In the menu, navigate to Project | Properties | Configuration Properties | Configuration Manager and choose <New ...> under Active solution platform.
  10. Type new platform x64 and choose Win32 from Copy settings from.
  11. On the Configuration Manager form, navigate to Active solution configuration | LIB Release Multithreaded and then go to Active solution platform | x64.
  12. On the same form, in the grid for the FreeType project, navigate to Configuration | Release multithreaded and leave the Win32 value under the Platform menu.
  13. In the Configuration Properties menu, check whether Configuration Type is set to Static Library (.lib).
  14. Navigate to Configuration Properties | C/C++ | Preprocessor and change the WIN32 value in the Processor Definitions string to WIN64.
  15. Run Build Solution under Build, the freetype252MT.lib library will be placed into the freetype-2.5.2\objs\win32\vc2005 directory. Rename it to freetype.lib, and save it for later.
  16. In the Configuration Properties menu, change Configuration Type to Dynamic Library (.dll) and choose Apply.
  17. Navigate to Configuration Properties | Linker | Input and put bufferoverflowU.lib into the Additional Dependencies field.
  18. Navigate to Configuration Properties | Linker | Command Line and put /MACHINE:AMD64 into the Additional options field.
  19. Clean and build the solution. Target libraries freetype.dll and freetype.exp will be placed into the freetype-2.5.2\objs\release_mt directory.

The directory with three result files will be denoted by the ALT_FREETYPE_LIB_PATH environment variable during OpenJDK builds.

How it works...

Visual Studio 2005 Express does not support amd64 architecture, so the setup to use amd64 compilers from Windows SDK takes most of this recipe.

See also

  • The Building 32-bit FreeType libraries for OpenJDK 6 on Windows recipe
  • The FreeType official website http://freetype.org/