git: 3bc831e5ab01 - main - www/waterfox: resurect removed port before update to new release

From: Vladimir Druzenko <vvd_at_FreeBSD.org>
Date: Tue, 09 Jul 2024 01:14:24 UTC
The branch main has been updated by vvd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3bc831e5ab010280176c17ed8788d040b0bb3201

commit 3bc831e5ab010280176c17ed8788d040b0bb3201
Author:     Vladimir Druzenko <vvd@FreeBSD.org>
AuthorDate: 2024-07-09 00:36:36 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-07-09 01:07:24 +0000

    www/waterfox: resurect removed port before update to new release
    
    This reverts commit 8bbfbba74e2ee5df4b64cbc639847d6419160f67.
    
    PR:     278672
---
 www/Makefile                                       |    1 +
 www/waterfox/Makefile                              |   77 +
 www/waterfox/distinfo                              |    3 +
 www/waterfox/files/patch-addon-search              |   70 +
 .../files/patch-browser-app-nsBrowserApp.cpp       |   12 +
 www/waterfox/files/patch-bug1021761                | 1218 +++++++++
 www/waterfox/files/patch-bug1036008                |  523 ++++
 www/waterfox/files/patch-bug1134077                |   65 +
 www/waterfox/files/patch-bug1144632                |   23 +
 www/waterfox/files/patch-bug1186967                |   41 +
 www/waterfox/files/patch-bug1203273                |   68 +
 www/waterfox/files/patch-bug1231203                |  203 ++
 www/waterfox/files/patch-bug1246883                |   56 +
 www/waterfox/files/patch-bug1275062                |  344 +++
 www/waterfox/files/patch-bug1288587                |   67 +
 www/waterfox/files/patch-bug1321069                |  100 +
 www/waterfox/files/patch-bug1321960                |  134 +
 www/waterfox/files/patch-bug1324042                |   33 +
 www/waterfox/files/patch-bug1325888                |   39 +
 www/waterfox/files/patch-bug1331209                |  571 ++++
 www/waterfox/files/patch-bug1334465                |   62 +
 www/waterfox/files/patch-bug1334981                |   29 +
 www/waterfox/files/patch-bug1338764                |  120 +
 www/waterfox/files/patch-bug1340039                |  232 ++
 www/waterfox/files/patch-bug1343147                |  117 +
 www/waterfox/files/patch-bug1345058                |  620 +++++
 www/waterfox/files/patch-bug1346126                |   27 +
 www/waterfox/files/patch-bug1346535                |  504 ++++
 www/waterfox/files/patch-bug1347984                |   96 +
 www/waterfox/files/patch-bug1352453                |   27 +
 www/waterfox/files/patch-bug1355576                |  262 ++
 www/waterfox/files/patch-bug1356854                |   28 +
 www/waterfox/files/patch-bug1357523                |   96 +
 www/waterfox/files/patch-bug1360278                |  184 ++
 www/waterfox/files/patch-bug1360603                |  101 +
 www/waterfox/files/patch-bug1363038                |   68 +
 www/waterfox/files/patch-bug1370508                |   79 +
 www/waterfox/files/patch-bug1370791                |  104 +
 www/waterfox/files/patch-bug1372107                |   82 +
 www/waterfox/files/patch-bug1373371                |   44 +
 www/waterfox/files/patch-bug1377158                |  285 ++
 www/waterfox/files/patch-bug1377587                |  929 +++++++
 www/waterfox/files/patch-bug1379148                |  366 +++
 www/waterfox/files/patch-bug1381761                |  362 +++
 www/waterfox/files/patch-bug1381815                |  278 ++
 www/waterfox/files/patch-bug1382359                |  138 +
 www/waterfox/files/patch-bug1383501                |   83 +
 www/waterfox/files/patch-bug1384121                |  218 ++
 www/waterfox/files/patch-bug1384701                |  796 ++++++
 www/waterfox/files/patch-bug1385013                |   92 +
 www/waterfox/files/patch-bug1385609                |  102 +
 www/waterfox/files/patch-bug1387170                |  148 ++
 www/waterfox/files/patch-bug1387811                |   42 +
 www/waterfox/files/patch-bug1388020                |  158 ++
 www/waterfox/files/patch-bug1388319                |   30 +
 www/waterfox/files/patch-bug1388744                |   14 +
 www/waterfox/files/patch-bug1393235                |   88 +
 www/waterfox/files/patch-bug1393283                |  144 +
 www/waterfox/files/patch-bug1393627                |   30 +
 www/waterfox/files/patch-bug1394146                |  119 +
 www/waterfox/files/patch-bug1394601                |   26 +
 www/waterfox/files/patch-bug1395246                |   83 +
 www/waterfox/files/patch-bug1395486                |   53 +
 www/waterfox/files/patch-bug1396722                | 1426 ++++++++++
 www/waterfox/files/patch-bug1397114                |  105 +
 www/waterfox/files/patch-bug1397671                |  105 +
 www/waterfox/files/patch-bug1397686                |   69 +
 www/waterfox/files/patch-bug1397795                |   61 +
 www/waterfox/files/patch-bug1397989                |   42 +
 www/waterfox/files/patch-bug1398021                | 2737 ++++++++++++++++++++
 www/waterfox/files/patch-bug1398539                |  159 ++
 www/waterfox/files/patch-bug1398581                |  125 +
 www/waterfox/files/patch-bug1398806                |  438 ++++
 www/waterfox/files/patch-bug1398983                |   25 +
 www/waterfox/files/patch-bug1399091                |   36 +
 www/waterfox/files/patch-bug1399177                |   47 +
 www/waterfox/files/patch-bug1399336                |  153 ++
 www/waterfox/files/patch-bug1399412                |   31 +
 www/waterfox/files/patch-bug1399520                |   93 +
 www/waterfox/files/patch-bug1399939                |   36 +
 www/waterfox/files/patch-bug1400238                |   30 +
 www/waterfox/files/patch-bug1400540                |   47 +
 www/waterfox/files/patch-bug1400674                |   70 +
 www/waterfox/files/patch-bug1400839                |   49 +
 www/waterfox/files/patch-bug1401063                |  160 ++
 www/waterfox/files/patch-bug1401416                |   29 +
 www/waterfox/files/patch-bug1401522                |   34 +
 www/waterfox/files/patch-bug1401573                |   27 +
 www/waterfox/files/patch-bug1401726                |   60 +
 www/waterfox/files/patch-bug1401876                |   48 +
 www/waterfox/files/patch-bug1401878                |   70 +
 www/waterfox/files/patch-bug1401909                |   30 +
 www/waterfox/files/patch-bug1401992                |  239 ++
 www/waterfox/files/patch-bug1402025                |  201 ++
 www/waterfox/files/patch-bug1402094                |   57 +
 www/waterfox/files/patch-bug1402205                |   77 +
 www/waterfox/files/patch-bug1402218                |   91 +
 www/waterfox/files/patch-bug1402366                |   87 +
 www/waterfox/files/patch-bug1402377                |   36 +
 www/waterfox/files/patch-bug1402380                |  257 ++
 www/waterfox/files/patch-bug1402442                |  181 ++
 www/waterfox/files/patch-bug1402469                |  182 ++
 www/waterfox/files/patch-bug1402681                |  138 +
 www/waterfox/files/patch-bug1402715                |   44 +
 www/waterfox/files/patch-bug1402766                |   69 +
 www/waterfox/files/patch-bug1402871                |   28 +
 www/waterfox/files/patch-bug1402951                |  164 ++
 www/waterfox/files/patch-bug1402966                |   51 +
 www/waterfox/files/patch-bug1402981                |  172 ++
 www/waterfox/files/patch-bug1403282                |  180 ++
 www/waterfox/files/patch-bug1403349                | 1216 +++++++++
 www/waterfox/files/patch-bug1403465                |   60 +
 www/waterfox/files/patch-bug1403466                |   50 +
 www/waterfox/files/patch-bug1403473                |   27 +
 www/waterfox/files/patch-bug1403592                |  157 ++
 www/waterfox/files/patch-bug1403721                |  182 ++
 www/waterfox/files/patch-bug1403998                |  167 ++
 www/waterfox/files/patch-bug1404057                |  139 +
 www/waterfox/files/patch-bug1404180                |   68 +
 www/waterfox/files/patch-bug1404323                |   27 +
 www/waterfox/files/patch-bug1404324                |  299 +++
 www/waterfox/files/patch-bug1404568                |  120 +
 www/waterfox/files/patch-bug1404651                |   39 +
 www/waterfox/files/patch-bug1404714                |   34 +
 www/waterfox/files/patch-bug1404760                |   65 +
 www/waterfox/files/patch-bug1404910                |  170 ++
 www/waterfox/files/patch-bug1405199                |   45 +
 www/waterfox/files/patch-bug1405267                |   32 +
 www/waterfox/files/patch-bug1405364                |   84 +
 www/waterfox/files/patch-bug1405377                |   31 +
 www/waterfox/files/patch-bug1405635                |  100 +
 www/waterfox/files/patch-bug1405655                |  256 ++
 www/waterfox/files/patch-bug1405720                |  122 +
 www/waterfox/files/patch-bug1405761                |  109 +
 www/waterfox/files/patch-bug1405878                |  120 +
 www/waterfox/files/patch-bug1406222                |   39 +
 www/waterfox/files/patch-bug1406229                |   32 +
 www/waterfox/files/patch-bug1406254                |  155 ++
 www/waterfox/files/patch-bug1406396                |  211 ++
 www/waterfox/files/patch-bug1406474                |   37 +
 www/waterfox/files/patch-bug1406859                |   50 +
 www/waterfox/files/patch-bug1407001                |   33 +
 www/waterfox/files/patch-bug1407092                |   28 +
 www/waterfox/files/patch-bug1407243                |   31 +
 www/waterfox/files/patch-bug1407245                |   34 +
 www/waterfox/files/patch-bug1407414                |   25 +
 www/waterfox/files/patch-bug1407680                |  115 +
 www/waterfox/files/patch-bug1407936                |   71 +
 www/waterfox/files/patch-bug1408017                |   40 +
 www/waterfox/files/patch-bug1408276                |  170 ++
 www/waterfox/files/patch-bug1408397                |  185 ++
 www/waterfox/files/patch-bug1408631                |  174 ++
 www/waterfox/files/patch-bug1408672                |   37 +
 www/waterfox/files/patch-bug1408990                |   34 +
 www/waterfox/files/patch-bug1409101                |   23 +
 www/waterfox/files/patch-bug1409277                |   38 +
 www/waterfox/files/patch-bug1409496                |   25 +
 www/waterfox/files/patch-bug1409649                |   34 +
 www/waterfox/files/patch-bug1409951                |  177 ++
 www/waterfox/files/patch-bug1410134                |   52 +
 www/waterfox/files/patch-bug1410146                |   27 +
 www/waterfox/files/patch-bug1410420                |  140 +
 www/waterfox/files/patch-bug1410457                |  117 +
 www/waterfox/files/patch-bug1410634                |  145 ++
 www/waterfox/files/patch-bug1410808                |   27 +
 www/waterfox/files/patch-bug1411415                |  383 +++
 www/waterfox/files/patch-bug1411745                |   26 +
 www/waterfox/files/patch-bug1412011                |  100 +
 www/waterfox/files/patch-bug1412145                |  286 ++
 www/waterfox/files/patch-bug1412420                |  284 ++
 www/waterfox/files/patch-bug1412558                |   42 +
 www/waterfox/files/patch-bug1412741                |   87 +
 www/waterfox/files/patch-bug1412882                |  192 ++
 www/waterfox/files/patch-bug1413143                |  306 +++
 www/waterfox/files/patch-bug1413741                |   25 +
 www/waterfox/files/patch-bug1414292                |  171 ++
 www/waterfox/files/patch-bug1414425                |  231 ++
 www/waterfox/files/patch-bug1414452                |   70 +
 www/waterfox/files/patch-bug1414945                |   43 +
 www/waterfox/files/patch-bug1415291                |   52 +
 www/waterfox/files/patch-bug1415441                |   22 +
 www/waterfox/files/patch-bug1415582                |   34 +
 www/waterfox/files/patch-bug1415598                |   58 +
 www/waterfox/files/patch-bug1415883                |   44 +
 www/waterfox/files/patch-bug1415946                |   33 +
 www/waterfox/files/patch-bug1416307                |   94 +
 www/waterfox/files/patch-bug1416529                |  101 +
 www/waterfox/files/patch-bug1417661                |   37 +
 www/waterfox/files/patch-bug1417751                |  379 +++
 www/waterfox/files/patch-bug1417797                |   25 +
 www/waterfox/files/patch-bug1417869                |   42 +
 www/waterfox/files/patch-bug1418009                |   28 +
 www/waterfox/files/patch-bug1418152                |   36 +
 www/waterfox/files/patch-bug1418757                |  169 ++
 www/waterfox/files/patch-bug1418854                |  102 +
 www/waterfox/files/patch-bug1418894                |  244 ++
 www/waterfox/files/patch-bug1419508                |   29 +
 www/waterfox/files/patch-bug1419762                |   69 +
 www/waterfox/files/patch-bug1420001                |   67 +
 www/waterfox/files/patch-bug1421009                |   24 +
 www/waterfox/files/patch-bug1421963                |   39 +
 www/waterfox/files/patch-bug1422036                |  229 ++
 www/waterfox/files/patch-bug1422389                |   28 +
 www/waterfox/files/patch-bug1422518                |   27 +
 www/waterfox/files/patch-bug1422545                |   38 +
 www/waterfox/files/patch-bug1423647                |   37 +
 www/waterfox/files/patch-bug1423770                |   44 +
 www/waterfox/files/patch-bug1424311                |   66 +
 www/waterfox/files/patch-bug1424373                |  305 +++
 www/waterfox/files/patch-bug1424469                |   36 +
 www/waterfox/files/patch-bug1425107                |   43 +
 www/waterfox/files/patch-bug1425267                |   55 +
 www/waterfox/files/patch-bug1425520                |   27 +
 www/waterfox/files/patch-bug1425612                |   85 +
 www/waterfox/files/patch-bug1425780                |   34 +
 www/waterfox/files/patch-bug1425878                |   46 +
 www/waterfox/files/patch-bug1426042                |   31 +
 www/waterfox/files/patch-bug1426087                |   80 +
 www/waterfox/files/patch-bug1426783                |   38 +
 www/waterfox/files/patch-bug1426801                |   38 +
 www/waterfox/files/patch-bug1426869                |   25 +
 www/waterfox/files/patch-bug1426996                |   29 +
 www/waterfox/files/patch-bug1427118                |   84 +
 www/waterfox/files/patch-bug1427126                |   25 +
 www/waterfox/files/patch-bug1427480                |   40 +
 www/waterfox/files/patch-bug1428589                |   50 +
 www/waterfox/files/patch-bug1428612                |   69 +
 www/waterfox/files/patch-bug1429373                |  142 +
 www/waterfox/files/patch-bug1429666                |  212 ++
 www/waterfox/files/patch-bug1429764                |  207 ++
 www/waterfox/files/patch-bug1430508                |   56 +
 www/waterfox/files/patch-bug1430511                |   72 +
 www/waterfox/files/patch-bug1430557                |   51 +
 www/waterfox/files/patch-bug1431192                |   44 +
 www/waterfox/files/patch-bug1431285                |   34 +
 www/waterfox/files/patch-bug1431370                |   30 +
 www/waterfox/files/patch-bug1431434                |   48 +
 www/waterfox/files/patch-bug1431781                |   30 +
 www/waterfox/files/patch-bug1432793                |  218 ++
 www/waterfox/files/patch-bug1432870                |   29 +
 www/waterfox/files/patch-bug1432915                |   27 +
 www/waterfox/files/patch-bug1433609                |  103 +
 www/waterfox/files/patch-bug1433671                |  179 ++
 www/waterfox/files/patch-bug1433747                |   24 +
 www/waterfox/files/patch-bug1434384                |   41 +
 www/waterfox/files/patch-bug1434580                |   29 +
 www/waterfox/files/patch-bug1435036                |   97 +
 www/waterfox/files/patch-bug1435098                |   46 +
 www/waterfox/files/patch-bug1435286                |  294 +++
 www/waterfox/files/patch-bug1435320                |   42 +
 www/waterfox/files/patch-bug1435530                |  208 ++
 www/waterfox/files/patch-bug1435859                |   38 +
 www/waterfox/files/patch-bug1436117                |   42 +
 www/waterfox/files/patch-bug1436768                |  106 +
 www/waterfox/files/patch-bug1437087                |   88 +
 www/waterfox/files/patch-bug1437214                |  217 ++
 www/waterfox/files/patch-bug1437450                |   30 +
 www/waterfox/files/patch-bug1437507                |   38 +
 www/waterfox/files/patch-bug1437880                |   26 +
 www/waterfox/files/patch-bug1438425                |  662 +++++
 www/waterfox/files/patch-bug1438645                |  210 ++
 www/waterfox/files/patch-bug1439236                |   35 +
 www/waterfox/files/patch-bug1439396                |   39 +
 www/waterfox/files/patch-bug1440943                |   60 +
 www/waterfox/files/patch-bug1442504                |   50 +
 www/waterfox/files/patch-bug1443149                |   32 +
 www/waterfox/files/patch-bug1444083                |   17 +
 www/waterfox/files/patch-bug1444231                |   45 +
 www/waterfox/files/patch-bug1444521                |   26 +
 www/waterfox/files/patch-bug1444541                |   63 +
 www/waterfox/files/patch-bug1445582                |   32 +
 www/waterfox/files/patch-bug1447131                |  160 ++
 www/waterfox/files/patch-bug1447519                |   22 +
 www/waterfox/files/patch-bug1447969                |   26 +
 www/waterfox/files/patch-bug1447989                |   25 +
 www/waterfox/files/patch-bug1448089                |  207 ++
 www/waterfox/files/patch-bug1448136                |   71 +
 www/waterfox/files/patch-bug1448200                |   36 +
 www/waterfox/files/patch-bug1448612                |   72 +
 www/waterfox/files/patch-bug1448863                |  214 ++
 www/waterfox/files/patch-bug1449157                |   26 +
 www/waterfox/files/patch-bug1449352                |   52 +
 www/waterfox/files/patch-bug1450448                |   40 +
 www/waterfox/files/patch-bug1450538                |   27 +
 www/waterfox/files/patch-bug1450565                |   27 +
 www/waterfox/files/patch-bug1451262                |   62 +
 www/waterfox/files/patch-bug1451673                |   28 +
 www/waterfox/files/patch-bug1452619                |  234 ++
 www/waterfox/files/patch-bug1453127                |  605 +++++
 www/waterfox/files/patch-bug1453339                |  172 ++
 www/waterfox/files/patch-bug1453555                |   34 +
 www/waterfox/files/patch-bug1453740                |   35 +
 www/waterfox/files/patch-bug1454285                |  713 +++++
 www/waterfox/files/patch-bug1454572                |   43 +
 www/waterfox/files/patch-bug1455235                |   67 +
 www/waterfox/files/patch-bug1455261                |   27 +
 www/waterfox/files/patch-bug1456512                |  144 +
 www/waterfox/files/patch-bug1456524                |  122 +
 www/waterfox/files/patch-bug1457912                |  169 ++
 www/waterfox/files/patch-bug1458166                |   75 +
 www/waterfox/files/patch-bug1458720                |   99 +
 www/waterfox/files/patch-bug1461203                |   41 +
 www/waterfox/files/patch-bug1461448                |   80 +
 www/waterfox/files/patch-bug1464872                |   96 +
 www/waterfox/files/patch-bug1465108                |  520 ++++
 www/waterfox/files/patch-bug1466606                |  124 +
 www/waterfox/files/patch-bug1466863                |   36 +
 www/waterfox/files/patch-bug1467882                |   74 +
 www/waterfox/files/patch-bug1467938                |   43 +
 www/waterfox/files/patch-bug1469257                |   50 +
 www/waterfox/files/patch-bug1469879                |   44 +
 www/waterfox/files/patch-bug1473041                |   30 +
 www/waterfox/files/patch-bug702179                 |   12 +
 www/waterfox/files/patch-bug712130                 |  481 ++++
 www/waterfox/files/patch-bug730495                 |  545 ++++
 www/waterfox/files/patch-bug826985                 |  171 ++
 www/waterfox/files/patch-bug847568                 |  271 ++
 www/waterfox/files/patch-bug991253                 |   17 +
 www/waterfox/files/patch-config-baseconfig.mk      |   17 +
 www/waterfox/files/patch-env-api-keys              |   21 +
 www/waterfox/files/patch-ijg-libjpeg               |  383 +++
 .../files/patch-ipc_glue_MessageChannel.cpp        |   16 +
 .../files/patch-modules_libpref_init_all.js        |   17 +
 www/waterfox/files/patch-revert-bug1393954         |   36 +
 www/waterfox/files/patch-sample-type               |   13 +
 www/waterfox/files/patch-waterfox286               |   15 +
 www/waterfox/files/patch-z-bug1355143              |  384 +++
 www/waterfox/files/patch-z-bug1382366              |  159 ++
 www/waterfox/files/patch-z-bug1392739              |   28 +
 www/waterfox/files/patch-z-bug1436267              |   37 +
 www/waterfox/files/patch-z-bug1461619              |  151 ++
 www/waterfox/files/patch-z-bug517422               |  502 ++++
 www/waterfox/pkg-descr                             |   24 +
 www/waterfox/pkg-message                           |   41 +
 334 files changed, 43550 insertions(+)

