How to create a .patch file?


When building open source packages, we don't just get binary packages. The bigger, we approach the scientific and technical achievements and observe the evolution of scientific and technical activities in the world. The scientific and technical achievements in the world are finite, but your imagination and your creative potential based on it are limitless.

Windows believers may not even know: Microsoft has joined the open source community.

Creating a patch file is a basic operation during the building of the packages. You seem to know how to do it. If so, this article lets you visualize a stage where I built the Omarine operating system. If you are a beginner, this article provides detailed instructions on how to create patch files and to patch code.

The Poppler package contains a PDF rendering library and command line tools that are used to manipulate PDF files. Version 0.71.0 of Poppler does not define the GBool data type and the gTrue, gFalse Boolean values. Therefore dependent packages that use old code such as Libreoffice need to be patched.
First, you rename the libreoffice- directory to libreoffice-

mv libreoffice- libreoffice-

Then create a replica directory

cp -r libreoffice-

The file needs to be modified by adding the definition for GBool, gTrue, gFalse, inserting them into line 23:

sed -i '23 i typedef bool GBool;\n#define gTrue true\n#define gFalse false\n' \

Now we create the libreoffice- file:

diff -Naur libreoffice- \ > libreoffice-

The contents of the patch file are as follows:

--- libreoffice- 2018-10-30 02:55:29.000000000 +0700
+++ 2018-12-02 09:55:57.250834967 +0700
@@ -20,6 +20,10 @@

+typedef bool GBool;
+#define gTrue true
+#define gFalse false
#include <sal/types.h>
#include <config_poppler.h>

Performing the patch
Patches can be applied to build package multiple times from the source code. You run the following command:

patch -Np1 -i ../libreoffice-

Current rating: 4.5


There are currently no comments

New Comment


required (not published)



What is 2 × 3?