Changes between Version 4 and Version 5 of PatchingDebs


Ignore:
Timestamp:
01/13/16 09:47:13 (8 years ago)
Author:
Samuli Seppänen
Comment:

Make contents more generic and add instructions about patching mingw-w64

Legend:

Unmodified
Added
Removed
Modified
  • PatchingDebs

    v4 v5  
    11= Introduction =
    22
    3 The NSI script in [https://github.com/OpenVPN/openvpn-build openvpn-build repository] makes use of [http://nsis.sourceforge.net/Environmental_Variables:_append,_prepend,_and_remove_entries EnvVarUpdate.nsh] to append ''OpenVPN\bin'' to the system-wide PATH variable on Windows. When using default NSIS builds, PATH can't be longer than 1024 characters or OpenVPN install destroys it. To support longer PATHs you need rebuild ''makensis'' with larger ''NSIS_MAX_STRLEN''.
     3Official OpenVPN builds for Windows use the [https://github.com/OpenVPN/openvpn-build openvpn-build buildsystem], which uses MakeNSIS and mingw-w64 internally. Patched versions of both are required due to few issues:
    44
    5 = Rebuilding NSIS on Ubuntu 12.04 =
     5* The ''openvpn.nsi'' script makes use of [http://nsis.sourceforge.net/Environmental_Variables:_append,_prepend,_and_remove_entries EnvVarUpdate.nsh] to append ''OpenVPN\bin'' to the system-wide PATH variable on Windows. When using default NSIS builds, PATH can't be longer than 1024 characters or OpenVPN install destroys it. To support longer PATHs you need rebuild ''makensis'' with larger ''NSIS_MAX_STRLEN''.
     6* The mingw-w64 packages have buggy header files which prevent building of recent OpenVPN versions (2.3.8+ or so).
    67
    7 Here we rebuild ''nsis'' and ''nsis-common'' Debian packages with custom configuration. It is suggested that you [wiki:SettingUpGenericBuildsystem set up the openvpn-build buildsystem] using the automated script, because that installs most mingw-w64 tools you'll need. Once openvpn-build is setup, a few extra packages have to be installed:
     8= Preparations =
     9
     10You need apt-src to build customized Debian packages:
    811
    912{{{
    10 $ apt-get update
    11 $ apt-get install apt-src g++-mingw-w64
     13$ apt-get install apt-src
    1214}}}
    1315
    14 Next fetch the NSIS sources:
     16Because apt-src is a bit messy, it's best to create a separate working directory:
    1517
    1618{{{
     19$ mkdir ~/apt-src
     20}}}
     21
     22= Rebuilding NSIS =
     23
     24Here we rebuild ''nsis'' and ''nsis-common'':
     25
     26{{{
     27$ cd ~/apt-src
    1728$ apt-src install nsis
    1829}}}
     
    2536}}}
    2637
    27 Now build the packages:
     38Next add a changelog entry as described below, then build the packages:
    2839
    2940{{{
     
    3142}}}
    3243
    33 Finally, install the customized packages using dpkg:
     44= Rebuilding mingw-w64 =
     45
     46The process is about the same as for NSIS:
    3447
    3548{{{
    36 $ dpkg -i nsis_2.46-* nsis-common_2.46-*
     49$ cd ~/apt-src
     50$ apt-src install mingw
    3751}}}
    3852
    39 If you now rebuild openvpn, the installer should support appending to long PATHs.
     53Download the two patches (''fwptypes.h.patch'' and ''iketypes.h.patch''). Copy the patches to the patches directory and the series file:
    4054
    41 = Installing patched nsis_2.46 Ubuntu packages =
     55{{{
     56$ cp *.patch ~/apt-src/mingw-w64-3.1.0/debian/patches
     57$ echo fwptypes.h.patch >> ~/apt-src/mingw-w64-3.1.0/debian/patches/series
     58$ echo iketypes.h.patch >> ~/apt-src/mingw-w64-3.1.0/debian/patches/series
     59}}}
    4260
    43 Instead of patching and building nsis yourself, you can try installing standard nsis packages from Ubuntu 12.04 repositories and then installing
    44 [http://build.openvpn.net/downloads/packaging these nsis packages] on top of those. Their build number is set high to prevent standard packages from overwriting them during system upgrades.
     61Next add a changelog entry as described below, then build mingw-w64:
     62
     63{{{
     64$ apt-src build mingw-w64
     65}}}
     66
     67= Adding changelog entries =
     68
     69Adding a changelog entry is important, because that determines the version and build number of the package. The changelog is in ''debian/changelog'', and an entry looks like this:
     70
     71{{{
     72mingw-w64 (3.1.0-101) unstable; urgency=medium
     73
     74  * Fixes to header files to allow OpenVPN builds
     75
     76 -- John Doe <john@domain.com>  Wed, 13 Jan 2016 07:00:00 +0000
     77}}}
     78
     79Note the last number (101) in the version: it prevents the package from getting updates (broken) by package updates from the stock Ubuntu repositories.