diff --git a/www/Makefile b/www/Makefile
index 62750f6b48b6..2e5fefc609a5 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -2459,6 +2459,7 @@
     SUBDIR += w3mir
     SUBDIR += wabt
     SUBDIR += wasm-pack
+    SUBDIR += waterfox
     SUBDIR += web2ldap
     SUBDIR += webalizer
     SUBDIR += webbrowser
diff --git a/www/waterfox/Makefile b/www/waterfox/Makefile
new file mode 100644
index 000000000000..4afa9bb2ce3f
--- /dev/null
+++ b/www/waterfox/Makefile
@@ -0,0 +1,77 @@
+# $FreeBSD$
+
+PORTNAME=	waterfox
+DISTVERSION=	56.2.3
+PORTREVISION=	2
+CATEGORIES=	www ipv6
+
+MAINTAINER=	jbeich@FreeBSD.org
+COMMENT=	Distilled fork of Firefox
+
+DEPRECATED=	Temporary experiment
+EXPIRATION_DATE=2018-09-27
+
+BUILD_DEPENDS=	nspr>=4.16:devel/nspr \
+		nss>=3.32.1:security/nss \
+		icu>=59.1,1:devel/icu \
+		libevent>=2.1.8:devel/libevent \
+		harfbuzz>=1.4.7:print/harfbuzz \
+		graphite2>=1.3.10:graphics/graphite2 \
+		png>=1.6.31:graphics/png \
+		libvorbis>=1.3.5,3:audio/libvorbis \
+		libvpx>=1.5.0:multimedia/libvpx \
+		sqlite3>=3.19.3:databases/sqlite3 \
+		${PYTHON_PKGNAMEPREFIX}sqlite3>0:databases/py-sqlite3@${PY_FLAVOR} \
+		v4l_compat>0:multimedia/v4l_compat \
+		autoconf-2.13:devel/autoconf213 \
+		yasm:devel/yasm \
+		zip:archivers/zip
+#		soundtouch>=1.9.0:audio/soundtouch \
+
+LIB_DEPENDS=	libv4l2.so:multimedia/libv4l
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	MrAlex94
+GH_PROJECT=	Waterfox
+
+USE_GECKO=	gecko
+MOZ_PKGCONFIG_FILES=	# empty
+USE_MOZILLA=	-soundtouch
+MOZILLA_NAME=	Waterfox
+
+USE_GL=		gl
+
+WATERFOX_ICON=		${MOZILLA}.png
+WATERFOX_ICON_SRC=	${PREFIX}/lib/${MOZILLA}/browser/chrome/icons/default/default256.png
+WATERFOX_DESKTOP=	${MOZSRC}/taskcluster/docker/firefox-snap/firefox.desktop
+MOZ_OPTIONS=	--enable-application=browser \
+		--with-app-name=${MOZILLA} \
+		--with-app-basename=${MOZILLA_NAME} \
+		--with-distribution-id=org.${MOZILLA}project
+
+OPTIONS_DEFAULT=	BUNDLED_CAIRO
+
+.include "${.CURDIR}/../../www/firefox/Makefile.options"
+
+# Inconsistent fallback order (libcubeb vs. audio_device)
+SNDIO_PREVENTS=		${OPTIONS_MULTI_AUDIO:NSNDIO}
+
+post-patch:
+	@${REINPLACE_CMD} -e 's/%u/%U/' -e '/X-MultipleArgs/d' \
+		-e 's/firefox/${MOZILLA}/' \
+		-e 's/Firefox/${MOZILLA_NAME}/' \
+		${WATERFOX_DESKTOP}
+	@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
+		${WRKSRC}/browser/app/nsBrowserApp.cpp
+
+pre-configure:
+	(cd ${WRKSRC} && ${LOCALBASE}/bin/autoconf-2.13)
+	(cd ${WRKSRC}/js/src/ && ${LOCALBASE}/bin/autoconf-2.13)
+
+post-install:
+	${INSTALL_DATA} ${WATERFOX_DESKTOP} \
+		${STAGEDIR}${PREFIX}/share/applications/${MOZILLA}.desktop
+	${MKDIR} ${STAGEDIR}${PREFIX}/share/pixmaps
+	${LN} -sf ${WATERFOX_ICON_SRC} ${STAGEDIR}${PREFIX}/share/pixmaps/${WATERFOX_ICON}
+
+.include <bsd.port.mk>
diff --git a/www/waterfox/distinfo b/www/waterfox/distinfo
new file mode 100644
index 000000000000..fc8b4ed55cf6
--- /dev/null
+++ b/www/waterfox/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1536644593
+SHA256 (MrAlex94-Waterfox-56.2.3_GH0.tar.gz) = 6134501bf3325d3bcd9632405a46f1f1278988e57bf4ca88b61926eb49ef1465
+SIZE (MrAlex94-Waterfox-56.2.3_GH0.tar.gz) = 395126627
diff --git a/www/waterfox/files/patch-addon-search b/www/waterfox/files/patch-addon-search
new file mode 100644
index 000000000000..a2fabaa456b7
--- /dev/null
+++ b/www/waterfox/files/patch-addon-search
@@ -0,0 +1,70 @@
+https://github.com/mozilla/addons/issues/708
+https://github.com/mozilla/addons-frontend/issues/4610
+
+diff --git browser/app/profile/firefox.js browser/app/profile/firefox.js
+index 75c2c5e435e35..4d8c09c02759b 100644
+--- browser/app/profile/firefox.js
++++ browser/app/profile/firefox.js
+@@ -48,12 +48,12 @@ pref("extensions.webextOptionalPermissionPrompts", true);
+ sticky_pref("extensions.getAddons.cache.enabled", true);
+ pref("extensions.getAddons.showPane", false);
+ pref("extensions.getAddons.maxResults", 15);
+-pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/%LOCALE%/firefox/api/%API_VERSION%/search/guid:%IDS%?src=firefox&appOS=%OS%&appVersion=%VERSION%");
++pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/%LOCALE%/firefox/api/%API_VERSION%/search/guid:%IDS%?src=firefox&appOS=Linux&appVersion=%VERSION%");
+ pref("extensions.getAddons.getWithPerformance.url", "");
+-pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/firefox/search?q=%TERMS%&platform=%OS%&appver=%VERSION%");
+-pref("extensions.getAddons.search.url", "https://services.addons.mozilla.org/%LOCALE%/firefox/api/%API_VERSION%/search/%TERMS%/all/%MAX_RESULTS%/%OS%/%VERSION%/%COMPATIBILITY_MODE%?src=firefox");
++pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/firefox/search?q=%TERMS%&platform=Linux&appver=%VERSION%");
++pref("extensions.getAddons.search.url", "https://services.addons.mozilla.org/%LOCALE%/firefox/api/%API_VERSION%/search/%TERMS%/all/%MAX_RESULTS%/Linux/%VERSION%/%COMPATIBILITY_MODE%?src=firefox");
+ pref("extensions.webservice.discoverURL", "");
+-pref("extensions.getAddons.recommended.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/%API_VERSION%/list/recommended/all/%MAX_RESULTS%/%OS%/%VERSION%?src=firefox");
++pref("extensions.getAddons.recommended.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/%API_VERSION%/list/recommended/all/%MAX_RESULTS%/Linux/%VERSION%?src=firefox");
+ pref("extensions.getAddons.link.url", "https://addons.mozilla.org/%LOCALE%/firefox/");
+ pref("extensions.getAddons.themes.browseURL", "https://addons.mozilla.org/%LOCALE%/firefox/themes/?src=firefox");
+ 
+@@ -204,8 +204,8 @@ pref("app.update.service.enabled", true);
+ //  .. etc ..
+ //
+ pref("extensions.update.enabled", true);
+-pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
+-pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
++pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=Linux&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
++pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=Linux&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
+ pref("extensions.update.interval", 86400);  // Check for updates to Extensions and
+                                             // Themes every day
+ // Non-symmetric (not shared by extensions) extension-specific [update] preferences
+diff --git toolkit/mozapps/extensions/internal/AddonRepository.jsm toolkit/mozapps/extensions/internal/AddonRepository.jsm
+index f70fd8d7e3bd8..81e8cd7764fdf 100644
+--- toolkit/mozapps/extensions/internal/AddonRepository.jsm
++++ toolkit/mozapps/extensions/internal/AddonRepository.jsm
+@@ -1179,7 +1179,7 @@ this.AddonRepository = {
+           let nodes = node.getElementsByTagName("os");
+           addon.isPlatformCompatible = Array.some(nodes, function(aNode) {
+             let text = aNode.textContent.toLowerCase().trim();
+-            return text == "all" || text == Services.appinfo.OS.toLowerCase();
++            return text == "all" || text == "linux" || text == Services.appinfo.OS.toLowerCase();
+           });
+           break;
+         case "install":
+@@ -1187,7 +1187,7 @@ this.AddonRepository = {
+           if (node.hasAttribute("os")) {
+             let os = node.getAttribute("os").trim().toLowerCase();
+             // If the os is not ALL and not the current OS then ignore this xpi
+-            if (os != "all" && os != Services.appinfo.OS.toLowerCase())
++            if (os != "all" && os != "linux" && os != Services.appinfo.OS.toLowerCase())
+               break;
+           }
+ 
+diff --git toolkit/mozapps/extensions/internal/XPIProvider.jsm toolkit/mozapps/extensions/internal/XPIProvider.jsm 
+index f70fd8d7e3bd8..81e8cd7764fdf 100644
+--- toolkit/mozapps/extensions/internal/XPIProvider.jsm
++++ toolkit/mozapps/extensions/internal/XPIProvider.jsm
+@@ -7186,7 +7186,7 @@ AddonInternal.prototype = {
+     // Something is causing errors in here
+     try {
+       for (let platform of this.targetPlatforms) {
+-        if (platform.os == Services.appinfo.OS) {
++        if (platform.os == "Linux" || platform.os == Services.appinfo.OS) {
+           if (platform.abi) {
+             needsABI = true;
+             if (platform.abi === abi)
diff --git a/www/waterfox/files/patch-browser-app-nsBrowserApp.cpp b/www/waterfox/files/patch-browser-app-nsBrowserApp.cpp
new file mode 100644
index 000000000000..68cb778b95a7
--- /dev/null
+++ b/www/waterfox/files/patch-browser-app-nsBrowserApp.cpp
@@ -0,0 +1,12 @@
+--- browser/app/nsBrowserApp.cpp.orig	2016-09-19 16:19:28 UTC
++++ browser/app/nsBrowserApp.cpp
+@@ -324,6 +324,9 @@ int main(int argc, char* argv[], char* e
+ {
+   mozilla::TimeStamp start = mozilla::TimeStamp::Now();
+ 
++  setenv("MOZ_GMP_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
++  setenv("MOZ_PLUGIN_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
++
+ #ifdef HAS_DLL_BLOCKLIST
+   DllBlocklist_Initialize();
+ 
diff --git a/www/waterfox/files/patch-bug1021761 b/www/waterfox/files/patch-bug1021761
new file mode 100644
index 000000000000..f0764a8c4b22
--- /dev/null
+++ b/www/waterfox/files/patch-bug1021761
@@ -0,0 +1,1218 @@
+diff --git build/moz.configure/old.configure build/moz.configure/old.configure
+index cd6c37cf4c7c..e98dc7973a6a 100644
+--- build/moz.configure/old.configure
++++ build/moz.configure/old.configure
+@@ -275,6 +275,7 @@ def old_configure_options(*options):
+     '--with-nspr-prefix',
+     '--with-nss-exec-prefix',
+     '--with-nss-prefix',
++    '--with-oss',
+     '--with-pthreads',
+     '--with-qemu-exe',
+     '--with-sixgill',
+diff --git old-configure.in old-configure.in
+index dff46614635e..dbbfdb76ab78 100644
+--- old-configure.in
++++ old-configure.in
+@@ -3128,6 +3128,67 @@ AC_DEFINE(MOZ_WEBM_ENCODER)
+ AC_SUBST(MOZ_WEBM_ENCODER)
+ 
+ dnl ==================================
++dnl = Check OSS availability
++dnl ==================================
++
++dnl If using Linux, Solaris or BSDs, ensure that OSS is available
++case "$OS_TARGET" in
++Linux|SunOS|DragonFly|FreeBSD|NetBSD|GNU/kFreeBSD)
++    MOZ_OSS=1
++    ;;
++esac
++
++MOZ_ARG_WITH_STRING(oss,
++[  --with-oss[=PFX]        Enable OpenSoundSystem support [installed at prefix PFX]],
++   OSSPREFIX=$withval)
++
++if test -n "$OSSPREFIX"; then
++    if test "$OSSPREFIX" != "no"; then
++        MOZ_OSS=1
++    else
++        MOZ_OSS=
++    fi
++fi
++
++_SAVE_CFLAGS=$CFLAGS
++_SAVE_LIBS=$LIBS
++if test -n "$MOZ_OSS"; then
++    dnl Prefer 4Front implementation
++    AC_MSG_CHECKING([MOZ_OSS_CFLAGS])
++    if test "$OSSPREFIX" != "yes"; then
++        oss_conf=${OSSPREFIX%/usr}/etc/oss.conf
++        if test -f "$oss_conf"; then
++            . "$oss_conf"
++        else
++            OSSLIBDIR=$OSSPREFIX/lib/oss
++        fi
++        if test -d "$OSSLIBDIR"; then
++            MOZ_OSS_CFLAGS="$MOZ_OSS_CFLAGS -I$OSSLIBDIR/include"
++        fi
++    fi
++    AC_MSG_RESULT([$MOZ_OSS_CFLAGS])
++
++    CFLAGS="$CFLAGS $MOZ_OSS_CFLAGS"
++    MOZ_CHECK_HEADERS(sys/soundcard.h soundcard.h)
++
++    if test "$ac_cv_header_sys_soundcard_h" != "yes" -a \
++            "$ac_cv_header_soundcard_h" != "yes"; then
++        AC_MSG_ERROR([Need OSS for Ogg, Wave or WebM decoding on $OS_TARGET.  Disable with --without-oss.])
++    fi
++
++    dnl Assume NetBSD implementation over SunAudio
++    AC_CHECK_LIB(ossaudio, _oss_ioctl,
++        [AC_DEFINE_UNQUOTED(CUBEB_OSS_DEFAULT_OUTPUT, "/dev/sound")
++         MOZ_OSS_LIBS="$MOZ_OSS_LIBS -lossaudio"])
++fi
++CFLAGS=$_SAVE_CFLAGS
++LIBS=$_SAVE_LIBS
++
++AC_SUBST(MOZ_OSS)
++AC_SUBST_LIST(MOZ_OSS_CFLAGS)
++AC_SUBST_LIST(MOZ_OSS_LIBS)
++
++dnl ==================================
+ dnl = Check alsa availability on Linux
+ dnl ==================================
+ 
+diff --git dom/media/CubebUtils.cpp dom/media/CubebUtils.cpp
+index e10e07e06ade..1fd561bea113 100644
+--- dom/media/CubebUtils.cpp
++++ dom/media/CubebUtils.cpp
+@@ -71,7 +71,8 @@ const char* AUDIOSTREAM_BACKEND_ID_STR[] = {
+   "sndio",
+   "opensl",
+   "audiotrack",
+-  "kai"
++  "kai",
++  "oss",
+ };
+ /* Index for failures to create an audio stream the first time. */
+ const int CUBEB_BACKEND_INIT_FAILURE_FIRST =
+diff --git media/libcubeb/AUTHORS media/libcubeb/AUTHORS
+index 0fde65baad34..f8663c43b475 100644
+--- media/libcubeb/AUTHORS
++++ media/libcubeb/AUTHORS
+@@ -4,6 +4,7 @@ Michael Wu <mwu@mozilla.com>
+ Paul Adenot <paul@paul.cx>
+ David Richards <drichards@mozilla.com>
+ Sebastien Alaiwan <sebastien.alaiwan@gmail.com>
++Evgeniy Vodolazskiy <waterlaz@gmail.com>
+ KO Myung-Hun <komh@chollian.net>
+ Haakon Sporsheim <haakon.sporsheim@telenordigital.com>
+ Alex Chronopoulos <achronop@gmail.com>
+diff --git media/libcubeb/src/cubeb.c media/libcubeb/src/cubeb.c
+index 57bcb4c13652..68be024f4a68 100644
+--- media/libcubeb/src/cubeb.c
++++ media/libcubeb/src/cubeb.c
+@@ -54,6 +54,9 @@ int audiotrack_init(cubeb ** context, char const * context_name);
+ #if defined(USE_KAI)
+ int kai_init(cubeb ** context, char const * context_name);
+ #endif
++#if defined(USE_OSS)
++int oss_init(cubeb ** context, char const * context_name);
++#endif
+ 
+ static int
+ validate_stream_params(cubeb_stream_params * input_stream_params,
+@@ -155,6 +158,10 @@ cubeb_init(cubeb ** context, char const * context_name, char const * backend_nam
+ #if defined(USE_KAI)
+       init_oneshot = kai_init;
+ #endif
++    } else if (!strcmp(backend_name, "oss")) {
++#if defined(USE_OSS)
++      init_oneshot = oss_init;
++#endif
+     } else {
+       /* Already set */
+     }
+@@ -196,6 +203,9 @@ cubeb_init(cubeb ** context, char const * context_name, char const * backend_nam
+ #if defined(USE_KAI)
+     kai_init,
+ #endif
++#if defined(USE_OSS)
++    oss_init,
++#endif
+   };
+   int i;
+ 
+diff --git media/libcubeb/src/cubeb_alsa.c media/libcubeb/src/cubeb_alsa.c
+index 05ad27fef53b..3ea78e994f59 100644
+--- media/libcubeb/src/cubeb_alsa.c
++++ media/libcubeb/src/cubeb_alsa.c
+@@ -12,6 +12,7 @@
+ #include <sys/time.h>
+ #include <assert.h>
+ #include <limits.h>
++#include <dlfcn.h>
+ #include <poll.h>
+ #include <unistd.h>
+ #include <alsa/asoundlib.h>
+@@ -25,6 +26,52 @@
+ 
+ #define ALSA_PA_PLUGIN "ALSA <-> PulseAudio PCM I/O Plugin"
+ 
++#ifdef DISABLE_LIBASOUND_DLOPEN
++#define WRAP(x) x
++#else
++#define WRAP(x) cubeb_##x
++#define MAKE_TYPEDEF(x) static typeof(x) * cubeb_##x
++MAKE_TYPEDEF(snd_config);
++MAKE_TYPEDEF(snd_config_add);
++MAKE_TYPEDEF(snd_config_copy);
++MAKE_TYPEDEF(snd_config_delete);
++MAKE_TYPEDEF(snd_config_get_id);
++MAKE_TYPEDEF(snd_config_get_string);
++MAKE_TYPEDEF(snd_config_imake_integer);
++MAKE_TYPEDEF(snd_config_search);
++MAKE_TYPEDEF(snd_config_search_definition);
++MAKE_TYPEDEF(snd_lib_error_set_handler);
++MAKE_TYPEDEF(snd_pcm_avail_update);
++MAKE_TYPEDEF(snd_pcm_close);
++MAKE_TYPEDEF(snd_pcm_delay);
++MAKE_TYPEDEF(snd_pcm_drain);
++MAKE_TYPEDEF(snd_pcm_frames_to_bytes);
++MAKE_TYPEDEF(snd_pcm_get_params);
++/* snd_pcm_hw_params_alloca is actually a macro */
++/* MAKE_TYPEDEF(snd_pcm_hw_params_alloca); */
++MAKE_TYPEDEF(snd_pcm_hw_params_sizeof);
++#define snd_pcm_hw_params_sizeof cubeb_snd_pcm_hw_params_sizeof
++MAKE_TYPEDEF(snd_pcm_hw_params_any);
++MAKE_TYPEDEF(snd_pcm_hw_params_get_channels_max);
++MAKE_TYPEDEF(snd_pcm_hw_params_get_rate);
++MAKE_TYPEDEF(snd_pcm_hw_params_set_rate_near);
++MAKE_TYPEDEF(snd_pcm_nonblock);
++MAKE_TYPEDEF(snd_pcm_open);
++MAKE_TYPEDEF(snd_pcm_open_lconf);
++MAKE_TYPEDEF(snd_pcm_pause);
++MAKE_TYPEDEF(snd_pcm_poll_descriptors);
++MAKE_TYPEDEF(snd_pcm_poll_descriptors_count);
++MAKE_TYPEDEF(snd_pcm_poll_descriptors_revents);
++MAKE_TYPEDEF(snd_pcm_readi);
++MAKE_TYPEDEF(snd_pcm_recover);
++MAKE_TYPEDEF(snd_pcm_set_params);
++MAKE_TYPEDEF(snd_pcm_start);
++MAKE_TYPEDEF(snd_pcm_state);
++MAKE_TYPEDEF(snd_pcm_writei);
++
++#undef MAKE_TYPEDEF
++#endif
++
+ /* ALSA is not thread-safe.  snd_pcm_t instances are individually protected
+    by the owning cubeb_stream's mutex.  snd_pcm_t creation and destruction
+    is not thread-safe until ALSA 1.0.24 (see alsa-lib.git commit 91c9c8f1),
+@@ -65,6 +112,8 @@ struct cubeb {
+      workaround is not required. */
+   snd_config_t * local_config;
+   int is_pa;
++
++  void * libasound;
+ };
+ 
+ enum stream_state {
+@@ -243,8 +292,8 @@ set_timeout(struct timeval * timeout, unsigned int ms)
+ static void
+ stream_buffer_decrement(cubeb_stream * stm, long count)
+ {
+-  char * bufremains = stm->buffer + snd_pcm_frames_to_bytes(stm->pcm, count);
+-  memmove(stm->buffer, bufremains, snd_pcm_frames_to_bytes(stm->pcm, stm->bufframes - count));
++  char * bufremains = stm->buffer + WRAP(snd_pcm_frames_to_bytes)(stm->pcm, count);
++  memmove(stm->buffer, bufremains, WRAP(snd_pcm_frames_to_bytes)(stm->pcm, stm->bufframes - count));
+   stm->bufframes -= count;
+ }
+ 
+@@ -276,9 +325,9 @@ alsa_process_stream(cubeb_stream * stm)
+   /* Call _poll_descriptors_revents() even if we don't use it
+      to let underlying plugins clear null events.  Otherwise poll()
+      may wake up again and again, producing unnecessary CPU usage. */
+-  snd_pcm_poll_descriptors_revents(stm->pcm, stm->fds, stm->nfds, &revents);
++  WRAP(snd_pcm_poll_descriptors_revents)(stm->pcm, stm->fds, stm->nfds, &revents);
+ 
+-  avail = snd_pcm_avail_update(stm->pcm);
++  avail = WRAP(snd_pcm_avail_update)(stm->pcm);
+ 
+   /* Got null event? Bail and wait for another wakeup. */
+   if (avail == 0) {
+@@ -301,7 +350,7 @@ alsa_process_stream(cubeb_stream * stm)
+       // TODO: should it be marked as DRAINING?
+     }
+ 
+-    got = snd_pcm_readi(stm->pcm, stm->buffer+stm->bufframes, avail);
++    got = WRAP(snd_pcm_readi)(stm->pcm, stm->buffer+stm->bufframes, avail);
+ 
+     if (got < 0) {
+       avail = got; // the error handler below will recover us
+@@ -345,7 +394,7 @@ alsa_process_stream(cubeb_stream * stm)
+       (!stm->other_stream || stm->other_stream->bufframes > 0)) {
+     long got = avail - stm->bufframes;
+     void * other_buffer = stm->other_stream ? stm->other_stream->buffer : NULL;
+-    char * buftail = stm->buffer + snd_pcm_frames_to_bytes(stm->pcm, stm->bufframes);
++    char * buftail = stm->buffer + WRAP(snd_pcm_frames_to_bytes)(stm->pcm, stm->bufframes);
+ 
+     /* Correct read size to the other stream available frames */
+     if (stm->other_stream && got > (snd_pcm_sframes_t) stm->other_stream->bufframes) {
+@@ -372,8 +421,8 @@ alsa_process_stream(cubeb_stream * stm)
+     long drain_frames = avail - stm->bufframes;
+     double drain_time = (double) drain_frames / stm->params.rate;
+ 
+-    char * buftail = stm->buffer + snd_pcm_frames_to_bytes(stm->pcm, stm->bufframes);
+-    memset(buftail, 0, snd_pcm_frames_to_bytes(stm->pcm, drain_frames));
++    char * buftail = stm->buffer + WRAP(snd_pcm_frames_to_bytes)(stm->pcm, stm->bufframes);
++    memset(buftail, 0, WRAP(snd_pcm_frames_to_bytes)(stm->pcm, drain_frames));
+     stm->bufframes = avail;
+ 
+     /* Mark as draining, unless we're waiting for capture */
+@@ -400,7 +449,7 @@ alsa_process_stream(cubeb_stream * stm)
+       }
+     }
+ 
+-    wrote = snd_pcm_writei(stm->pcm, stm->buffer, avail);
++    wrote = WRAP(snd_pcm_writei)(stm->pcm, stm->buffer, avail);
+     if (wrote < 0) {
+       avail = wrote; // the error handler below will recover us
+     } else {
+@@ -413,13 +462,13 @@ alsa_process_stream(cubeb_stream * stm)
+ 
+   /* Got some error? Let's try to recover the stream. */
+   if (avail < 0) {
+-    avail = snd_pcm_recover(stm->pcm, avail, 0);
++    avail = WRAP(snd_pcm_recover)(stm->pcm, avail, 0);
+ 
+     /* Capture pcm must be started after initial setup/recover */
+     if (avail >= 0 &&
+         stm->stream_type == SND_PCM_STREAM_CAPTURE &&
+-        snd_pcm_state(stm->pcm) == SND_PCM_STATE_PREPARED) {
+-      avail = snd_pcm_start(stm->pcm);
++        WRAP(snd_pcm_state)(stm->pcm) == SND_PCM_STATE_PREPARED) {
++      avail = WRAP(snd_pcm_start)(stm->pcm);
+     }
+   }
+ 
+@@ -535,26 +584,26 @@ get_slave_pcm_node(snd_config_t * lconf, snd_config_t * root_pcm)
+ 
+   slave_def = NULL;
+ 
+-  r = snd_config_search(root_pcm, "slave", &slave_pcm);
++  r = WRAP(snd_config_search)(root_pcm, "slave", &slave_pcm);
+   if (r < 0) {
+     return NULL;
+   }
+ 
+-  r = snd_config_get_string(slave_pcm, &string);
++  r = WRAP(snd_config_get_string)(slave_pcm, &string);
+   if (r >= 0) {
+-    r = snd_config_search_definition(lconf, "pcm_slave", string, &slave_def);
++    r = WRAP(snd_config_search_definition)(lconf, "pcm_slave", string, &slave_def);
+     if (r < 0) {
+       return NULL;
+     }
+   }
+ 
+   do {
+-    r = snd_config_search(slave_def ? slave_def : slave_pcm, "pcm", &pcm);
++    r = WRAP(snd_config_search)(slave_def ? slave_def : slave_pcm, "pcm", &pcm);
+     if (r < 0) {
+       break;
+     }
+ 
+-    r = snd_config_get_string(slave_def ? slave_def : slave_pcm, &string);
++    r = WRAP(snd_config_get_string)(slave_def ? slave_def : slave_pcm, &string);
+     if (r < 0) {
+       break;
+     }
+@@ -563,7 +612,7 @@ get_slave_pcm_node(snd_config_t * lconf, snd_config_t * root_pcm)
+     if (r < 0 || r > (int) sizeof(node_name)) {
+       break;
+     }
+-    r = snd_config_search(lconf, node_name, &pcm);
++    r = WRAP(snd_config_search)(lconf, node_name, &pcm);
+     if (r < 0) {
+       break;
+     }
+@@ -572,7 +621,7 @@ get_slave_pcm_node(snd_config_t * lconf, snd_config_t * root_pcm)
+   } while (0);
+ 
+   if (slave_def) {
+-    snd_config_delete(slave_def);
++    WRAP(snd_config_delete)(slave_def);
+   }
+ 
+   return NULL;
+@@ -595,22 +644,22 @@ init_local_config_with_workaround(char const * pcm_name)
+ 
+   lconf = NULL;
+ 
+-  if (snd_config == NULL) {
++  if (*WRAP(snd_config) == NULL) {
+     return NULL;
+   }
+ 
+-  r = snd_config_copy(&lconf, snd_config);
++  r = WRAP(snd_config_copy)(&lconf, *WRAP(snd_config));
+   if (r < 0) {
+     return NULL;
+   }
+ 
+   do {
+-    r = snd_config_search_definition(lconf, "pcm", pcm_name, &pcm_node);
++    r = WRAP(snd_config_search_definition)(lconf, "pcm", pcm_name, &pcm_node);
+     if (r < 0) {
+       break;
+     }
+ 
+-    r = snd_config_get_id(pcm_node, &string);
++    r = WRAP(snd_config_get_id)(pcm_node, &string);
+     if (r < 0) {
+       break;
+     }
+@@ -619,7 +668,7 @@ init_local_config_with_workaround(char const * pcm_name)
+     if (r < 0 || r > (int) sizeof(node_name)) {
+       break;
+     }
+-    r = snd_config_search(lconf, node_name, &pcm_node);
++    r = WRAP(snd_config_search)(lconf, node_name, &pcm_node);
+     if (r < 0) {
+       break;
+     }
+@@ -630,12 +679,12 @@ init_local_config_with_workaround(char const * pcm_name)
+     }
+ 
+     /* Fetch the PCM node's type, and bail out if it's not the PulseAudio plugin. */
+-    r = snd_config_search(pcm_node, "type", &node);
++    r = WRAP(snd_config_search)(pcm_node, "type", &node);
+     if (r < 0) {
+       break;
+     }
+ 
+-    r = snd_config_get_string(node, &string);
++    r = WRAP(snd_config_get_string)(node, &string);
+     if (r < 0) {
+       break;
+     }
+@@ -646,18 +695,18 @@ init_local_config_with_workaround(char const * pcm_name)
+ 
+     /* Don't clobber an explicit existing handle_underrun value, set it only
+        if it doesn't already exist. */
+-    r = snd_config_search(pcm_node, "handle_underrun", &node);
++    r = WRAP(snd_config_search)(pcm_node, "handle_underrun", &node);
+     if (r != -ENOENT) {
+       break;
+     }
+ 
+     /* Disable pcm_pulse's asynchronous underrun handling. */
+-    r = snd_config_imake_integer(&node, "handle_underrun", 0);
++    r = WRAP(snd_config_imake_integer)(&node, "handle_underrun", 0);
+     if (r < 0) {
+       break;
+     }
+ 
+-    r = snd_config_add(pcm_node, node);
++    r = WRAP(snd_config_add)(pcm_node, node);
+     if (r < 0) {
+       break;
+     }
+@@ -665,7 +714,7 @@ init_local_config_with_workaround(char const * pcm_name)
+     return lconf;
+   } while (0);
+ 
+-  snd_config_delete(lconf);
++  WRAP(snd_config_delete)(lconf);
+ 
+   return NULL;
+ }
+@@ -677,9 +726,9 @@ alsa_locked_pcm_open(snd_pcm_t ** pcm, char const * pcm_name, snd_pcm_stream_t s
*** 44925 LINES SKIPPED ***