www/firefox60: import firefox60-60.1.0

Mozilla Firefox is a free, open-source and cross-platform web browser
for Windows, Linux, MacOS X and many other operating systems.

It is fast and easy to use, and offers many advantages over other web
browsers, such as tabbed browsing and the ability to block pop-up
windows.

Firefox also offers excellent bookmark and history management, and it
can be extended by developers using industry standards such as XML,
CSS, JavaScript, C++, etc. Many extensions are available.

This package provides Firefox 60 ESR.

Securty fixes:
#CVE-2018-12359: Buffer overflow using computed size of canvas element
#CVE-2018-12360: Use-after-free when using focus()
#CVE-2018-12361: Integer overflow in SwizzleData
#CVE-2018-12362: Integer overflow in SSSE3 scaler
#CVE-2018-5156: Media recorder segmentation fault when track type is changed during capture
#CVE-2018-12363: Use-after-free when appending DOM nodes
#CVE-2018-12364: CSRF attacks through 307 redirects and NPAPI plugins
#CVE-2018-12365: Compromised IPC child process can list local filenames
#CVE-2018-12371: Integer overflow in Skia library during edge builder allocation
#CVE-2018-12366: Invalid data handling during QCMS transformations
#CVE-2018-12367: Timing attack mitigation of PerformanceNavigationTiming
#CVE-2018-12368: No warning when opening executable SettingContent-ms files
#CVE-2018-12369: WebExtension security permission checks bypassed by embedded experiments
#CVE-2018-5187: Memory safety bugs fixed in Firefox 60 and Firefox ESR 60.1
#CVE-2018-5188: Memory safety bugs fixed in Firefox 60, Firefox ESR 60.1, and Firefox ESR 52.9
This commit is contained in:
ryoon 2018-06-28 14:04:10 +00:00
parent 65deb01d93
commit d708c97f69
50 changed files with 7750 additions and 0 deletions

12
www/firefox60/DESCR Normal file
View file

@ -0,0 +1,12 @@
Mozilla Firefox is a free, open-source and cross-platform web browser
for Windows, Linux, MacOS X and many other operating systems.
It is fast and easy to use, and offers many advantages over other web
browsers, such as tabbed browsing and the ability to block pop-up
windows.
Firefox also offers excellent bookmark and history management, and it
can be extended by developers using industry standards such as XML,
CSS, JavaScript, C++, etc. Many extensions are available.
This package provides Firefox 60 ESR.

104
www/firefox60/Makefile Normal file
View file

@ -0,0 +1,104 @@
# $NetBSD: Makefile,v 1.1 2018/06/28 14:04:10 ryoon Exp $
FIREFOX_VER= ${MOZ_BRANCH}${MOZ_BRANCH_MINOR}
MOZ_BRANCH= 60.1
MOZ_BRANCH_MINOR= .0esr
DISTNAME= firefox-${FIREFOX_VER}.source
PKGNAME= ${DISTNAME:S/firefox-/firefox60-/:S/.source//:S/b/beta/:S/esr//}
CATEGORIES= www
MASTER_SITES+= ${MASTER_SITE_MOZILLA:=firefox/releases/${FIREFOX_VER}/source/}
EXTRACT_SUFX= .tar.xz
MAINTAINER= ryoon@NetBSD.org
HOMEPAGE= http://www.mozilla.com/en-US/firefox/
COMMENT= Web browser with support for extensions (version ${FIREFOX_VER:C/\..*//})
LICENSE= mpl-1.1
WRKSRC= ${WRKDIR}/firefox-${FIREFOX_VER:S/esr//}
MOZILLA_DIR= # empty
# Note: when updating remember to conditionalise about-background.png in PLIST
CONFIGURE_ARGS+= --enable-application=browser
CFLAGS+= -I${PREFIX}/include/nspr
# workround for link of libxul.so etc.
LDFLAGS+= ${COMPILER_RPATH_FLAG}${PREFIX}/lib/firefox60 ${COMPILER_RPATH_FLAG}${PREFIX}/lib
LDFLAGS.SunOS+= -lm
NOT_PAX_MPROTECT_SAFE+= lib/firefox60/firefox60
NOT_PAX_MPROTECT_SAFE+= lib/firefox60/firefox60-bin
NOT_PAX_MPROTECT_SAFE+= lib/firefox60/plugin-container
ALL_ENV+= MOZ_APP_NAME=firefox60
# Avoid ld "invalid section index" errors.
BUILDLINK_TRANSFORM.SunOS+= rm:-fdata-sections
BUILDLINK_TRANSFORM.SunOS+= rm:-ffunction-sections
SUBST_CLASSES+= dfly_malloc_h
SUBST_STAGE.dfly_malloc_h= pre-configure
SUBST_MESSAGE.dfly_malloc_h= Dont include malloc.h on dragonflybsd
SUBST_SED.dfly_malloc_h= -e 's,HAVE_MALLOC_H,HAVE_MALLOC_H \&\& !defined(__DragonFly__),g'
SUBST_FILES.dfly_malloc_h= media/libav/libavutil/mem.c
SUBST_FILES.dfly_malloc_h+= media/ffvpx/libavutil/mem.c
LDFLAGS.DragonFly= -lplc4 -lnspr4
LDFLAGS.FreeBSD= -lplc4 -lnspr4
LDFLAGS.Linux= -lnspr4
.include "mozilla-common.mk"
.include "options.mk"
CHECK_INTERPRETER_SKIP+=lib/firefox-sdk/sdk/bin/header.py
CHECK_INTERPRETER_SKIP+=lib/firefox-sdk/sdk/bin/typelib.py
CHECK_INTERPRETER_SKIP+=lib/firefox-sdk/sdk/bin/xpidl.py
CHECK_INTERPRETER_SKIP+=lib/firefox-sdk/sdk/bin/xpt.py
CHECK_WRKREF_SKIP+=lib/firefox60/chrome/toolkit/content/global/buildconfig.html
MOZILLA=firefox60
MOZILLA_ICON= ${WRKSRC}/${OBJDIR}/dist/firefox60/browser/chrome/icons/default/default48.png
.if !empty(PKG_OPTIONS:Mofficial-mozilla-branding)
MOZILLA_NAME= Firefox
.else
MOZILLA_NAME= Browser
.endif
SUBST_CLASSES+= sys-dic
SUBST_STAGE.sys-dic= pre-configure
SUBST_MESSAGE.sys-dic= Reference to system hunspell dictionaries.
SUBST_FILES.sys-dic= extensions/spellcheck/hunspell/glue/mozHunspell.cpp
SUBST_VARS.sys-dic= PREFIX
post-extract:
mv ${WRKSRC}/gfx/ycbcr/yuv_row_arm.s ${WRKSRC}/gfx/ycbcr/yuv_row_arm.S
pre-configure:
cd ${WRKSRC} && autoconf
cd ${WRKSRC}/js/src && autoconf
cd ${WRKSRC} && mkdir ${OBJDIR}
cd ${WRKSRC}/${OBJDIR} && touch old-configure.vars
post-build:
${SED} -e 's|@MOZILLA@|${MOZILLA}|g' \
-e 's|@MOZILLA_NAME@|${MOZILLA_NAME}|g' \
-e 's|@FIREFOX_ICON@|${MOZILLA}.png|g' \
< ${FILESDIR}/desktop.in \
> ${WRKDIR}/desktop
INSTALLATION_DIRS+= share/applications share/pixmaps
post-install:
${ECHO} '#! /bin/sh' > ${DESTDIR}${PREFIX}/bin/${MOZILLA}
${ECHO} '${PREFIX}/lib/firefox60/firefox60 "$$@"' >> \
${DESTDIR}${PREFIX}/bin/${MOZILLA}
${CHMOD} 755 ${DESTDIR}${PREFIX}/bin/${MOZILLA}
${INSTALL_DATA} ${WRKDIR}/desktop \
${DESTDIR}${PREFIX}/share/applications/${MOZILLA}.desktop
${INSTALL_DATA} ${MOZILLA_ICON} \
${DESTDIR}${PREFIX}/share/pixmaps/${MOZILLA}.png
.include "../../sysutils/desktop-file-utils/desktopdb.mk"
.include "../../mk/bsd.pkg.mk"

4580
www/firefox60/PLIST Normal file

File diff suppressed because it is too large Load diff

47
www/firefox60/distinfo Normal file
View file

@ -0,0 +1,47 @@
$NetBSD: distinfo,v 1.1 2018/06/28 14:04:10 ryoon Exp $
SHA1 (firefox-60.1.0esr.source.tar.xz) = e7b9c954fdba527404b9b371f25890ec03d6a0ad
RMD160 (firefox-60.1.0esr.source.tar.xz) = 3c8f71acc6e534069e5cd27d768ff5dff55d22a1
SHA512 (firefox-60.1.0esr.source.tar.xz) = 06c2d6d02086b77cc243eb4438d643cbc51fb766f1be8d5002bf77587d5c14145c6e26c1496c654b8ed1cc325cad29b049aac55a32f757d167d183bf73fff396
Size (firefox-60.1.0esr.source.tar.xz) = 268770652 bytes
SHA1 (patch-aa) = fdabcc9b055f6439fdbda9b38ab7cec08ff3e231
SHA1 (patch-browser_app_profile_firefox.js) = 9a43095d94f83f315b9a3ce4a7b0a4301e9c40e6
SHA1 (patch-build_moz.configure_old.configure) = 1df6867eaf73a350fbe8fcd5bd34e1fcab09d707
SHA1 (patch-dom_fetch_FetchConsumer.cpp) = a164b68b968633e2f2e29c1c3917a77ac55a886b
SHA1 (patch-dom_media_CubebUtils.cpp) = 3632cd0dd4b95f53f01050b8898b33fe198916b6
SHA1 (patch-gfx_angle_checkout_src_common_third__party_smhasher_src_PMurHash.cpp) = f1d0adae2873545818072adb4e8599267bc4e6c5
SHA1 (patch-gfx_webrender_src_query.rs) = 6434b0fc1d6441ddb555a2a3b199564b488ec336
SHA1 (patch-image_decoders_nsJPEGDecoder.cpp) = ed86c3fbb3aef753eec6f6a97940594aac5f3f2f
SHA1 (patch-ipc_chromium_src_base_lock__impl__posix.cc) = 16e37fe54ba1d8d233f6b04dbd06e248305d7f6e
SHA1 (patch-ipc_chromium_src_base_message__pump__libevent.cc) = 99b9f3f9dd88f1c8008d2fb6058450695394f5cf
SHA1 (patch-ipc_chromium_src_base_platform__thread__posix.cc) = 5b0bfe78e105cc3f395d5afda25a50afc6289f03
SHA1 (patch-ipc_glue_CrossProcessSemaphore.h) = 778a569887d8ad082abc2fa2fe89a0a943e84d64
SHA1 (patch-ipc_glue_CrossProcessSemaphore__posix.cpp) = 3052338871447cedaeafe8369afe82233183c884
SHA1 (patch-ipc_glue_GeckoChildProcessHost.cpp) = 260c29bacd8bf265951b7a412f850bf2b292c836
SHA1 (patch-js_src_gc_Memory.cpp) = 40d8285d3f5a060e68a2884dd81b39950f45ff95
SHA1 (patch-js_src_threading_posix_Thread.cpp) = 47e612a676e614fd6dd43b8a3140218a3fbdc7fa
SHA1 (patch-js_src_util_NativeStack.cpp) = c02781c07942d2aa037d5123cc09cb73d5e73316
SHA1 (patch-js_src_wasm_WasmSignalHandlers.cpp) = 1c665a9383638774c00f6c5fead5d786b6c7944a
SHA1 (patch-media_libcubeb_gtest_moz.build) = 921a001726cda9e9782df5e59ae02b19d76ef47e
SHA1 (patch-media_libcubeb_src_cubeb.c) = 1b1b8d57eb710cad13518ded79a0ddee2681881b
SHA1 (patch-media_libcubeb_src_cubeb__alsa.c) = 3ee36f58bb525767c7d2b9e814ba4ccaa4868717
SHA1 (patch-media_libcubeb_src_cubeb__oss.c) = ccd7ad6f09977dab358632107cfd9078b4649f99
SHA1 (patch-media_libcubeb_src_moz.build) = f243068c8908dcb16434221edef8c65db3bb0c83
SHA1 (patch-media_libcubeb_update.sh) = 3a322de06bbe9aafba9da349954ef022bd094992
SHA1 (patch-media_libpng_pngpriv.h) = c8084332560017cd7c9b519b61d125fa28af0dbc
SHA1 (patch-media_libyuv_libyuv_source_mjpeg__decoder.cc) = 8a264c439fa4749cd7c5acf96e1ae3f9bae0a886
SHA1 (patch-media_webrtc_trunk_webrtc_modules_audio__device_linux_audio__device__alsa__linux.cc) = 91e8ce496c1f4dbbd0a463d83cb033afd1de3f49
SHA1 (patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc) = 0141dd1372c13ea1fce6e2f5ffb65e0cb0f3a13e
SHA1 (patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_video__capture__linux.cc) = a69bc7b7096b410582e725f9dbec57fee90d6686
SHA1 (patch-modules_pdfium_update.sh) = b0bf091325c9322c54880de067871354cd689038
SHA1 (patch-servo_components_style_build__gecko.rs) = fca2260a70b496fc010f165ff4d68788b7e28632
SHA1 (patch-third__party_rust_libloading_.cargo-checksum.json) = 00bb69b7e72911de1658f97b338d1d77e9d11cdb
SHA1 (patch-third__party_rust_libloading_build.rs) = 279b0381546d9e2868d4a6e20a8bd195792fc034
SHA1 (patch-toolkit_components_terminator_nsTerminator.cpp) = 5b6d2e5c9f685d32894898d3ef3aec09a1a1e5ce
SHA1 (patch-toolkit_library_moz.build) = ecb6125e996d5496335c58ecd3433ad3214f29f0
SHA1 (patch-toolkit_moz.configure) = 40ee147cc1d2c62dd6c83b3f67ce9e61f758ea57
SHA1 (patch-toolkit_mozapps_installer_packager.mk) = 6f557fb732f0b9dabf059ffac0400d3db4e79e47
SHA1 (patch-toolkit_xre_glxtest.cpp) = cf048491778610454b914400e53072afedd96e7b
SHA1 (patch-xpcom_base_nscore.h) = d7c96eda884d7f370442749c43caba50da61bbe4
SHA1 (patch-xpcom_build_BinaryPath.h) = 65af561d663d605134ff2b6c51a268b525f6ac15
SHA1 (patch-xpcom_reflect_xptcall_md_unix_xptcinvoke__sparc64__netbsd.cpp) = 0792c2c626d906e71c5183994cb32bf8cdb3e239

View file

@ -0,0 +1,191 @@
[Desktop Entry]
Encoding=UTF-8
Name=@MOZILLA_NAME@ Web Browser
Name[am]=
Name[ar]=
Name[az]=@MOZILLA_NAME@ Veb Səyyahı
Name[be]=
Name[bg]=Интернет браузър @MOZILLA_NAME@
Name[bn]=
Name[bs]=@MOZILLA_NAME@ web preglednik
Name[ca]=Navegador web @MOZILLA_NAME@
Name[cs]=Prohlížeč WWW @MOZILLA_NAME@
Name[cy]=Y Porwr Gwe @MOZILLA_NAME@
Name[da]=@MOZILLA_NAME@ - internetsurfning
Name[de]=@MOZILLA_NAME@ Webbrowser
Name[el]=Περιηγητής Διαδικτύου @MOZILLA_NAME@
Name[en_CA]=@MOZILLA_NAME@ Web Browser
Name[en_GB]=@MOZILLA_NAME@ Web Browser
Name[es]=Navegador Web @MOZILLA_NAME@
Name[et]=@MOZILLA_NAME@ veebibrauser
Name[eu]=@MOZILLA_NAME@ web arakatzailea
Name[fi]=@MOZILLA_NAME@, WWW-selain
Name[fr]=Navigateur Web @MOZILLA_NAME@
Name[ga]=Brabhsálaí Lín @MOZILLA_NAME@
Name[gu]=એપીફની વૅબ બ્રાઉઝર
Name[he]=דפדפן @MOZILLA_NAME@
Name[hi]=
Name[hr]=@MOZILLA_NAME@ Web preglednik
Name[hu]=@MOZILLA_NAME@ webböngésző
Name[id]=Web Browser @MOZILLA_NAME@
Name[it]=Browser web @MOZILLA_NAME@
Name[ja]=@MOZILLA_NAME@ ウェブ・ブラウザ
Name[ko]=@MOZILLA_NAME@ 웹 브라우저
Name[li]=@MOZILLA_NAME@ Web Browser
Name[lt]=@MOZILLA_NAME@ web naršyklė
Name[mk]=@MOZILLA_NAME@ веб прелистувач
Name[ml]=എപ്പിഫാനി വെബ്ബ് ബ്രൌസ‌ര്
Name[mn]=@MOZILLA_NAME@ веб хөтөч
Name[ms]=Pelungsur Web @MOZILLA_NAME@
Name[nb]=@MOZILLA_NAME@ nettleser
Name[nl]=@MOZILLA_NAME@ Webbrowser
Name[nn]=@MOZILLA_NAME@ nettlesar
Name[no]=@MOZILLA_NAME@ nettleser
Name[pa]=ਏਪੀਫਾਨੀ ਵੈੱਬ ਬਰਾਊਜ਼ਰ
Name[pl]=Przeglądarka WWW @MOZILLA_NAME@
Name[pt]=Navegador Web @MOZILLA_NAME@
Name[pt_BR]=Navegador Web @MOZILLA_NAME@
Name[ro]=Navigatorul @MOZILLA_NAME@
Name[ru]=Веб-браузер @MOZILLA_NAME@
Name[sk]=
Name[sl]=Spletni brskalnik @MOZILLA_NAME@
Name[sq]=@MOZILLA_NAME@ - Shfletuesi Web
Name[sr]=
Name[sr@Latn]=Veb čitač Spoznaja
Name[sv]=Webbläsaren @MOZILLA_NAME@
Name[ta]=எபிபனி வலை உலாவி
Name[tk]=@MOZILLA_NAME@ Web Ahtarçisi
Name[tr]=@MOZILLA_NAME@ Web Tarayıcı
Name[uk]=Переглядач web @MOZILLA_NAME@
Name[vi]=Trình Duyệt Web @MOZILLA_NAME@
Name[wa]=Betchteu waibe epiphany
Name[zh_CN]=@MOZILLA_NAME@ Web 浏览器
Name[zh_TW]=@MOZILLA_NAME@ 網頁瀏覽器
GenericName=Web Browser
GenericName[ar]=متصفّح الانترنت
GenericName[az]=Veb Səyyahı
GenericName[be]=Вандроўнік па павуціньню
GenericName[bg]=Браузър
GenericName[bn]=ওয়েব ব্রাউজার
GenericName[bs]=Web preglednik
GenericName[ca]=Navegador web
GenericName[cs]=Prohlížeč WWW
GenericName[cy]=Porwr Gwe
GenericName[da]=Internetsurfning
GenericName[de]=Webbrowser
GenericName[el]=Περιηγητής Ιστοσελίδων
GenericName[en_CA]=Web Browser
GenericName[en_GB]=Web Browser
GenericName[es]=Navegador web
GenericName[et]=Veebilehitseja
GenericName[eu]=Web arakatzailea
GenericName[fi]=WWW-selain
GenericName[fr]=Navigateur Web @MOZILLA_NAME@
GenericName[ga]=Brabhsálaí Lín
GenericName[gu]=વેબ બ્રાઉઝર
GenericName[he]=דפדפן אינטרנט
GenericName[hi]=वेब ब्राउज़र
GenericName[hr]=Web preglednik
GenericName[hu]=Webböngésző
GenericName[id]=Browser Web
GenericName[it]=Browser web
GenericName[ja]=GNOME ウェブ・ブラウザ
GenericName[ko]=웹 브라우저
GenericName[li]=Wèb Browser
GenericName[lt]=Web naršyklė
GenericName[mk]=Веб прелистувач
GenericName[mn]=Веб хөтөч
GenericName[ms]=Pelungsur Web
GenericName[nb]=Nettleser
GenericName[nl]=Web-browser
GenericName[nn]=Nettlesar
GenericName[no]=Nettleser
GenericName[pa]=ਵੈਬ ਬਰਾਊਜ਼
GenericName[pl]=Przeglądarka WWW
GenericName[pt]=Navegador Web
GenericName[pt_BR]=Navegador Web
GenericName[ro]=Navigator Internet
GenericName[ru]=Веб-браузер
GenericName[sk]=WWW prehliadač
GenericName[sl]=Spletni brskalnik
GenericName[sq]=Shfletuesi Web
GenericName[sr]=Веб читач
GenericName[sr@Latn]=Veb čitač
GenericName[sv]=Webbläsare
GenericName[ta]=வலை உலாவி
GenericName[th]=เว็บบราวเซอร์
GenericName[tk]=Web Ahtarçysy
GenericName[tr]=Web Tarayıcı
GenericName[uk]=Переглядач web-сторінок
GenericName[vi]=Trình duyệt Web
GenericName[wa]=Betchteu waibe
GenericName[zh_CN]=Web 浏览器
GenericName[zh_TW]=網頁瀏覽器
Comment=Browse the web
Comment[ar]=تصفح الانترنت
Comment[az]=Vebi gəzin
Comment[be]=Вандраваць па павуціньню
Comment[bg]=Сърфиране в интернет
Comment[bn]=ওয়েব ব্রাউজ করুন
Comment[bs]=Pregledaj na internetu
Comment[ca]=Navegueu per la web
Comment[cs]=Prohlížet WWW
Comment[cy]=Pori'r we
Comment[da]=Surf på internettet
Comment[de]=Im Web surfen
Comment[el]=Περιήγηση στον παγκόσμιο ιστό
Comment[en_CA]=Browse the web
Comment[en_GB]=Browse the web
Comment[es]=Navegar por la web
Comment[et]=Sirvi veebi
Comment[eu]=Arakatu web-a
Comment[fi]=Selaa WWW:tä
Comment[fr]=Naviguer sur Internet
Comment[ga]=Brabhsáil an Líon
Comment[gu]=વેબમાં શોધો
Comment[he]=גלוש ברשת
Comment[hi]=वेब ब्राउज़ करें
Comment[hr]=Pregledaj Web
Comment[hu]=A világháló böngészése
Comment[id]=Jelajah web
Comment[it]=Esplora il web
Comment[ja]=ウェブを閲覧します
Comment[ko]=웹을 돌아 다닙니다
Comment[li]=Blajere op internet
Comment[lt]=Naršyti internete
Comment[mk]=Прелистувајте на веб
Comment[ml]=വലക്കെട്ട് തിരയുക
Comment[mn]=Веб броузе хийх
Comment[ms]=Layari web
Comment[nb]=Surf på nettet
Comment[nl]=Websurfen
Comment[nn]=Surf på nettet
Comment[no]=Surf på nettet
Comment[pa]=ਵੈਬ ਬਰਾਊਜ਼
Comment[pl]=Przeglądanie stron WWW
Comment[pt]=Navegar na web
Comment[pt_BR]=Navegar na web
Comment[ro]=Navigare Internet
Comment[ru]=Веб-браузер
Comment[sk]=Prehliadať internet
Comment[sl]=Brskaj po spletu
Comment[sq]=Eksploro web-in
Comment[sr]=Прегледај веб
Comment[sr@Latn]=Pregledaj veb
Comment[sv]=Surfa på nätet
Comment[ta]=வலையில் உலாவு
Comment[th]=ใช้งานเว็บบราวเซอร์ @MOZILLA_NAME@
Comment[tk]=Webi Ahtar
Comment[tr]=Web'e Gözat
Comment[uk]=Програма перегляду web-сторінок
Comment[vi]=Duyệt web
Comment[wa]=Naivyî avå les waibes
Comment[zh_CN]=浏览 Web
Comment[zh_TW]=瀏覽網頁
Exec=@MOZILLA@ %u
Icon=@FIREFOX_ICON@
StartupNotify=false
Terminal=false
Type=Application
Categories=Application;Network;
MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;

13
www/firefox60/hacks.mk Normal file
View file

@ -0,0 +1,13 @@
# $NetBSD: hacks.mk,v 1.1 2018/06/28 14:04:10 ryoon Exp $
.if !defined(FIREFOX_HACKS_MK)
FIREFOX_HACKS_MK= defined
.include "../../mk/bsd.fast.prefs.mk"
.include "../../mk/compiler.mk"
.if !empty(PKGSRC_COMPILER:Mclang)
CXXFLAGS+= -Wno-return-type-c-linkage
.endif
.endif # FIREFOX_HACKS_MK

View file

@ -0,0 +1,216 @@
# $NetBSD: mozilla-common.mk,v 1.1 2018/06/28 14:04:10 ryoon Exp $
#
# common Makefile fragment for mozilla packages based on gecko 2.0.
#
# used by www/firefox60/Makefile
HAS_CONFIGURE= yes
CONFIGURE_ARGS+= --prefix=${PREFIX}
USE_TOOLS+= pkg-config perl gmake autoconf213 unzip zip
USE_LANGUAGES+= c99 c++
UNLIMIT_RESOURCES+= datasize
.include "../../mk/bsd.prefs.mk"
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
BUILD_DEPENDS+= yasm>=1.1:../../devel/yasm
# Enable Google widevine CDM. This requires external libwidevinecdm.so.
#CONFIGURE_ARGS+= --enable-eme=widevine
.endif
# For rustc/cargo detection
CONFIGURE_ARGS+= --target=${MACHINE_GNU_PLATFORM:Q}
CONFIGURE_ARGS+= --host=${MACHINE_GNU_PLATFORM:Q}
CONFIGURE_ENV+= BINDGEN_CFLAGS="-isystem${PREFIX}/include/nspr \
-isystem${X11BASE}/include/pixman-1"
test:
cd ${WRKSRC}/${OBJDIR}/dist/bin && \
./run-mozilla.sh ${WRKSRC}/mach check-spidermonkey
# tar(1) of OpenBSD 5.5 has no --exclude command line option.
.if ${OPSYS} == "OpenBSD"
TOOLS_PLATFORM.tar= ${TOOLS_PATH.bsdtar}
USE_TOOLS+= bsdtar
.endif
GCC_REQD+= 4.9
.if ${MACHINE_ARCH} == "i386"
# Fix for PR pkg/48152.
CXXFLAGS+= -march=i586
# This is required for SSE2 code under i386.
CXXFLAGS+= -mstackrealign
.endif
CHECK_PORTABILITY_SKIP+=${MOZILLA_DIR}security/nss/tests/libpkix/libpkix.sh
CHECK_PORTABILITY_SKIP+=${MOZILLA_DIR}security/nss/tests/multinit/multinit.sh
CHECK_PORTABILITY_SKIP+=${MOZILLA_DIR}js/src/tests/update-test262.sh
CHECK_PORTABILITY_SKIP+=${MOZILLA_DIR}intl/icu/source/configure
CHECK_PORTABILITY_SKIP+=${MOZILLA_DIR}browser/components/loop/run-all-loop-tests.sh
CHECK_PORTABILITY_SKIP+=${MOZILLA_DIR}browser/extensions/loop/run-all-loop-tests.sh
CONFIGURE_ARGS+= --enable-default-toolkit=cairo-gtk3
CONFIGURE_ARGS+= --enable-pie
CONFIGURE_ARGS+= --disable-tests
CONFIGURE_ARGS+= --with-pthreads
# Mozilla Bug 1432751
#CONFIGURE_ARGS+= --enable-system-cairo
CONFIGURE_ARGS+= --enable-system-pixman
CONFIGURE_ARGS+= --with-system-libvpx
# textproc/hunspell 1.3 is too old
#CONFIGURE_ARGS+= --enable-system-hunspell
CONFIGURE_ARGS+= --enable-system-ffi
CONFIGURE_ARGS+= --with-system-icu
CONFIGURE_ARGS+= --with-system-nss
CONFIGURE_ARGS+= --with-system-nspr
CONFIGURE_ARGS+= --with-system-jpeg
CONFIGURE_ARGS+= --with-system-zlib
CONFIGURE_ARGS+= --with-system-bz2
CONFIGURE_ARGS+= --with-system-libevent=${BUILDLINK_PREFIX.libevent}
CONFIGURE_ARGS+= --disable-crashreporter
CONFIGURE_ARGS+= --disable-necko-wifi
CONFIGURE_ARGS+= --enable-chrome-format=flat
CONFIGURE_ARGS+= --disable-libjpeg-turbo
CONFIGURE_ARGS+= --disable-gconf
#CONFIGURE_ARGS+= --enable-readline
CONFIGURE_ARGS+= --disable-icf
CONFIGURE_ARGS+= --disable-updater
SUBST_CLASSES+= fix-paths
SUBST_STAGE.fix-paths= pre-configure
SUBST_MESSAGE.fix-paths= Fixing absolute paths.
SUBST_FILES.fix-paths+= ${MOZILLA_DIR}xpcom/io/nsAppFileLocationProvider.cpp
SUBST_SED.fix-paths+= -e 's,/usr/lib/mozilla/plugins,${PREFIX}/lib/netscape/plugins,g'
SUBST_CLASSES+= prefix
SUBST_STAGE.prefix= pre-configure
SUBST_MESSAGE.prefix= Setting PREFIX
SUBST_FILES.prefix+= ${MOZILLA_DIR}xpcom/build/BinaryPath.h
SUBST_VARS.prefix+= PREFIX
CONFIG_GUESS_OVERRIDE+= ${MOZILLA_DIR}build/autoconf/config.guess
CONFIG_GUESS_OVERRIDE+= ${MOZILLA_DIR}js/src/build/autoconf/config.guess
CONFIG_GUESS_OVERRIDE+= ${MOZILLA_DIR}nsprpub/build/autoconf/config.guess
CONFIG_GUESS_OVERRIDE+= ${MOZILLA_DIR}/js/ctypes/libffi/config.guess
CONFIG_SUB_OVERRIDE+= ${MOZILLA_DIR}build/autoconf/config.sub
CONFIG_SUB_OVERRIDE+= ${MOZILLA_DIR}js/src/build/autoconf/config.sub
CONFIG_SUB_OVERRIDE+= ${MOZILLA_DIR}nsprpub/build/autoconf/config.sub
CONFIG_SUB_OVERRIDE+= ${MOZILLA_DIR}/js/ctypes/libffi/config.sub
CONFIGURE_ENV+= CPP=${CPP}
SUBST_CLASSES+= python
SUBST_STAGE.python= pre-configure
SUBST_MESSAGE.python= Fixing path to python.
SUBST_FILES.python+= media/webrtc/trunk/build/common.gypi
SUBST_SED.python+= -e 's,<!(python,<!(${PYTHONBIN},'
# Build outside ${WRKSRC}
# Try to avoid conflict with config/makefiles/xpidl/Makefile.in
OBJDIR= ../build
CONFIGURE_DIRS= ${OBJDIR}
CONFIGURE_SCRIPT= ${WRKSRC}/configure
PLIST_VARS+= sps vorbis tremor glskia throwwrapper mozglue avx86
.include "../../mk/endian.mk"
.if ${MACHINE_ENDIAN} == "little"
PLIST.glskia= yes
.endif
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
PLIST.avx86= yes # see media/libav/README_MOZILLA: only used on x86
.endif
.if ${MACHINE_ARCH} != "sparc64"
# For some reasons the configure test for GCC bug 26905 still triggers on
# sparc64, which makes mozilla skip the installation of a few wrapper headers.
# Other archs end up with one additional file in the SDK headers
PLIST.throwwrapper= yes
.endif
.if !empty(MACHINE_PLATFORM:S/i386/x86/:MLinux-*-x86*)
PLIST.sps= yes
.endif
.if !empty(MACHINE_PLATFORM:MLinux-*-arm*)
PLIST.tremor= yes
.else
PLIST.vorbis= yes
.endif
# See ${WRKSRC}/mozglue/build/moz.build: libmozglue is built and
# installed as a shared library on these platforms.
.if ${OPSYS} == "Cygwin" || ${OPSYS} == "Darwin" # or Android
PLIST.mozglue= yes
.endif
# See ${WRKSRC}/security/sandbox/mac/Sandbox.mm: On Darwin, sandboxing
# support is only available when the toolkit is cairo-cocoa.
CONFIGURE_ARGS.Darwin+= --disable-sandbox
# See ${WRKSRC}/configure.in: It tries to use MacOS X 10.6 SDK by
# default, which is not always possible.
.if !empty(MACHINE_PLATFORM:MDarwin-8.*-*)
CONFIGURE_ARGS+= --enable-macos-target=10.4
.elif !empty(MACHINE_PLATFORM:MDarwin-9.*-*)
CONFIGURE_ARGS+= --enable-macos-target=10.5
.endif
# Makefiles sometimes call "rm -f" without more arguments. Kludge around ...
.PHONY: create-rm-wrapper
pre-configure: create-rm-wrapper
create-rm-wrapper:
printf '#!/bin/sh\n[ "$$*" = "-f" ] && exit 0\nexec /bin/rm $$@\n' > \
${WRAPPER_DIR}/bin/rm
chmod +x ${WRAPPER_DIR}/bin/rm
# The configure test for __thread succeeds, but later we end up with:
# dist/bin/libxul.so: undefined reference to `__tls_get_addr'
CONFIGURE_ENV.NetBSD+= ac_cv_thread_keyword=no
.if ${OPSYS} == "SunOS"
# native libbz2.so hides BZ2_crc32Table
PREFER.bzip2?= pkgsrc
.endif
.if ${OPSYS} == "OpenBSD"
PLIST_SUBST+= DLL_SUFFIX=".so.1.0"
.elif ${OPSYS} == "Darwin"
PLIST_SUBST+= DLL_SUFFIX=".dylib"
.else
PLIST_SUBST+= DLL_SUFFIX=".so"
.endif
.include "../../archivers/bzip2/buildlink3.mk"
BUILDLINK_API_DEPENDS.libevent+= libevent>=1.1
.include "../../devel/libevent/buildlink3.mk"
.include "../../devel/libffi/buildlink3.mk"
BUILDLINK_API_DEPENDS.nspr+= nspr>=4.18
.include "../../devel/nspr/buildlink3.mk"
.include "../../textproc/icu/buildlink3.mk"
BUILDLINK_API_DEPENDS.nss+= nss>=3.35
.include "../../devel/nss/buildlink3.mk"
.include "../../devel/zlib/buildlink3.mk"
.include "../../mk/jpeg.buildlink3.mk"
.include "../../graphics/MesaLib/buildlink3.mk"
#BUILDLINK_API_DEPENDS.cairo+= cairo>=1.10.2nb4
#.include "../../graphics/cairo/buildlink3.mk"
BUILDLINK_DEPMETHOD.clang= build
.include "../../lang/clang/buildlink3.mk"
BUILDLINK_API_DEPENDS.rust+= rust>=1.23.0
BUILDLINK_DEPMETHOD.rust= build
.include "../../lang/rust/buildlink3.mk"
BUILDLINK_API_DEPENDS.libvpx+= libvpx>=1.3.0
.include "../../multimedia/libvpx/buildlink3.mk"
.include "../../net/libIDL/buildlink3.mk"
# textproc/hunspell 1.3 is too old
#.include "../../textproc/hunspell/buildlink3.mk"
.include "../../multimedia/ffmpeg3/buildlink3.mk"
.include "../../x11/libXt/buildlink3.mk"
BUILDLINK_API_DEPENDS.pixman+= pixman>=0.25.2
.include "../../x11/pixman/buildlink3.mk"
.include "../../x11/gtk2/buildlink3.mk"
.include "../../x11/gtk3/buildlink3.mk"

107
www/firefox60/options.mk Normal file
View file

@ -0,0 +1,107 @@
# $NetBSD: options.mk,v 1.1 2018/06/28 14:04:10 ryoon Exp $
PKG_OPTIONS_VAR= PKG_OPTIONS.firefox60
PKG_SUPPORTED_OPTIONS= official-mozilla-branding
PKG_SUPPORTED_OPTIONS+= debug debug-info mozilla-jemalloc webrtc
PKG_SUPPORTED_OPTIONS+= alsa oss pulseaudio dbus
PKG_SUPPORTED_OPTIONS+= widevinecdm
PLIST_VARS+= gnome jemalloc debug
.if ${OPSYS} == "Linux"
PKG_SUGGESTED_OPTIONS+= pulseaudio mozilla-jemalloc dbus
.else
PKG_SUGGESTED_OPTIONS+= oss dbus
.endif
PKG_SUGGESTED_OPTIONS.Linux+= webrtc
.include "../../mk/bsd.options.mk"
.if !empty(PKG_OPTIONS:Malsa)
CONFIGURE_ARGS+= --enable-alsa
.include "../../audio/alsa-lib/buildlink3.mk"
.else
CONFIGURE_ARGS+= --disable-alsa
.endif
.if !empty(PKG_OPTIONS:Moss)
CONFIGURE_ARGS+= --with-oss
.include "../../mk/oss.buildlink3.mk"
.endif
.if !empty(PKG_OPTIONS:Mmozilla-jemalloc)
PLIST.jemalloc= yes
CONFIGURE_ARGS+= --enable-jemalloc
CONFIGURE_ARGS+= --enable-replace-malloc
.else
CONFIGURE_ARGS+= --disable-jemalloc
.endif
.include "../../mk/compiler.mk"
.if !empty(PKGSRC_COMPILER:Mgcc)
.if ${CC_VERSION:S/gcc-//:S/.//g} >= 480
# Modern gcc does not run any "tracking" passes when compiling with -O0,
# which makes the generated debug info mostly useless. So explicitly
# request them.
O0TRACKING=-fvar-tracking-assignments -fvar-tracking
.endif
.endif
.if !empty(PKG_OPTIONS:Mdebug)
CONFIGURE_ARGS+= --enable-debug="-g -O0 ${O0TRACKING}"
CONFIGURE_ARGS+= --disable-optimize
CONFIGURE_ARGS+= --enable-debug-js-modules
CONFIGURE_ARGS+= --disable-install-strip
PLIST.debug= yes
.else
.if !empty(PKG_OPTIONS:Mdebug-info)
CONFIGURE_ARGS+= --enable-debug-symbols
CONFIGURE_ARGS+= --enable-optimize=-O0
.else
CONFIGURE_ARGS+= --disable-debug-symbols
.endif
CONFIGURE_ARGS+= --disable-debug
CONFIGURE_ARGS+= --enable-optimize=-O2
CONFIGURE_ARGS+= --enable-install-strip
.endif
.if !empty(PKG_OPTIONS:Mpulseaudio)
.include "../../audio/pulseaudio/buildlink3.mk"
CONFIGURE_ARGS+= --enable-pulseaudio
.else
CONFIGURE_ARGS+= --disable-pulseaudio
.endif
.if !empty(PKG_OPTIONS:Mdbus)
.include "../../sysutils/dbus-glib/buildlink3.mk"
CONFIGURE_ARGS+= --enable-dbus
.else
CONFIGURE_ARGS+= --disable-dbus
.endif
PLIST_VARS+= branding nobranding
.if !empty(PKG_OPTIONS:Mofficial-mozilla-branding)
CONFIGURE_ARGS+= --enable-official-branding
LICENSE= mozilla-trademark-license
RESTRICTED= Trademark holder prohibits distribution of modified versions.
NO_BIN_ON_CDROM= ${RESTRICTED}
NO_BIN_ON_FTP= ${RESTRICTED}
PLIST.branding= yes
.else
PLIST.nobranding= yes
.endif
PLIST_VARS+= webrtc
.if !empty(PKG_OPTIONS:Mwebrtc)
.include "../../graphics/libv4l/buildlink3.mk"
CONFIGURE_ARGS+= --enable-webrtc
PLIST.webrtc= yes
.else
CONFIGURE_ARGS+= --disable-webrtc
.endif
# Enable Google widevine CDM. This requires external libwidevinecdm.so.
.if !empty(PKG_OPTIONS:Mwidevinecdm)
CONFIGURE_ARGS+= --enable-eme=widevine
.endif

View file

@ -0,0 +1,89 @@
$NetBSD: patch-aa,v 1.1 2018/06/28 14:04:10 ryoon Exp $
* Disable libjpeg-turbo check
* Add system libraries option
* Add OSS audio support
--- old-configure.in.orig 2018-05-03 16:58:31.000000000 +0000
+++ old-configure.in
@@ -1804,11 +1804,7 @@ if test "$MOZ_SYSTEM_JPEG" = 1; then
#include <jpeglib.h> ],
[ #if JPEG_LIB_VERSION < $MOZJPEG
#error "Insufficient JPEG library version ($MOZJPEG required)."
- #endif
- #ifndef JCS_EXTENSIONS
- #error "libjpeg-turbo JCS_EXTENSIONS required"
- #endif
- ],
+ #endif ],
MOZ_SYSTEM_JPEG=1,
AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
fi
@@ -2596,6 +2592,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 ==================================

View file

@ -0,0 +1,14 @@
$NetBSD: patch-browser_app_profile_firefox.js,v 1.1 2018/06/28 14:04:10 ryoon Exp $
--- browser/app/profile/firefox.js.orig 2018-05-16 05:38:23.000000000 +0000
+++ browser/app/profile/firefox.js
@@ -1747,3 +1747,9 @@ pref("app.shield.optoutstudies.enabled",
#else
pref("app.shield.optoutstudies.enabled", false);
#endif
+
+// Select UI locale from LANG/LC_MESSAGE environmental variables
+pref("intl.locale.requested", "");
+
+// Disable multiprocess window support. Workaround for PR 53273.
+pref("browser.tabs.remote.autostart", false);

View file

@ -0,0 +1,12 @@
$NetBSD: patch-build_moz.configure_old.configure,v 1.1 2018/06/28 14:04:10 ryoon Exp $
--- build/moz.configure/old.configure.orig 2018-05-03 16:58:26.000000000 +0000
+++ build/moz.configure/old.configure
@@ -262,6 +262,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',

View file

@ -0,0 +1,13 @@
$NetBSD: patch-dom_fetch_FetchConsumer.cpp,v 1.1 2018/06/28 14:04:10 ryoon Exp $
--- dom/fetch/FetchConsumer.cpp.orig 2018-05-03 16:58:26.000000000 +0000
+++ dom/fetch/FetchConsumer.cpp
@@ -616,7 +616,7 @@ FetchBodyConsumer<Derived>::ContinueCons
RefPtr<Promise> localPromise = mConsumePromise.forget();
RefPtr<FetchBodyConsumer<Derived>> self = this;
- auto autoReleaseObject = mozilla::MakeScopeExit([&] {
+ auto autoReleaseObject = mozilla::MakeScopeExit([self] {
self->ReleaseObject();
});

View file

@ -0,0 +1,14 @@
$NetBSD: patch-dom_media_CubebUtils.cpp,v 1.1 2018/06/28 14:04:10 ryoon Exp $
--- dom/media/CubebUtils.cpp.orig 2017-04-11 04:15:21.000000000 +0000
+++ 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 =

View file

@ -0,0 +1,15 @@
$NetBSD: patch-gfx_angle_checkout_src_common_third__party_smhasher_src_PMurHash.cpp,v 1.1 2018/06/28 14:04:10 ryoon Exp $
Fix build where _LITTLE_ENDIAN is not an integer.
--- gfx/angle/checkout/src/common/third_party/smhasher/src/PMurHash.cpp.orig 2018-06-05 19:47:29.000000000 +0000
+++ gfx/angle/checkout/src/common/third_party/smhasher/src/PMurHash.cpp
@@ -91,7 +91,7 @@ on big endian machines, or a byte-by-byt
/* gcc 'may' define __LITTLE_ENDIAN__ or __BIG_ENDIAN__ to 1 (Note the trailing __),
* or even _LITTLE_ENDIAN or _BIG_ENDIAN (Note the single _ prefix) */
#if !defined(__BYTE_ORDER)
- #if defined(__LITTLE_ENDIAN__) && __LITTLE_ENDIAN__==1 || defined(_LITTLE_ENDIAN) && _LITTLE_ENDIAN==1
+ #if defined(__LITTLE_ENDIAN__) && __LITTLE_ENDIAN__-0==1 || defined(_LITTLE_ENDIAN) && _LITTLE_ENDIAN-0==1
#define __BYTE_ORDER __LITTLE_ENDIAN
#elif defined(__BIG_ENDIAN__) && __BIG_ENDIAN__==1 || defined(_BIG_ENDIAN) && _BIG_ENDIAN==1
#define __BYTE_ORDER __BIG_ENDIAN

View file

@ -0,0 +1,25 @@
$NetBSD: patch-gfx_webrender_src_query.rs,v 1.1 2018/06/28 14:04:10 ryoon Exp $
--- gfx/webrender/src/query.rs.orig 2018-05-03 16:58:27.000000000 +0000
+++ gfx/webrender/src/query.rs
@@ -274,17 +274,20 @@ pub struct GpuMarker {
impl GpuMarker {
fn new(gl: &Rc<gl::Gl>, message: &str) -> Self {
+#[cfg(not(target_arch = "x86"))]
gl.push_group_marker_ext(message);
GpuMarker { gl: Rc::clone(gl) }
}
fn fire(gl: &Rc<gl::Gl>, message: &str) {
+#[cfg(not(target_arch = "x86"))]
gl.insert_event_marker_ext(message);
}
}
impl Drop for GpuMarker {
fn drop(&mut self) {
+#[cfg(not(target_arch = "x86"))]
self.gl.pop_group_marker_ext();
}
}

View file

@ -0,0 +1,367 @@
$NetBSD: patch-image_decoders_nsJPEGDecoder.cpp,v 1.1 2018/06/28 14:04:10 ryoon Exp $
Partially revert https://bugzilla.mozilla.org/show_bug.cgi?id=791305
to allow building against jpeg (not jpeg-turbo).
--- image/decoders/nsJPEGDecoder.cpp.orig 2016-10-31 20:15:32.000000000 +0000
+++ image/decoders/nsJPEGDecoder.cpp
@@ -28,13 +28,28 @@
extern "C" {
#include "iccjpeg.h"
-}
+#ifdef JCS_EXTENSIONS
#if MOZ_BIG_ENDIAN
#define MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB JCS_EXT_XRGB
#else
#define MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB JCS_EXT_BGRX
#endif
+#else
+/* Colorspace conversion (copied from jpegint.h) */
+struct jpeg_color_deconverter {
+ JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
+ JMETHOD(void, color_convert, (j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
+ JSAMPARRAY output_buf, int num_rows));
+};
+
+METHODDEF(void)
+ycc_rgb_convert_argb (j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
+ JSAMPARRAY output_buf, int num_rows);
+#endif
+}
static void cmyk_convert_rgb(JSAMPROW row, JDIMENSION width);
@@ -360,6 +375,7 @@ nsJPEGDecoder::ReadJPEGData(const char*
case JCS_GRAYSCALE:
case JCS_RGB:
case JCS_YCbCr:
+#ifdef JCS_EXTENSIONS
// if we're not color managing we can decode directly to
// MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB
if (mCMSMode != eCMSMode_All) {
@@ -368,6 +384,9 @@ nsJPEGDecoder::ReadJPEGData(const char*
} else {
mInfo.out_color_space = JCS_RGB;
}
+#else
+ mInfo.out_color_space = JCS_RGB;
+#endif
break;
case JCS_CMYK:
case JCS_YCCK:
@@ -441,6 +460,16 @@ nsJPEGDecoder::ReadJPEGData(const char*
return Transition::ContinueUnbuffered(State::JPEG_DATA); // I/O suspension
}
+#ifndef JCS_EXTENSIONS
+ /* Force to use our YCbCr to Packed RGB converter when possible */
+ if (!mTransform && (mCMSMode != eCMSMode_All) &&
+ mInfo.jpeg_color_space == JCS_YCbCr && mInfo.out_color_space == JCS_RGB) {
+ /* Special case for the most common case: transform from YCbCr direct into packed ARGB */
+ mInfo.out_color_components = 4; /* Packed ARGB pixels are always 4 bytes...*/
+ mInfo.cconvert->color_convert = ycc_rgb_convert_argb;
+ }
+#endif
+
// If this is a progressive JPEG ...
mState = mInfo.buffered_image ?
JPEG_DECOMPRESS_PROGRESSIVE : JPEG_DECOMPRESS_SEQUENTIAL;
@@ -638,7 +667,11 @@ nsJPEGDecoder::OutputScanlines(bool* sus
MOZ_ASSERT(imageRow, "Should have a row buffer here");
+#ifdef JCS_EXTENSIONS
if (mInfo.out_color_space == MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB) {
+#else
+ if (mInfo.cconvert->color_convert == ycc_rgb_convert_argb) {
+#endif
// Special case: scanline will be directly converted into packed ARGB
if (jpeg_read_scanlines(&mInfo, (JSAMPARRAY)&imageRow, 1) != 1) {
*suspend = true; // suspend
@@ -962,6 +995,282 @@ term_source (j_decompress_ptr jd)
} // namespace image
} // namespace mozilla
+#ifndef JCS_EXTENSIONS
+/**************** YCbCr -> Cairo's RGB24/ARGB32 conversion: most common case **************/
+
+/*
+ * YCbCr is defined per CCIR 601-1, except that Cb and Cr are
+ * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
+ * The conversion equations to be implemented are therefore
+ * R = Y + 1.40200 * Cr
+ * G = Y - 0.34414 * Cb - 0.71414 * Cr
+ * B = Y + 1.77200 * Cb
+ * where Cb and Cr represent the incoming values less CENTERJSAMPLE.
+ * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.)
+ *
+ * To avoid floating-point arithmetic, we represent the fractional constants
+ * as integers scaled up by 2^16 (about 4 digits precision); we have to divide
+ * the products by 2^16, with appropriate rounding, to get the correct answer.
+ * Notice that Y, being an integral input, does not contribute any fraction
+ * so it need not participate in the rounding.
+ *
+ * For even more speed, we avoid doing any multiplications in the inner loop
+ * by precalculating the constants times Cb and Cr for all possible values.
+ * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
+ * for 12-bit samples it is still acceptable. It's not very reasonable for
+ * 16-bit samples, but if you want lossless storage you shouldn't be changing
+ * colorspace anyway.
+ * The Cr=>R and Cb=>B values can be rounded to integers in advance; the
+ * values for the G calculation are left scaled up, since we must add them
+ * together before rounding.
+ */
+
+#define SCALEBITS 16 /* speediest right-shift on some machines */
+
+/* Use static tables for color processing. */
+/* Four tables, each 256 entries of 4 bytes totals 4K which is not bad... */
+
+const int Cr_r_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
+ -0xb3, -0xb2, -0xb1, -0xaf, -0xae, -0xac,
+ -0xab, -0xaa, -0xa8, -0xa7, -0xa5, -0xa4,
+ -0xa3, -0xa1, -0xa0, -0x9e, -0x9d, -0x9c,
+ -0x9a, -0x99, -0x97, -0x96, -0x95, -0x93,
+ -0x92, -0x90, -0x8f, -0x8e, -0x8c, -0x8b,
+ -0x89, -0x88, -0x87, -0x85, -0x84, -0x82,
+ -0x81, -0x80, -0x7e, -0x7d, -0x7b, -0x7a,
+ -0x79, -0x77, -0x76, -0x74, -0x73, -0x72,
+ -0x70, -0x6f, -0x6d, -0x6c, -0x6b, -0x69,
+ -0x68, -0x66, -0x65, -0x64, -0x62, -0x61,
+ -0x5f, -0x5e, -0x5d, -0x5b, -0x5a, -0x58,
+ -0x57, -0x56, -0x54, -0x53, -0x51, -0x50,
+ -0x4f, -0x4d, -0x4c, -0x4a, -0x49, -0x48,
+ -0x46, -0x45, -0x43, -0x42, -0x40, -0x3f,
+ -0x3e, -0x3c, -0x3b, -0x39, -0x38, -0x37,
+ -0x35, -0x34, -0x32, -0x31, -0x30, -0x2e,
+ -0x2d, -0x2b, -0x2a, -0x29, -0x27, -0x26,
+ -0x24, -0x23, -0x22, -0x20, -0x1f, -0x1d,
+ -0x1c, -0x1b, -0x19, -0x18, -0x16, -0x15,
+ -0x14, -0x12, -0x11, -0x0f, -0x0e, -0x0d,
+ -0x0b, -0x0a, -0x08, -0x07, -0x06, -0x04,
+ -0x03, -0x01, 0x00, 0x01, 0x03, 0x04,
+ 0x06, 0x07, 0x08, 0x0a, 0x0b, 0x0d,
+ 0x0e, 0x0f, 0x11, 0x12, 0x14, 0x15,
+ 0x16, 0x18, 0x19, 0x1b, 0x1c, 0x1d,
+ 0x1f, 0x20, 0x22, 0x23, 0x24, 0x26,
+ 0x27, 0x29, 0x2a, 0x2b, 0x2d, 0x2e,
+ 0x30, 0x31, 0x32, 0x34, 0x35, 0x37,
+ 0x38, 0x39, 0x3b, 0x3c, 0x3e, 0x3f,
+ 0x40, 0x42, 0x43, 0x45, 0x46, 0x48,
+ 0x49, 0x4a, 0x4c, 0x4d, 0x4f, 0x50,
+ 0x51, 0x53, 0x54, 0x56, 0x57, 0x58,
+ 0x5a, 0x5b, 0x5d, 0x5e, 0x5f, 0x61,
+ 0x62, 0x64, 0x65, 0x66, 0x68, 0x69,
+ 0x6b, 0x6c, 0x6d, 0x6f, 0x70, 0x72,
+ 0x73, 0x74, 0x76, 0x77, 0x79, 0x7a,
+ 0x7b, 0x7d, 0x7e, 0x80, 0x81, 0x82,
+ 0x84, 0x85, 0x87, 0x88, 0x89, 0x8b,
+ 0x8c, 0x8e, 0x8f, 0x90, 0x92, 0x93,
+ 0x95, 0x96, 0x97, 0x99, 0x9a, 0x9c,
+ 0x9d, 0x9e, 0xa0, 0xa1, 0xa3, 0xa4,
+ 0xa5, 0xa7, 0xa8, 0xaa, 0xab, 0xac,
+ 0xae, 0xaf, 0xb1, 0xb2,
+ };
+
+const int Cb_b_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
+ -0xe3, -0xe1, -0xdf, -0xde, -0xdc, -0xda,
+ -0xd8, -0xd6, -0xd5, -0xd3, -0xd1, -0xcf,
+ -0xce, -0xcc, -0xca, -0xc8, -0xc6, -0xc5,
+ -0xc3, -0xc1, -0xbf, -0xbe, -0xbc, -0xba,
+ -0xb8, -0xb7, -0xb5, -0xb3, -0xb1, -0xaf,
+ -0xae, -0xac, -0xaa, -0xa8, -0xa7, -0xa5,
+ -0xa3, -0xa1, -0x9f, -0x9e, -0x9c, -0x9a,
+ -0x98, -0x97, -0x95, -0x93, -0x91, -0x90,
+ -0x8e, -0x8c, -0x8a, -0x88, -0x87, -0x85,
+ -0x83, -0x81, -0x80, -0x7e, -0x7c, -0x7a,
+ -0x78, -0x77, -0x75, -0x73, -0x71, -0x70,
+ -0x6e, -0x6c, -0x6a, -0x69, -0x67, -0x65,
+ -0x63, -0x61, -0x60, -0x5e, -0x5c, -0x5a,
+ -0x59, -0x57, -0x55, -0x53, -0x52, -0x50,
+ -0x4e, -0x4c, -0x4a, -0x49, -0x47, -0x45,
+ -0x43, -0x42, -0x40, -0x3e, -0x3c, -0x3a,
+ -0x39, -0x37, -0x35, -0x33, -0x32, -0x30,
+ -0x2e, -0x2c, -0x2b, -0x29, -0x27, -0x25,
+ -0x23, -0x22, -0x20, -0x1e, -0x1c, -0x1b,
+ -0x19, -0x17, -0x15, -0x13, -0x12, -0x10,
+ -0x0e, -0x0c, -0x0b, -0x09, -0x07, -0x05,
+ -0x04, -0x02, 0x00, 0x02, 0x04, 0x05,
+ 0x07, 0x09, 0x0b, 0x0c, 0x0e, 0x10,
+ 0x12, 0x13, 0x15, 0x17, 0x19, 0x1b,
+ 0x1c, 0x1e, 0x20, 0x22, 0x23, 0x25,
+ 0x27, 0x29, 0x2b, 0x2c, 0x2e, 0x30,
+ 0x32, 0x33, 0x35, 0x37, 0x39, 0x3a,
+ 0x3c, 0x3e, 0x40, 0x42, 0x43, 0x45,
+ 0x47, 0x49, 0x4a, 0x4c, 0x4e, 0x50,
+ 0x52, 0x53, 0x55, 0x57, 0x59, 0x5a,
+ 0x5c, 0x5e, 0x60, 0x61, 0x63, 0x65,
+ 0x67, 0x69, 0x6a, 0x6c, 0x6e, 0x70,
+ 0x71, 0x73, 0x75, 0x77, 0x78, 0x7a,
+ 0x7c, 0x7e, 0x80, 0x81, 0x83, 0x85,
+ 0x87, 0x88, 0x8a, 0x8c, 0x8e, 0x90,
+ 0x91, 0x93, 0x95, 0x97, 0x98, 0x9a,
+ 0x9c, 0x9e, 0x9f, 0xa1, 0xa3, 0xa5,
+ 0xa7, 0xa8, 0xaa, 0xac, 0xae, 0xaf,
+ 0xb1, 0xb3, 0xb5, 0xb7, 0xb8, 0xba,
+ 0xbc, 0xbe, 0xbf, 0xc1, 0xc3, 0xc5,
+ 0xc6, 0xc8, 0xca, 0xcc, 0xce, 0xcf,
+ 0xd1, 0xd3, 0xd5, 0xd6, 0xd8, 0xda,
+ 0xdc, 0xde, 0xdf, 0xe1,
+ };
+
+const int Cr_g_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
+ 0x5b6900, 0x5ab22e, 0x59fb5c, 0x59448a, 0x588db8, 0x57d6e6,
+ 0x572014, 0x566942, 0x55b270, 0x54fb9e, 0x5444cc, 0x538dfa,
+ 0x52d728, 0x522056, 0x516984, 0x50b2b2, 0x4ffbe0, 0x4f450e,
+ 0x4e8e3c, 0x4dd76a, 0x4d2098, 0x4c69c6, 0x4bb2f4, 0x4afc22,
+ 0x4a4550, 0x498e7e, 0x48d7ac, 0x4820da, 0x476a08, 0x46b336,
+ 0x45fc64, 0x454592, 0x448ec0, 0x43d7ee, 0x43211c, 0x426a4a,
+ 0x41b378, 0x40fca6, 0x4045d4, 0x3f8f02, 0x3ed830, 0x3e215e,
+ 0x3d6a8c, 0x3cb3ba, 0x3bfce8, 0x3b4616, 0x3a8f44, 0x39d872,
+ 0x3921a0, 0x386ace, 0x37b3fc, 0x36fd2a, 0x364658, 0x358f86,
+ 0x34d8b4, 0x3421e2, 0x336b10, 0x32b43e, 0x31fd6c, 0x31469a,
+ 0x308fc8, 0x2fd8f6, 0x2f2224, 0x2e6b52, 0x2db480, 0x2cfdae,
+ 0x2c46dc, 0x2b900a, 0x2ad938, 0x2a2266, 0x296b94, 0x28b4c2,
+ 0x27fdf0, 0x27471e, 0x26904c, 0x25d97a, 0x2522a8, 0x246bd6,
+ 0x23b504, 0x22fe32, 0x224760, 0x21908e, 0x20d9bc, 0x2022ea,
+ 0x1f6c18, 0x1eb546, 0x1dfe74, 0x1d47a2, 0x1c90d0, 0x1bd9fe,
+ 0x1b232c, 0x1a6c5a, 0x19b588, 0x18feb6, 0x1847e4, 0x179112,
+ 0x16da40, 0x16236e, 0x156c9c, 0x14b5ca, 0x13fef8, 0x134826,
+ 0x129154, 0x11da82, 0x1123b0, 0x106cde, 0x0fb60c, 0x0eff3a,
+ 0x0e4868, 0x0d9196, 0x0cdac4, 0x0c23f2, 0x0b6d20, 0x0ab64e,
+ 0x09ff7c, 0x0948aa, 0x0891d8, 0x07db06, 0x072434, 0x066d62,
+ 0x05b690, 0x04ffbe, 0x0448ec, 0x03921a, 0x02db48, 0x022476,
+ 0x016da4, 0x00b6d2, 0x000000, -0x00b6d2, -0x016da4, -0x022476,
+ -0x02db48, -0x03921a, -0x0448ec, -0x04ffbe, -0x05b690, -0x066d62,
+ -0x072434, -0x07db06, -0x0891d8, -0x0948aa, -0x09ff7c, -0x0ab64e,
+ -0x0b6d20, -0x0c23f2, -0x0cdac4, -0x0d9196, -0x0e4868, -0x0eff3a,
+ -0x0fb60c, -0x106cde, -0x1123b0, -0x11da82, -0x129154, -0x134826,
+ -0x13fef8, -0x14b5ca, -0x156c9c, -0x16236e, -0x16da40, -0x179112,
+ -0x1847e4, -0x18feb6, -0x19b588, -0x1a6c5a, -0x1b232c, -0x1bd9fe,
+ -0x1c90d0, -0x1d47a2, -0x1dfe74, -0x1eb546, -0x1f6c18, -0x2022ea,
+ -0x20d9bc, -0x21908e, -0x224760, -0x22fe32, -0x23b504, -0x246bd6,
+ -0x2522a8, -0x25d97a, -0x26904c, -0x27471e, -0x27fdf0, -0x28b4c2,
+ -0x296b94, -0x2a2266, -0x2ad938, -0x2b900a, -0x2c46dc, -0x2cfdae,
+ -0x2db480, -0x2e6b52, -0x2f2224, -0x2fd8f6, -0x308fc8, -0x31469a,
+ -0x31fd6c, -0x32b43e, -0x336b10, -0x3421e2, -0x34d8b4, -0x358f86,
+ -0x364658, -0x36fd2a, -0x37b3fc, -0x386ace, -0x3921a0, -0x39d872,
+ -0x3a8f44, -0x3b4616, -0x3bfce8, -0x3cb3ba, -0x3d6a8c, -0x3e215e,
+ -0x3ed830, -0x3f8f02, -0x4045d4, -0x40fca6, -0x41b378, -0x426a4a,
+ -0x43211c, -0x43d7ee, -0x448ec0, -0x454592, -0x45fc64, -0x46b336,
+ -0x476a08, -0x4820da, -0x48d7ac, -0x498e7e, -0x4a4550, -0x4afc22,
+ -0x4bb2f4, -0x4c69c6, -0x4d2098, -0x4dd76a, -0x4e8e3c, -0x4f450e,
+ -0x4ffbe0, -0x50b2b2, -0x516984, -0x522056, -0x52d728, -0x538dfa,
+ -0x5444cc, -0x54fb9e, -0x55b270, -0x566942, -0x572014, -0x57d6e6,
+ -0x588db8, -0x59448a, -0x59fb5c, -0x5ab22e,
+ };
+
+const int Cb_g_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
+ 0x2c8d00, 0x2c34e6, 0x2bdccc, 0x2b84b2, 0x2b2c98, 0x2ad47e,
+ 0x2a7c64, 0x2a244a, 0x29cc30, 0x297416, 0x291bfc, 0x28c3e2,
+ 0x286bc8, 0x2813ae, 0x27bb94, 0x27637a, 0x270b60, 0x26b346,
+ 0x265b2c, 0x260312, 0x25aaf8, 0x2552de, 0x24fac4, 0x24a2aa,
+ 0x244a90, 0x23f276, 0x239a5c, 0x234242, 0x22ea28, 0x22920e,
+ 0x2239f4, 0x21e1da, 0x2189c0, 0x2131a6, 0x20d98c, 0x208172,
+ 0x202958, 0x1fd13e, 0x1f7924, 0x1f210a, 0x1ec8f0, 0x1e70d6,
+ 0x1e18bc, 0x1dc0a2, 0x1d6888, 0x1d106e, 0x1cb854, 0x1c603a,
+ 0x1c0820, 0x1bb006, 0x1b57ec, 0x1affd2, 0x1aa7b8, 0x1a4f9e,
+ 0x19f784, 0x199f6a, 0x194750, 0x18ef36, 0x18971c, 0x183f02,
+ 0x17e6e8, 0x178ece, 0x1736b4, 0x16de9a, 0x168680, 0x162e66,
+ 0x15d64c, 0x157e32, 0x152618, 0x14cdfe, 0x1475e4, 0x141dca,
+ 0x13c5b0, 0x136d96, 0x13157c, 0x12bd62, 0x126548, 0x120d2e,
+ 0x11b514, 0x115cfa, 0x1104e0, 0x10acc6, 0x1054ac, 0x0ffc92,
+ 0x0fa478, 0x0f4c5e, 0x0ef444, 0x0e9c2a, 0x0e4410, 0x0debf6,
+ 0x0d93dc, 0x0d3bc2, 0x0ce3a8, 0x0c8b8e, 0x0c3374, 0x0bdb5a,
+ 0x0b8340, 0x0b2b26, 0x0ad30c, 0x0a7af2, 0x0a22d8, 0x09cabe,
+ 0x0972a4, 0x091a8a, 0x08c270, 0x086a56, 0x08123c, 0x07ba22,
+ 0x076208, 0x0709ee, 0x06b1d4, 0x0659ba, 0x0601a0, 0x05a986,
+ 0x05516c, 0x04f952, 0x04a138, 0x04491e, 0x03f104, 0x0398ea,
+ 0x0340d0, 0x02e8b6, 0x02909c, 0x023882, 0x01e068, 0x01884e,
+ 0x013034, 0x00d81a, 0x008000, 0x0027e6, -0x003034, -0x00884e,
+ -0x00e068, -0x013882, -0x01909c, -0x01e8b6, -0x0240d0, -0x0298ea,
+ -0x02f104, -0x03491e, -0x03a138, -0x03f952, -0x04516c, -0x04a986,
+ -0x0501a0, -0x0559ba, -0x05b1d4, -0x0609ee, -0x066208, -0x06ba22,
+ -0x07123c, -0x076a56, -0x07c270, -0x081a8a, -0x0872a4, -0x08cabe,
+ -0x0922d8, -0x097af2, -0x09d30c, -0x0a2b26, -0x0a8340, -0x0adb5a,
+ -0x0b3374, -0x0b8b8e, -0x0be3a8, -0x0c3bc2, -0x0c93dc, -0x0cebf6,
+ -0x0d4410, -0x0d9c2a, -0x0df444, -0x0e4c5e, -0x0ea478, -0x0efc92,
+ -0x0f54ac, -0x0facc6, -0x1004e0, -0x105cfa, -0x10b514, -0x110d2e,
+ -0x116548, -0x11bd62, -0x12157c, -0x126d96, -0x12c5b0, -0x131dca,
+ -0x1375e4, -0x13cdfe, -0x142618, -0x147e32, -0x14d64c, -0x152e66,
+ -0x158680, -0x15de9a, -0x1636b4, -0x168ece, -0x16e6e8, -0x173f02,
+ -0x17971c, -0x17ef36, -0x184750, -0x189f6a, -0x18f784, -0x194f9e,
+ -0x19a7b8, -0x19ffd2, -0x1a57ec, -0x1ab006, -0x1b0820, -0x1b603a,
+ -0x1bb854, -0x1c106e, -0x1c6888, -0x1cc0a2, -0x1d18bc, -0x1d70d6,
+ -0x1dc8f0, -0x1e210a, -0x1e7924, -0x1ed13e, -0x1f2958, -0x1f8172,
+ -0x1fd98c, -0x2031a6, -0x2089c0, -0x20e1da, -0x2139f4, -0x21920e,
+ -0x21ea28, -0x224242, -0x229a5c, -0x22f276, -0x234a90, -0x23a2aa,
+ -0x23fac4, -0x2452de, -0x24aaf8, -0x250312, -0x255b2c, -0x25b346,
+ -0x260b60, -0x26637a, -0x26bb94, -0x2713ae, -0x276bc8, -0x27c3e2,
+ -0x281bfc, -0x287416, -0x28cc30, -0x29244a, -0x297c64, -0x29d47e,
+ -0x2a2c98, -0x2a84b2, -0x2adccc, -0x2b34e6,
+ };
+
+
+/* We assume that right shift corresponds to signed division by 2 with
+ * rounding towards minus infinity. This is correct for typical "arithmetic
+ * shift" instructions that shift in copies of the sign bit. But some
+ * C compilers implement >> with an unsigned shift. For these machines you
+ * must define RIGHT_SHIFT_IS_UNSIGNED.
+ * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.
+ * It is only applied with constant shift counts. SHIFT_TEMPS must be
+ * included in the variables of any routine using RIGHT_SHIFT.
+ */
+
+#ifdef RIGHT_SHIFT_IS_UNSIGNED
+#define SHIFT_TEMPS INT32 shift_temp;
+#define RIGHT_SHIFT(x,shft) \
+ ((shift_temp = (x)) < 0 ? \
+ (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
+ (shift_temp >> (shft)))
+#else
+#define SHIFT_TEMPS
+#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
+#endif
+
+
+METHODDEF(void)
+ycc_rgb_convert_argb (j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
+ JSAMPARRAY output_buf, int num_rows)
+{
+ JDIMENSION num_cols = cinfo->output_width;
+ JSAMPLE * range_limit = cinfo->sample_range_limit;
+
+ SHIFT_TEMPS
+
+ /* This is used if we don't have SSE2 */
+
+ while (--num_rows >= 0) {
+ JSAMPROW inptr0 = input_buf[0][input_row];
+ JSAMPROW inptr1 = input_buf[1][input_row];
+ JSAMPROW inptr2 = input_buf[2][input_row];
+ input_row++;
+ uint32_t *outptr = (uint32_t *) *output_buf++;
+ for (JDIMENSION col = 0; col < num_cols; col++) {
+ int y = GETJSAMPLE(inptr0[col]);
+ int cb = GETJSAMPLE(inptr1[col]);
+ int cr = GETJSAMPLE(inptr2[col]);
+ JSAMPLE * range_limit_y = range_limit + y;
+ /* Range-limiting is essential due to noise introduced by DCT losses. */
+ outptr[col] = 0xFF000000 |
+ ( range_limit_y[Cr_r_tab[cr]] << 16 ) |
+ ( range_limit_y[((int) RIGHT_SHIFT(Cb_g_tab[cb] + Cr_g_tab[cr], SCALEBITS))] << 8 ) |
+ ( range_limit_y[Cb_b_tab[cb]] );
+ }
+ }
+}
+#endif
+
+
///*************** Inverted CMYK -> RGB conversion *************************
/// Input is (Inverted) CMYK stored as 4 bytes per pixel.
/// Output is RGB stored as 3 bytes per pixel.

View file

@ -0,0 +1,15 @@
$NetBSD: patch-ipc_chromium_src_base_lock__impl__posix.cc,v 1.1 2018/06/28 14:04:10 ryoon Exp $
- Fix build on NetBSD 7.1 (which doesn't have PTHREAD_PRIO_INHERIT)
--- ipc/chromium/src/base/lock_impl_posix.cc.orig 2017-06-05 20:45:20.000000000 +0000
+++ ipc/chromium/src/base/lock_impl_posix.cc
@@ -20,7 +20,7 @@ namespace internal {
// Lock::PriorityInheritanceAvailable still must be checked as the code may
// compile but the underlying platform still may not correctly support priority
// inheritance locks.
-#if defined(OS_NACL) || defined(OS_ANDROID)
+#if defined(OS_NACL) || defined(OS_ANDROID) || (defined(__NetBSD__) && !defined(PTHREAD_PRIO_INHERIT))
#define PRIORITY_INHERITANCE_LOCKS_POSSIBLE() 0
#else
#define PRIORITY_INHERITANCE_LOCKS_POSSIBLE() 1

View file

@ -0,0 +1,22 @@
$NetBSD: patch-ipc_chromium_src_base_message__pump__libevent.cc,v 1.1 2018/06/28 14:04:10 ryoon Exp $
Allow older libevent
--- ipc/chromium/src/base/message_pump_libevent.cc.orig 2017-02-27 08:10:53.000000000 -0800
+++ ipc/chromium/src/base/message_pump_libevent.cc 2017-03-07 14:06:51.000000000 -0800
@@ -22,6 +22,7 @@
// This macro checks that the _EVENT_SIZEOF_* constants defined in
// ipc/chromiume/src/third_party/<platform>/event2/event-config.h are correct.
+#if 0
#if defined(_EVENT_SIZEOF_SHORT)
#define CHECK_EVENT_SIZEOF(TYPE, type) \
static_assert(_EVENT_SIZEOF_##TYPE == sizeof(type), \
@@ -40,6 +41,7 @@ CHECK_EVENT_SIZEOF(PTHREAD_T, pthread_t)
CHECK_EVENT_SIZEOF(SHORT, short);
CHECK_EVENT_SIZEOF(SIZE_T, size_t);
CHECK_EVENT_SIZEOF(VOID_P, void*);
+#endif
// Lifecycle of struct event
// Libevent uses two main data structures:

View file

@ -0,0 +1,26 @@
$NetBSD: patch-ipc_chromium_src_base_platform__thread__posix.cc,v 1.1 2018/06/28 14:04:10 ryoon Exp $
* Support NetBSD
* Support Solaris (we can't rely on pthread_setname_np so ignore it).
--- ipc/chromium/src/base/platform_thread_posix.cc.orig 2018-06-05 19:47:29.000000000 +0000
+++ ipc/chromium/src/base/platform_thread_posix.cc
@@ -12,7 +12,9 @@
#if defined(OS_MACOSX)
#include <mach/mach.h>
#elif defined(OS_NETBSD)
+_Pragma("GCC visibility push(default)")
#include <lwp.h>
+_Pragma("GCC visibility pop")
#elif defined(OS_LINUX)
#include <sys/syscall.h>
#include <sys/prctl.h>
@@ -103,7 +105,7 @@ void PlatformThread::SetName(const char*
pthread_setname_np(pthread_self(), "%s", (void *)name);
#elif defined(OS_BSD) && !defined(__GLIBC__)
pthread_set_name_np(pthread_self(), name);
-#elif defined(OS_SOLARIS)
+#elif defined(notOS_SOLARIS)
pthread_setname_np(pthread_self(), name);
#else
#endif

View file

@ -0,0 +1,21 @@
$NetBSD: patch-ipc_glue_CrossProcessSemaphore.h,v 1.1 2018/06/28 14:04:10 ryoon Exp $
- avoid use of sem_t on NetBSD
http://mail-index.netbsd.org/pkgsrc-bugs/2017/06/23/msg062225.html
--- ipc/glue/CrossProcessSemaphore.h.orig 2017-06-05 20:45:20.000000000 +0000
+++ ipc/glue/CrossProcessSemaphore.h
@@ -91,7 +91,13 @@ private:
HANDLE mSemaphore;
#elif !defined(OS_MACOSX)
RefPtr<mozilla::ipc::SharedMemoryBasic> mSharedBuffer;
+#if defined(__NetBSD__)
+ pthread_mutex_t* mMutex;
+ pthread_cond_t* mNotZero;
+ uint32_t* mValue;
+#else
sem_t* mSemaphore;
+#endif
mozilla::Atomic<int32_t>* mRefCount;
#endif
};

View file

@ -0,0 +1,191 @@
$NetBSD: patch-ipc_glue_CrossProcessSemaphore__posix.cpp,v 1.1 2018/06/28 14:04:10 ryoon Exp $
- avoid use of sem_t on NetBSD
http://mail-index.netbsd.org/pkgsrc-bugs/2017/06/23/msg062225.html
--- ipc/glue/CrossProcessSemaphore_posix.cpp.orig 2017-09-14 20:16:01.000000000 +0000
+++ ipc/glue/CrossProcessSemaphore_posix.cpp
@@ -9,6 +9,11 @@
#include "nsDebug.h"
#include "nsISupportsImpl.h"
#include <errno.h>
+#if defined(__NetBSD__)
+#include <iostream>
+#include <unistd.h>
+#include <limits>
+#endif
static const uint64_t kNsPerMs = 1000000;
static const uint64_t kNsPerSec = 1000000000;
@@ -17,7 +22,13 @@ namespace {
struct SemaphoreData {
+#if defined(__NetBSD__)
+ pthread_mutex_t mMutex;
+ pthread_cond_t mNotZero;
+ uint32_t mValue;
+#else
sem_t mSemaphore;
+#endif
mozilla::Atomic<int32_t> mRefCount;
uint32_t mInitialValue;
};
@@ -44,13 +55,27 @@ CrossProcessSemaphore::Create(const char
return nullptr;
}
+#if defined(__NetBSD__)
+ data->mValue = aInitialValue;
+ if (pthread_mutex_init(&data->mMutex, NULL) ||
+ pthread_cond_init(&data->mNotZero, NULL) ) {
+ return nullptr;
+ }
+#else
if (sem_init(&data->mSemaphore, 1, aInitialValue)) {
return nullptr;
}
+#endif
CrossProcessSemaphore* sem = new CrossProcessSemaphore;
sem->mSharedBuffer = sharedBuffer;
+#if defined(__NetBSD__)
+ sem->mMutex = &data->mMutex;
+ sem->mNotZero = &data->mNotZero;
+ sem->mValue = &data->mValue;
+#else
sem->mSemaphore = &data->mSemaphore;
+#endif
sem->mRefCount = &data->mRefCount;
*sem->mRefCount = 1;
@@ -84,24 +109,44 @@ CrossProcessSemaphore::Create(CrossProce
int32_t oldCount = data->mRefCount++;
if (oldCount == 0) {
+#if defined(__NetBSD__)
+ if (pthread_mutex_init(&data->mMutex, NULL) ||
+ pthread_cond_init(&data->mNotZero, NULL) ) {
+ data->mRefCount--;
+ return nullptr;
+ }
+#else
// The other side has already let go of their CrossProcessSemaphore, so now
// mSemaphore is garbage. We need to re-initialize it.
if (sem_init(&data->mSemaphore, 1, data->mInitialValue)) {
data->mRefCount--;
return nullptr;
}
+#endif
}
CrossProcessSemaphore* sem = new CrossProcessSemaphore;
sem->mSharedBuffer = sharedBuffer;
+#if defined(__NetBSD__)
+ sem->mMutex = &data->mMutex;
+ sem->mNotZero = &data->mNotZero;
+ sem->mValue = &data->mValue;
+#else
sem->mSemaphore = &data->mSemaphore;
+#endif
sem->mRefCount = &data->mRefCount;
return sem;
}
CrossProcessSemaphore::CrossProcessSemaphore()
+#if defined(__NetBSD__)
+ : mMutex (nullptr)
+ , mNotZero (nullptr)
+ , mValue (nullptr)
+#else
: mSemaphore(nullptr)
+#endif
, mRefCount(nullptr)
{
MOZ_COUNT_CTOR(CrossProcessSemaphore);
@@ -113,17 +158,58 @@ CrossProcessSemaphore::~CrossProcessSema
if (oldCount == 0) {
// Nothing can be done if the destroy fails so ignore return code.
+#if defined(__NetBSD__)
+ (void)pthread_cond_destroy(mNotZero);
+ (void)pthread_mutex_destroy(mMutex);
+#else
Unused << sem_destroy(mSemaphore);
+#endif
}
MOZ_COUNT_DTOR(CrossProcessSemaphore);
}
+#if defined(__NetBSD__)
+static struct timespec
+makeAbsTime(const Maybe<TimeDuration>& aWaitTime) {
+ struct timespec ts;
+ if (aWaitTime.isSome()) {
+ clock_gettime(CLOCK_REALTIME, &ts);
+ ts.tv_nsec += (kNsPerMs * aWaitTime->ToMilliseconds());
+ ts.tv_sec += ts.tv_nsec / kNsPerSec;
+ ts.tv_nsec %= kNsPerSec;
+ }
+ else {
+ ts.tv_sec = std::numeric_limits<time_t>::max();
+ ts.tv_nsec = 0;
+ }
+ return ts;
+}
+#endif
+
bool
CrossProcessSemaphore::Wait(const Maybe<TimeDuration>& aWaitTime)
{
MOZ_ASSERT(*mRefCount > 0, "Attempting to wait on a semaphore with zero ref count");
int ret;
+#if defined(__NetBSD__)
+ struct timespec ts = makeAbsTime(aWaitTime);
+
+ ret = pthread_mutex_lock(mMutex);
+
+ if (ret == 0) {
+ while (ret == 0 && mValue == 0) {
+ ret = pthread_cond_timedwait(mNotZero, mMutex, &ts);
+ while (ret == -1 && errno == EINTR) {
+ ret = pthread_cond_timedwait(mNotZero, mMutex, &ts);
+ }
+ }
+ if (ret == 0) {
+ --(*mValue);
+ }
+ pthread_mutex_unlock(mMutex);
+ }
+#else
if (aWaitTime.isSome()) {
struct timespec ts;
if (clock_gettime(CLOCK_REALTIME, &ts) == -1) {
@@ -140,6 +226,7 @@ CrossProcessSemaphore::Wait(const Maybe<
while ((ret = sem_wait(mSemaphore)) == -1 && errno == EINTR) {
}
}
+#endif
return ret == 0;
}
@@ -147,7 +234,17 @@ void
CrossProcessSemaphore::Signal()
{
MOZ_ASSERT(*mRefCount > 0, "Attempting to signal a semaphore with zero ref count");
+#if defined(__NetBSD__)
+ int ret;
+ ret = pthread_mutex_lock(mMutex);
+ if (ret == 0) {
+ ++(*mValue);
+ pthread_cond_signal(mNotZero);
+ pthread_mutex_unlock(mMutex);
+ }
+#else
sem_post(mSemaphore);
+#endif
}
CrossProcessSemaphoreHandle

View file

@ -0,0 +1,21 @@
$NetBSD: patch-ipc_glue_GeckoChildProcessHost.cpp,v 1.1 2018/06/28 14:04:10 ryoon Exp $
* Support Solaris
* Fix NetBSD linking
--- ipc/glue/GeckoChildProcessHost.cpp.orig 2017-07-31 16:20:47.000000000 +0000
+++ ipc/glue/GeckoChildProcessHost.cpp
@@ -4,7 +4,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+#if defined(__NetBSD__)
+_Pragma("GCC visibility push(default)")
+#endif
#include "GeckoChildProcessHost.h"
+#if defined(__NetBSD__)
+_Pragma("GCC visibility pop")
+#endif
#include "base/command_line.h"
#include "base/string_util.h"

View file

@ -0,0 +1,23 @@
$NetBSD: patch-js_src_gc_Memory.cpp,v 1.1 2018/06/28 14:04:10 ryoon Exp $
Support SunOS/x86_64.
--- js/src/gc/Memory.cpp.orig 2018-06-05 19:47:29.000000000 +0000
+++ js/src/gc/Memory.cpp
@@ -504,6 +504,7 @@ MapMemoryAt(void* desired, size_t length
{
#if defined(__ia64__) || defined(__aarch64__) || \
+ (defined(__sun) && defined(__x86_64__)) || \
(defined(__sparc__) && defined(__arch64__) && (defined(__NetBSD__) || defined(__linux__)))
MOZ_ASSERT((0xffff800000000000ULL & (uintptr_t(desired) + length - 1)) == 0);
#endif
@@ -554,7 +555,7 @@ MapMemory(size_t length, int prot = PROT
return nullptr;
}
return region;
-#elif defined(__aarch64__) || (defined(__sparc__) && defined(__arch64__) && defined(__linux__))
+#elif defined(__aarch64__) || (defined(__sparc__) && defined(__arch64__) && defined(__linux__)) || (defined(__sun) && defined(__x86_64__))
/*
* There might be similar virtual address issue on arm64 which depends on
* hardware and kernel configurations. But the work around is slightly

View file

@ -0,0 +1,15 @@
$NetBSD: patch-js_src_threading_posix_Thread.cpp,v 1.1 2018/06/28 14:04:10 ryoon Exp $
Support SunOS.
--- js/src/threading/posix/Thread.cpp.orig 2018-06-05 19:47:32.000000000 +0000
+++ js/src/threading/posix/Thread.cpp
@@ -194,6 +194,8 @@ js::ThisThread::SetName(const char* name
rv = 0;
#elif defined(__NetBSD__)
rv = pthread_setname_np(pthread_self(), "%s", (void*)name);
+#elif defined(__sun)
+ rv = 0;
#else
rv = pthread_setname_np(pthread_self(), name);
#endif

View file

@ -0,0 +1,23 @@
$NetBSD: patch-js_src_util_NativeStack.cpp,v 1.1 2018/06/28 14:04:10 ryoon Exp $
Support SunOS.
--- js/src/util/NativeStack.cpp.orig 2018-06-05 19:47:32.000000000 +0000
+++ js/src/util/NativeStack.cpp
@@ -32,7 +32,7 @@ js::GetNativeStackBaseImpl()
return static_cast<void*>(pTib->StackBase);
}
-#elif defined(SOLARIS)
+#elif defined(__sun)
#include <ucontext.h>
@@ -78,6 +78,7 @@ js::GetNativeStackBaseImpl()
# elif defined(PTHREAD_NP_H) || defined(_PTHREAD_NP_H_) || defined(NETBSD)
/* e.g. on FreeBSD 4.8 or newer, neundorf@kde.org */
pthread_attr_get_np(thread, &sattr);
+# elif defined(__sun)
# else
/*
* FIXME: this function is non-portable;

View file

@ -0,0 +1,14 @@
$NetBSD: patch-js_src_wasm_WasmSignalHandlers.cpp,v 1.1 2018/06/28 14:04:10 ryoon Exp $
Support SunOS.
--- js/src/wasm/WasmSignalHandlers.cpp.orig 2018-06-05 19:47:32.000000000 +0000
+++ js/src/wasm/WasmSignalHandlers.cpp
@@ -135,6 +135,7 @@ struct AutoSignalHandler
# define EBP_sig(p) ((p)->uc_mcontext.gregs[REG_EBP])
# define ESP_sig(p) ((p)->uc_mcontext.gregs[REG_ESP])
# else
+# include <sys/regset.h>
# define XMM_sig(p,i) ((p)->uc_mcontext.fpregs.fp_reg_set.fpchip_state.xmm[i])
# define EIP_sig(p) ((p)->uc_mcontext.gregs[REG_PC])
# define EBP_sig(p) ((p)->uc_mcontext.gregs[REG_EBP])

View file

@ -0,0 +1,12 @@
$NetBSD: patch-media_libcubeb_gtest_moz.build,v 1.1 2018/06/28 14:04:10 ryoon Exp $
--- media/libcubeb/gtest/moz.build.orig 2018-03-10 02:54:17.000000000 +0000
+++ media/libcubeb/gtest/moz.build
@@ -72,7 +72,6 @@ elif CONFIG['OS_TARGET'] == 'OpenBSD':
'sndio',
]
else:
- OS_LIBS += CONFIG['MOZ_ALSA_LIBS']
OS_LIBS += CONFIG['MOZ_PULSEAUDIO_LIBS']
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):

View file

@ -0,0 +1,37 @@
$NetBSD: patch-media_libcubeb_src_cubeb.c,v 1.1 2018/06/28 14:04:10 ryoon Exp $
* Support OSS audio
--- media/libcubeb/src/cubeb.c.orig 2017-07-31 16:20:49.000000000 +0000
+++ media/libcubeb/src/cubeb.c
@@ -55,6 +55,9 @@ int audiotrack_init(cubeb ** context, ch
#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
#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 */
}
@@ -199,6 +206,9 @@ cubeb_init(cubeb ** context, char const
#if defined(USE_KAI)
kai_init,
#endif
+#if defined(USE_OSS)
+ oss_init,
+#endif
};
int i;

View file

@ -0,0 +1,567 @@
$NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.1 2018/06/28 14:04:10 ryoon Exp $
* Support alsa audio under NetBSD
* Avoid https://github.com/kinetiknz/cubeb/issues/226
--- media/libcubeb/src/cubeb_alsa.c.orig 2018-05-03 16:58:30.000000000 +0000
+++ media/libcubeb/src/cubeb_alsa.c
@@ -7,11 +7,13 @@
#undef NDEBUG
#define _DEFAULT_SOURCE
#define _BSD_SOURCE
+#define _NETBSD_SOURCE
#define _XOPEN_SOURCE 500
#include <pthread.h>
#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 +27,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 +113,8 @@ struct cubeb {
workaround is not required. */
snd_config_t * local_config;
int is_pa;
+
+ void * libasound;
};
enum stream_state {
@@ -245,8 +295,8 @@ set_timeout(struct timeval * timeout, un
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;
}
@@ -278,9 +328,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) {
@@ -303,7 +353,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
@@ -347,7 +397,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) {
@@ -374,8 +424,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 */
@@ -402,7 +452,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 {
@@ -415,13 +465,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);
}
}
@@ -537,26 +587,26 @@ get_slave_pcm_node(snd_config_t * lconf,
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;
}
@@ -565,7 +615,7 @@ get_slave_pcm_node(snd_config_t * lconf,
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;
}
@@ -574,7 +624,7 @@ get_slave_pcm_node(snd_config_t * lconf,
} while (0);
if (slave_def) {
- snd_config_delete(slave_def);
+ WRAP(snd_config_delete)(slave_def);
}
return NULL;
@@ -597,22 +647,22 @@ init_local_config_with_workaround(char c
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;
}
@@ -621,7 +671,7 @@ init_local_config_with_workaround(char c
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;
}
@@ -632,12 +682,12 @@ init_local_config_with_workaround(char c
}
/* 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;
}
@@ -648,18 +698,18 @@ init_local_config_with_workaround(char c
/* 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;
}
@@ -667,7 +717,7 @@ init_local_config_with_workaround(char c
return lconf;
} while (0);
- snd_config_delete(lconf);
+ WRAP(snd_config_delete)(lconf);
return NULL;
}
@@ -679,9 +729,9 @@ alsa_locked_pcm_open(snd_pcm_t ** pcm, c
pthread_mutex_lock(&cubeb_alsa_mutex);
if (local_config) {
- r = snd_pcm_open_lconf(pcm, pcm_name, stream, SND_PCM_NONBLOCK, local_config);
+ r = WRAP(snd_pcm_open_lconf)(pcm, pcm_name, stream, SND_PCM_NONBLOCK, local_config);
} else {
- r = snd_pcm_open(pcm, pcm_name, stream, SND_PCM_NONBLOCK);
+ r = WRAP(snd_pcm_open)(pcm, pcm_name, stream, SND_PCM_NONBLOCK);
}
pthread_mutex_unlock(&cubeb_alsa_mutex);
@@ -694,7 +744,7 @@ alsa_locked_pcm_close(snd_pcm_t * pcm)
int r;
pthread_mutex_lock(&cubeb_alsa_mutex);
- r = snd_pcm_close(pcm);
+ r = WRAP(snd_pcm_close)(pcm);
pthread_mutex_unlock(&cubeb_alsa_mutex);
return r;
@@ -757,12 +807,65 @@ alsa_init(cubeb ** context, char const *
pthread_attr_t attr;
snd_pcm_t * dummy;
+ void * libasound = NULL;
+
+#ifndef DISABLE_LIBASOUND_DLOPEN
+ libasound = dlopen("libasound.so", RTLD_LAZY);
+ if (!libasound) {
+ return CUBEB_ERROR;
+ }
+
+#define LOAD(x) do { \
+ cubeb_##x = dlsym(libasound, #x); \
+ if (!cubeb_##x) { \
+ dlclose(libasound); \
+ return CUBEB_ERROR; \
+ } \
+ } while(0)
+
+ LOAD(snd_config);
+ LOAD(snd_config_add);
+ LOAD(snd_config_copy);
+ LOAD(snd_config_delete);
+ LOAD(snd_config_get_id);
+ LOAD(snd_config_get_string);
+ LOAD(snd_config_imake_integer);
+ LOAD(snd_config_search);
+ LOAD(snd_config_search_definition);
+ LOAD(snd_lib_error_set_handler);
+ LOAD(snd_pcm_avail_update);
+ LOAD(snd_pcm_close);
+ LOAD(snd_pcm_delay);
+ LOAD(snd_pcm_drain);
+ LOAD(snd_pcm_frames_to_bytes);
+ LOAD(snd_pcm_get_params);
+ /* snd_pcm_hw_params_alloca is actually a macro */
+ /* LOAD(snd_pcm_hw_params_alloca); */
+ LOAD(snd_pcm_hw_params_sizeof);
+ LOAD(snd_pcm_hw_params_any);
+ LOAD(snd_pcm_hw_params_get_channels_max);
+ LOAD(snd_pcm_hw_params_get_rate);
+ LOAD(snd_pcm_hw_params_set_rate_near);
+ LOAD(snd_pcm_nonblock);
+ LOAD(snd_pcm_open);
+ LOAD(snd_pcm_open_lconf);
+ LOAD(snd_pcm_pause);
+ LOAD(snd_pcm_poll_descriptors);
+ LOAD(snd_pcm_poll_descriptors_count);
+ LOAD(snd_pcm_poll_descriptors_revents);
+ LOAD(snd_pcm_recover);
+ LOAD(snd_pcm_set_params);
+ LOAD(snd_pcm_state);
+ LOAD(snd_pcm_writei);
+
+#undef LOAD
+#endif
assert(context);
*context = NULL;
pthread_mutex_lock(&cubeb_alsa_mutex);
if (!cubeb_alsa_error_handler_set) {
- snd_lib_error_set_handler(silent_error_handler);
+ WRAP(snd_lib_error_set_handler)(silent_error_handler);
cubeb_alsa_error_handler_set = 1;
}
pthread_mutex_unlock(&cubeb_alsa_mutex);
@@ -770,6 +873,8 @@ alsa_init(cubeb ** context, char const *
ctx = calloc(1, sizeof(*ctx));
assert(ctx);
+ ctx->libasound = libasound;
+
ctx->ops = &alsa_ops;
r = pthread_mutex_init(&ctx->mutex, NULL);
@@ -819,7 +924,7 @@ alsa_init(cubeb ** context, char const *
config fails with EINVAL, the PA PCM is too old for this workaround. */
if (r == -EINVAL) {
pthread_mutex_lock(&cubeb_alsa_mutex);
- snd_config_delete(ctx->local_config);
+ WRAP(snd_config_delete)(ctx->local_config);
pthread_mutex_unlock(&cubeb_alsa_mutex);
ctx->local_config = NULL;
} else if (r >= 0) {
@@ -859,9 +964,13 @@ alsa_destroy(cubeb * ctx)
pthread_mutex_destroy(&ctx->mutex);
free(ctx->fds);
+ if (ctx->libasound) {
+ dlclose(ctx->libasound);
+ }
+
if (ctx->local_config) {
pthread_mutex_lock(&cubeb_alsa_mutex);
- snd_config_delete(ctx->local_config);
+ WRAP(snd_config_delete)(ctx->local_config);
pthread_mutex_unlock(&cubeb_alsa_mutex);
}
@@ -948,7 +1057,7 @@ alsa_stream_init_single(cubeb * ctx, cub
return CUBEB_ERROR;
}
- r = snd_pcm_nonblock(stm->pcm, 1);
+ r = WRAP(snd_pcm_nonblock)(stm->pcm, 1);
assert(r == 0);
latency_us = latency_frames * 1e6 / stm->params.rate;
@@ -961,7 +1070,7 @@ alsa_stream_init_single(cubeb * ctx, cub
latency_us = latency_us < min_latency ? min_latency: latency_us;
}
- r = snd_pcm_set_params(stm->pcm, format, SND_PCM_ACCESS_RW_INTERLEAVED,
+ r = WRAP(snd_pcm_set_params)(stm->pcm, format, SND_PCM_ACCESS_RW_INTERLEAVED,
stm->params.channels, stm->params.rate, 1,
latency_us);
if (r < 0) {
@@ -969,20 +1078,20 @@ alsa_stream_init_single(cubeb * ctx, cub
return CUBEB_ERROR_INVALID_FORMAT;
}
- r = snd_pcm_get_params(stm->pcm, &stm->buffer_size, &period_size);
+ r = WRAP(snd_pcm_get_params)(stm->pcm, &stm->buffer_size, &period_size);
assert(r == 0);
/* Double internal buffer size to have enough space when waiting for the other side of duplex connection */
stm->buffer_size *= 2;
- stm->buffer = calloc(1, snd_pcm_frames_to_bytes(stm->pcm, stm->buffer_size));
+ stm->buffer = calloc(1, WRAP(snd_pcm_frames_to_bytes)(stm->pcm, stm->buffer_size));
assert(stm->buffer);
- stm->nfds = snd_pcm_poll_descriptors_count(stm->pcm);
+ stm->nfds = WRAP(snd_pcm_poll_descriptors_count)(stm->pcm);
assert(stm->nfds > 0);
stm->saved_fds = calloc(stm->nfds, sizeof(struct pollfd));
assert(stm->saved_fds);
- r = snd_pcm_poll_descriptors(stm->pcm, stm->saved_fds, stm->nfds);
+ r = WRAP(snd_pcm_poll_descriptors)(stm->pcm, stm->saved_fds, stm->nfds);
assert((nfds_t) r == stm->nfds);
if (alsa_register_stream(ctx, stm) != 0) {
@@ -1054,7 +1163,7 @@ alsa_stream_destroy(cubeb_stream * stm)
pthread_mutex_lock(&stm->mutex);
if (stm->pcm) {
if (stm->state == DRAINING) {
- snd_pcm_drain(stm->pcm);
+ WRAP(snd_pcm_drain)(stm->pcm);
}
alsa_locked_pcm_close(stm->pcm);
stm->pcm = NULL;
@@ -1100,12 +1209,12 @@ alsa_get_max_channel_count(cubeb * ctx,
assert(stm);
- r = snd_pcm_hw_params_any(stm->pcm, hw_params);
+ r = WRAP(snd_pcm_hw_params_any)(stm->pcm, hw_params);
if (r < 0) {
return CUBEB_ERROR;
}
- r = snd_pcm_hw_params_get_channels_max(hw_params, max_channels);
+ r = WRAP(snd_pcm_hw_params_get_channels_max)(hw_params, max_channels);
if (r < 0) {
return CUBEB_ERROR;
}
@@ -1126,34 +1235,34 @@ alsa_get_preferred_sample_rate(cubeb * c
/* get a pcm, disabling resampling, so we get a rate the
* hardware/dmix/pulse/etc. supports. */
- r = snd_pcm_open(&pcm, CUBEB_ALSA_PCM_NAME, SND_PCM_STREAM_PLAYBACK, SND_PCM_NO_AUTO_RESAMPLE);
+ r = WRAP(snd_pcm_open)(&pcm, CUBEB_ALSA_PCM_NAME, SND_PCM_STREAM_PLAYBACK, SND_PCM_NO_AUTO_RESAMPLE);
if (r < 0) {
return CUBEB_ERROR;
}
- r = snd_pcm_hw_params_any(pcm, hw_params);
+ r = WRAP(snd_pcm_hw_params_any)(pcm, hw_params);
if (r < 0) {
- snd_pcm_close(pcm);
+ WRAP(snd_pcm_close)(pcm);
return CUBEB_ERROR;
}
- r = snd_pcm_hw_params_get_rate(hw_params, rate, &dir);
+ r = WRAP(snd_pcm_hw_params_get_rate)(hw_params, rate, &dir);
if (r >= 0) {
/* There is a default rate: use it. */
- snd_pcm_close(pcm);
+ WRAP(snd_pcm_close)(pcm);
return CUBEB_OK;
}
/* Use a common rate, alsa may adjust it based on hw/etc. capabilities. */
*rate = 44100;
- r = snd_pcm_hw_params_set_rate_near(pcm, hw_params, rate, NULL);
+ r = WRAP(snd_pcm_hw_params_set_rate_near)(pcm, hw_params, rate, NULL);
if (r < 0) {
- snd_pcm_close(pcm);
+ WRAP(snd_pcm_close)(pcm);
return CUBEB_ERROR;
}
- snd_pcm_close(pcm);
+ WRAP(snd_pcm_close)(pcm);
return CUBEB_OK;
}
@@ -1186,10 +1295,10 @@ alsa_stream_start(cubeb_stream * stm)
pthread_mutex_lock(&stm->mutex);
/* Capture pcm must be started after initial setup/recover */
if (stm->stream_type == SND_PCM_STREAM_CAPTURE &&
- snd_pcm_state(stm->pcm) == SND_PCM_STATE_PREPARED) {
- snd_pcm_start(stm->pcm);
+ WRAP(snd_pcm_state)(stm->pcm) == SND_PCM_STATE_PREPARED) {
+ WRAP(snd_pcm_start)(stm->pcm);
}
- snd_pcm_pause(stm->pcm, 0);
+ WRAP(snd_pcm_pause)(stm->pcm, 0);
gettimeofday(&stm->last_activity, NULL);
pthread_mutex_unlock(&stm->mutex);
@@ -1229,7 +1338,7 @@ alsa_stream_stop(cubeb_stream * stm)
pthread_mutex_unlock(&ctx->mutex);
pthread_mutex_lock(&stm->mutex);
- snd_pcm_pause(stm->pcm, 1);
+ WRAP(snd_pcm_pause)(stm->pcm, 1);
pthread_mutex_unlock(&stm->mutex);
return CUBEB_OK;
@@ -1245,8 +1354,8 @@ alsa_stream_get_position(cubeb_stream *
pthread_mutex_lock(&stm->mutex);
delay = -1;
- if (snd_pcm_state(stm->pcm) != SND_PCM_STATE_RUNNING ||
- snd_pcm_delay(stm->pcm, &delay) != 0) {
+ if (WRAP(snd_pcm_state)(stm->pcm) != SND_PCM_STATE_RUNNING ||
+ WRAP(snd_pcm_delay)(stm->pcm, &delay) != 0) {
*position = stm->last_position;
pthread_mutex_unlock(&stm->mutex);
return CUBEB_OK;
@@ -1271,7 +1380,7 @@ alsa_stream_get_latency(cubeb_stream * s
snd_pcm_sframes_t delay;
/* This function returns the delay in frames until a frame written using
snd_pcm_writei is sent to the DAC. The DAC delay should be < 1ms anyways. */
- if (snd_pcm_delay(stm->pcm, &delay)) {
+ if (WRAP(snd_pcm_delay)(stm->pcm, &delay)) {
return CUBEB_ERROR;
}

View file

@ -0,0 +1,461 @@
$NetBSD: patch-media_libcubeb_src_cubeb__oss.c,v 1.1 2018/06/28 14:04:10 ryoon Exp $
* Restore OSS audio support code
--- media/libcubeb/src/cubeb_oss.c.orig 2018-05-09 10:25:44.118207555 +0000
+++ media/libcubeb/src/cubeb_oss.c
@@ -0,0 +1,454 @@
+/*
+ * Copyright © 2014 Mozilla Foundation
+ *
+ * This program is made available under an ISC-style license. See the
+ * accompanying file LICENSE for details.
+ */
+#if defined(HAVE_SYS_SOUNDCARD_H)
+#include <sys/soundcard.h>
+#else
+#include <soundcard.h>
+#endif
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <assert.h>
+
+#include "cubeb/cubeb.h"
+#include "cubeb-internal.h"
+
+#ifndef CUBEB_OSS_DEFAULT_OUTPUT
+#define CUBEB_OSS_DEFAULT_OUTPUT "/dev/dsp"
+#endif
+
+#define OSS_BUFFER_SIZE 1024
+
+struct cubeb {
+ struct cubeb_ops const * ops;
+};
+
+struct cubeb_stream {
+ /* Note: Must match cubeb_stream layout in cubeb.c. */
+ cubeb * context;
+ void * user_ptr;
+ /**/
+
+ cubeb_data_callback data_callback;
+ cubeb_state_callback state_callback;
+ float volume;
+ float panning;
+
+ pthread_mutex_t state_mutex;
+ pthread_cond_t state_cond;
+
+ int running;
+ int stopped;
+ int floating;
+
+ /* These two vars are needed to support old versions of OSS */
+ unsigned int position_bytes;
+ unsigned int last_position_bytes;
+
+ uint64_t written_frags; /* The number of fragments written to /dev/dsp */
+ uint64_t missed_frags; /* fragments output with stopped stream */
+
+ cubeb_stream_params params;
+ int fd;
+ pthread_t th;
+};
+
+static struct cubeb_ops const oss_ops;
+
+int oss_init(cubeb ** context, char const * context_name)
+{
+ cubeb* ctx = (cubeb*)malloc(sizeof(cubeb));
+ ctx->ops = &oss_ops;
+ *context = ctx;
+ return CUBEB_OK;
+}
+
+static void oss_destroy(cubeb *ctx)
+{
+ free(ctx);
+}
+
+static char const * oss_get_backend_id(cubeb * context)
+{
+ static char oss_name[] = "oss";
+ return oss_name;
+}
+
+static int oss_get_max_channel_count(cubeb * ctx, uint32_t * max_channels)
+{
+ *max_channels = 2; /* Let's support only stereo for now */
+ return CUBEB_OK;
+}
+
+static int oss_get_min_latency(cubeb * context, cubeb_stream_params params,
+ uint32_t * latency_frames)
+{
+ (void)context;
+ /* 40ms is a big enough number to work ok */
+ *latency_frames = 40 * params.rate / 1000;
+ return CUBEB_OK;
+}
+
+static int oss_get_preferred_sample_rate(cubeb *context, uint32_t * rate)
+{
+ /* 48000 seems a prefered choice for most audio devices
+ * and a good choice for OSS */
+ *rate = 48000;
+ return CUBEB_OK;
+}
+
+static void run_state_callback(cubeb_stream *stream, cubeb_state state)
+{
+ if (stream->state_callback) {
+ stream->state_callback(stream, stream->user_ptr, state);
+ }
+}
+
+static long run_data_callback(cubeb_stream *stream, void *buffer, long nframes)
+{
+ long got = 0;
+ pthread_mutex_lock(&stream->state_mutex);
+ if (stream->data_callback && stream->running && !stream->stopped) {
+ pthread_mutex_unlock(&stream->state_mutex);
+ got = stream->data_callback(stream, stream->user_ptr, NULL, buffer, nframes);
+ } else {
+ pthread_mutex_unlock(&stream->state_mutex);
+ }
+ return got;
+}
+
+static void apply_volume_int(int16_t* buffer, unsigned int n,
+ float volume, float panning)
+{
+ float left = volume;
+ float right = volume;
+ unsigned int i;
+ int pan[2];
+ if (panning<0) {
+ right *= (1+panning);
+ } else {
+ left *= (1-panning);
+ }
+ pan[0] = 128.0*left;
+ pan[1] = 128.0*right;
+ for(i=0; i<n; i++){
+ buffer[i] = ((int)buffer[i])*pan[i%2]/128;
+ }
+}
+
+static void apply_volume_float(float* buffer, unsigned int n,
+ float volume, float panning)
+{
+ float left = volume;
+ float right = volume;
+ unsigned int i;
+ float pan[2];
+ if (panning<0) {
+ right *= (1+panning);
+ } else {
+ left *= (1-panning);
+ }
+ pan[0] = left;
+ pan[1] = right;
+ for(i=0; i<n; i++){
+ buffer[i] = buffer[i]*pan[i%2];
+ }
+}
+
+
+static void *writer(void *stm)
+{
+ cubeb_stream* stream = (cubeb_stream*)stm;
+ int16_t buffer[OSS_BUFFER_SIZE];
+ float f_buffer[OSS_BUFFER_SIZE];
+ int got;
+ unsigned long i;
+ while (stream->running) {
+ pthread_mutex_lock(&stream->state_mutex);
+ if (stream->stopped) {
+ pthread_mutex_unlock(&stream->state_mutex);
+ run_state_callback(stream, CUBEB_STATE_STOPPED);
+ pthread_mutex_lock(&stream->state_mutex);
+ while (stream->stopped) {
+ pthread_cond_wait(&stream->state_cond, &stream->state_mutex);
+ }
+ pthread_mutex_unlock(&stream->state_mutex);
+ run_state_callback(stream, CUBEB_STATE_STARTED);
+ continue;
+ }
+ pthread_mutex_unlock(&stream->state_mutex);
+ if (stream->floating) {
+ got = run_data_callback(stream, f_buffer,
+ OSS_BUFFER_SIZE/stream->params.channels);
+ apply_volume_float(f_buffer, got*stream->params.channels,
+ stream->volume, stream->panning);
+ for (i=0; i<((unsigned long)got)*stream->params.channels; i++) {
+ /* Clipping is prefered to overflow */
+ if(f_buffer[i]>=1.0){
+ f_buffer[i]=1.0;
+ }
+ if(f_buffer[i]<=-1.0){
+ f_buffer[i]=-1.0;
+ }
+ /* One might think that multipling by 32767.0 is logical but results in clipping */
+ buffer[i] = f_buffer[i]*32767.0;
+ }
+ } else {
+ got = run_data_callback(stream, buffer,
+ OSS_BUFFER_SIZE/stream->params.channels);
+ apply_volume_int(buffer, got*stream->params.channels,
+ stream->volume, stream->panning);
+ }
+ if (got<0) {
+ run_state_callback(stream, CUBEB_STATE_ERROR);
+ break;
+ }
+ if (!got) {
+ run_state_callback(stream, CUBEB_STATE_DRAINED);
+ }
+ if (got) {
+ size_t i = 0;
+ size_t s = got*stream->params.channels*sizeof(int16_t);
+ while (i < s) {
+ ssize_t n = write(stream->fd, ((char*)buffer) + i, s - i);
+ if (n<=0) {
+ run_state_callback(stream, CUBEB_STATE_ERROR);
+ break;
+ }
+ i+=n;
+ }
+ stream->written_frags+=got;
+ }
+ }
+ return NULL;
+}
+
+static void oss_try_set_latency(cubeb_stream* stream, unsigned int latency)
+{
+ unsigned int latency_bytes, n_frag;
+ int frag;
+ /* fragment size of 1024 is a good choice with good chances to be accepted */
+ unsigned int frag_log=10; /* 2^frag_log = fragment size */
+ latency_bytes =
+ latency*stream->params.rate*stream->params.channels*sizeof(uint16_t)/1000;
+ n_frag = latency_bytes>>frag_log;
+ frag = (n_frag<<16) | frag_log;
+ /* Even if this fails we wish to continue, not checking for errors */
+ ioctl(stream->fd, SNDCTL_DSP_SETFRAGMENT, &frag);
+}
+
+static int oss_stream_init(cubeb * context, cubeb_stream ** stm,
+ char const * stream_name,
+ cubeb_devid input_device,
+ cubeb_stream_params * input_stream_params,
+ cubeb_devid output_device,
+ cubeb_stream_params * output_stream_params,
+ unsigned int latency,
+ cubeb_data_callback data_callback,
+ cubeb_state_callback state_callback, void * user_ptr)
+{
+ cubeb_stream* stream = (cubeb_stream*)malloc(sizeof(cubeb_stream));
+ stream->context = context;
+ stream->data_callback = data_callback;
+ stream->state_callback = state_callback;
+ stream->user_ptr = user_ptr;
+
+ assert(!input_stream_params && "not supported.");
+ if (input_device || output_device) {
+ /* Device selection not yet implemented. */
+ return CUBEB_ERROR_DEVICE_UNAVAILABLE;
+ }
+
+ if ((input_stream_params && input_stream_params->prefs & CUBEB_STREAM_PREF_LOOPBACK) ||
+ (output_stream_params && output_stream_params->prefs & CUBEB_STREAM_PREF_LOOPBACK)) {
+ return CUBEB_ERROR_NOT_SUPPORTED;
+ }
+
+ if ((stream->fd = open(CUBEB_OSS_DEFAULT_OUTPUT, O_WRONLY)) == -1) {
+ free(stream);
+ return CUBEB_ERROR;
+ }
+#define SET(what, to) do { unsigned int i = to; \
+ int j = ioctl(stream->fd, what, &i); \
+ if (j == -1 || i != to) { \
+ close(stream->fd); \
+ free(stream); \
+ return CUBEB_ERROR_INVALID_FORMAT; } } while (0)
+
+ stream->params = *output_stream_params;
+ stream->volume = 1.0;
+ stream->panning = 0.0;
+
+ oss_try_set_latency(stream, latency);
+
+ stream->floating = 0;
+ SET(SNDCTL_DSP_CHANNELS, stream->params.channels);
+ SET(SNDCTL_DSP_SPEED, stream->params.rate);
+ switch (stream->params.format) {
+ case CUBEB_SAMPLE_S16LE:
+ SET(SNDCTL_DSP_SETFMT, AFMT_S16_LE);
+ break;
+ case CUBEB_SAMPLE_S16BE:
+ SET(SNDCTL_DSP_SETFMT, AFMT_S16_BE);
+ break;
+ case CUBEB_SAMPLE_FLOAT32LE:
+ SET(SNDCTL_DSP_SETFMT, AFMT_S16_NE);
+ stream->floating = 1;
+ break;
+ default:
+ close(stream->fd);
+ free(stream);
+ return CUBEB_ERROR;
+ }
+
+
+ pthread_mutex_init(&stream->state_mutex, NULL);
+ pthread_cond_init(&stream->state_cond, NULL);
+
+ stream->running = 1;
+ stream->stopped = 1;
+ stream->position_bytes = 0;
+ stream->last_position_bytes = 0;
+ stream->written_frags = 0;
+ stream->missed_frags = 0;
+
+ pthread_create(&stream->th, NULL, writer, (void*)stream);
+
+ *stm = stream;
+
+ return CUBEB_OK;
+}
+
+static void oss_stream_destroy(cubeb_stream * stream)
+{
+ pthread_mutex_lock(&stream->state_mutex);
+
+ stream->running = 0;
+ stream->stopped = 0;
+ pthread_cond_signal(&stream->state_cond);
+
+ pthread_mutex_unlock(&stream->state_mutex);
+
+ pthread_join(stream->th, NULL);
+
+ pthread_mutex_destroy(&stream->state_mutex);
+ pthread_cond_destroy(&stream->state_cond);
+ close(stream->fd);
+ free(stream);
+}
+
+static int oss_stream_get_latency(cubeb_stream * stream, uint32_t * latency)
+{
+ if (ioctl(stream->fd, SNDCTL_DSP_GETODELAY, latency)==-1) {
+ return CUBEB_ERROR;
+ }
+ /* Convert latency from bytes to frames */
+ *latency /= stream->params.channels*sizeof(int16_t);
+ return CUBEB_OK;
+}
+
+
+static int oss_stream_current_optr(cubeb_stream * stream, uint64_t * position)
+{
+ count_info ci;
+ /* Unfortunately, this ioctl is only available in OSS 4.x */
+#ifdef SNDCTL_DSP_CURRENT_OPTR
+ oss_count_t count;
+ if (ioctl(stream->fd, SNDCTL_DSP_CURRENT_OPTR, &count) != -1) {
+ *position = count.samples;// + count.fifo_samples;
+ return CUBEB_OK;
+ }
+#endif
+ /* Fall back to this ioctl in case the previous one fails */
+ if (ioctl(stream->fd, SNDCTL_DSP_GETOPTR, &ci) == -1) {
+ return CUBEB_ERROR;
+ }
+ /* ci.bytes is only 32 bit and will start to wrap after arithmetic overflow */
+ stream->position_bytes += ci.bytes - stream->last_position_bytes;
+ stream->last_position_bytes = ci.bytes;
+ *position = stream->position_bytes/stream->params.channels/sizeof(int16_t);
+ return CUBEB_OK;
+}
+
+static int oss_stream_get_position(cubeb_stream * stream, uint64_t * position)
+{
+ if ( oss_stream_current_optr(stream, position) == CUBEB_OK ){
+ *position -= stream->missed_frags;
+ return CUBEB_OK;
+ }
+ /* If no correct method to get position works we resort to this */
+ *position = stream->written_frags;
+ return CUBEB_OK;
+}
+
+
+static int oss_stream_start(cubeb_stream * stream)
+{
+ pthread_mutex_lock(&stream->state_mutex);
+ if (stream->stopped) {
+ uint64_t ptr;
+ oss_stream_current_optr(stream, &ptr);
+ stream->missed_frags = ptr - stream->written_frags;
+ stream->stopped = 0;
+ pthread_cond_signal(&stream->state_cond);
+ }
+ pthread_mutex_unlock(&stream->state_mutex);
+ return CUBEB_OK;
+}
+
+static int oss_stream_stop(cubeb_stream * stream)
+{
+ pthread_mutex_lock(&stream->state_mutex);
+ stream->stopped = 1;
+ pthread_mutex_unlock(&stream->state_mutex);
+ return CUBEB_OK;
+}
+
+int oss_stream_set_panning(cubeb_stream * stream, float panning)
+{
+ if (stream->params.channels == 2) {
+ stream->panning=panning;
+ }
+ return CUBEB_OK;
+}
+
+int oss_stream_set_volume(cubeb_stream * stream, float volume)
+{
+ stream->volume=volume;
+ return CUBEB_OK;
+}
+
+static struct cubeb_ops const oss_ops = {
+ .init = oss_init,
+ .get_backend_id = oss_get_backend_id,
+ .get_max_channel_count = oss_get_max_channel_count,
+ .get_min_latency = oss_get_min_latency,
+ .get_preferred_sample_rate = oss_get_preferred_sample_rate,
+ .get_preferred_channel_layout = NULL,
+ .enumerate_devices = NULL,
+ .device_collection_destroy = NULL,
+ .destroy = oss_destroy,
+ .stream_init = oss_stream_init,
+ .stream_destroy = oss_stream_destroy,
+ .stream_start = oss_stream_start,
+ .stream_stop = oss_stream_stop,
+ .stream_reset_default_device = NULL,
+ .stream_get_position = oss_stream_get_position,
+ .stream_get_latency = oss_stream_get_latency,
+ .stream_set_volume = oss_stream_set_volume,
+ .stream_set_panning = oss_stream_set_panning,
+ .stream_get_current_device = NULL,
+ .stream_device_destroy = NULL,
+ .stream_register_device_changed_callback = NULL,
+ .register_device_collection_changed = NULL
+};

View file

@ -0,0 +1,28 @@
$NetBSD: patch-media_libcubeb_src_moz.build,v 1.1 2018/06/28 14:04:10 ryoon Exp $
* Add OSS audio support
* Support system library
--- media/libcubeb/src/moz.build.orig 2018-05-03 16:58:30.000000000 +0000
+++ media/libcubeb/src/moz.build
@@ -22,6 +22,12 @@ if CONFIG['MOZ_ALSA']:
]
DEFINES['USE_ALSA'] = True
+if CONFIG['MOZ_OSS']:
+ SOURCES += [
+ 'cubeb_oss.c',
+ ]
+ DEFINES['USE_OSS'] = True
+
if CONFIG['MOZ_PULSEAUDIO'] or CONFIG['MOZ_JACK']:
SOURCES += [
'cubeb_resampler.cpp',
@@ -87,6 +93,7 @@ if CONFIG['OS_TARGET'] == 'Android':
FINAL_LIBRARY = 'gkmedias'
CFLAGS += CONFIG['MOZ_ALSA_CFLAGS']
+CFLAGS += CONFIG['MOZ_OSS_CFLAGS']
CFLAGS += CONFIG['MOZ_PULSEAUDIO_CFLAGS']
# We allow warnings for third-party code that can be updated from upstream.

View file

@ -0,0 +1,12 @@
$NetBSD: patch-media_libcubeb_update.sh,v 1.1 2018/06/28 14:04:10 ryoon Exp $
--- media/libcubeb/update.sh.orig 2018-05-03 16:58:30.000000000 +0000
+++ media/libcubeb/update.sh
@@ -20,6 +20,7 @@ cp $1/src/cubeb_log.h src
cp $1/src/cubeb_mixer.cpp src
cp $1/src/cubeb_mixer.h src
cp $1/src/cubeb_opensl.c src
+cp $1/src/cubeb_oss.c src
cp $1/src/cubeb-jni.cpp src
cp $1/src/cubeb-jni.h src
cp $1/src/android/cubeb-output-latency.h src/android

View file

@ -0,0 +1,17 @@
$NetBSD: patch-media_libpng_pngpriv.h,v 1.1 2018/06/28 14:04:10 ryoon Exp $
Fix _POSIX_SOURCE on SunOS.
--- media/libpng/pngpriv.h.orig 2018-06-05 19:47:32.000000000 +0000
+++ media/libpng/pngpriv.h
@@ -36,8 +36,10 @@
* still required (as of 2011-05-02.)
*/
#ifndef _POSIX_SOURCE
+#if !defined(__sun) || (__STDC_VERSION__-0 < 199901L)
# define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
#endif
+#endif
#ifndef PNG_VERSION_INFO_ONLY
/* Standard library headers not required by png.h: */

View file

@ -0,0 +1,13 @@
$NetBSD: patch-media_libyuv_libyuv_source_mjpeg__decoder.cc,v 1.1 2018/06/28 14:04:10 ryoon Exp $
--- media/libyuv/libyuv/source/mjpeg_decoder.cc.orig 2017-06-05 20:45:14.000000000 +0000
+++ media/libyuv/libyuv/source/mjpeg_decoder.cc
@@ -25,7 +25,7 @@
#endif
#endif
-struct FILE; // For jpeglib.h.
+//struct FILE; // For jpeglib.h.
// C++ build requires extern C for jpeg internals.
#ifdef __cplusplus

View file

@ -0,0 +1,17 @@
$NetBSD: patch-media_webrtc_trunk_webrtc_modules_audio__device_linux_audio__device__alsa__linux.cc,v 1.1 2018/06/28 14:04:10 ryoon Exp $
* If ESTRPIPE is not defined, use EPIPE instead. For example under NetBSD.
--- media/webrtc/trunk/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc.orig 2018-03-10 02:54:17.000000000 +0000
+++ media/webrtc/trunk/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc
@@ -60,6 +60,10 @@ static const unsigned int ALSA_CAPTURE_W
#define FUNC_GET_DEVICE_NAME 1
#define FUNC_GET_DEVICE_NAME_FOR_AN_ENUM 2
+#if !defined(ESTRPIPE)
+#define ESTRPIPE EPIPE
+#endif
+
AudioDeviceLinuxALSA::AudioDeviceLinuxALSA(const int32_t id) :
_ptrAudioBuffer(NULL),
_critSect(*CriticalSectionWrapper::CreateCriticalSection()),

View file

@ -0,0 +1,42 @@
$NetBSD: patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc,v 1.1 2018/06/28 14:04:10 ryoon Exp $
--- media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc.orig 2017-09-14 20:16:07.000000000 +0000
+++ media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc
@@ -25,6 +25,9 @@
#else
#include <linux/videodev2.h>
#endif
+#ifdef HAVE_LIBV4L2
+#include <libv4l2.h>
+#endif
#include "webrtc/system_wrappers/include/trace.h"
@@ -33,6 +36,15 @@
#define BUF_LEN ( 1024 * ( EVENT_SIZE + 16 ) )
#endif
+#ifdef HAVE_LIBV4L2
+#define open v4l2_open
+#define close v4l2_close
+#define dup v4l2_dup
+#define ioctl v4l2_ioctl
+#define mmap v4l2_mmap
+#define munmap v4l2_munmap
+#endif
+
namespace webrtc
{
namespace videocapturemodule
@@ -314,6 +326,11 @@ int32_t DeviceInfoLinux::GetDeviceName(
memset(deviceNameUTF8, 0, deviceNameLength);
memcpy(cameraName, cap.card, sizeof(cap.card));
+ if (cameraName[0] == '\0')
+ {
+ sprintf(cameraName, "Camera at /dev/video%d", deviceNumber);
+ }
+
if (deviceNameLength >= strlen(cameraName))
{
memcpy(deviceNameUTF8, cameraName, strlen(cameraName));

View file

@ -0,0 +1,30 @@
$NetBSD: patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_video__capture__linux.cc,v 1.1 2018/06/28 14:04:10 ryoon Exp $
--- media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc.orig 2017-09-14 20:16:07.000000000 +0000
+++ media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc
@@ -24,6 +24,9 @@
#else
#include <linux/videodev2.h>
#endif
+#ifdef HAVE_LIBV4L2
+#include <libv4l2.h>
+#endif
#include <new>
@@ -33,6 +36,15 @@
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
#include "webrtc/system_wrappers/include/trace.h"
+#ifdef HAVE_LIBV4L2
+#define open v4l2_open
+#define close v4l2_close
+#define dup v4l2_dup
+#define ioctl v4l2_ioctl
+#define mmap v4l2_mmap
+#define munmap v4l2_munmap
+#endif
+
namespace webrtc {
namespace videocapturemodule {
rtc::scoped_refptr<VideoCaptureModule> VideoCaptureImpl::Create(

View file

@ -0,0 +1,16 @@
$NetBSD: patch-modules_pdfium_update.sh,v 1.1 2018/06/28 14:04:10 ryoon Exp $
--- modules/pdfium/update.sh.orig 2018-03-10 02:54:17.000000000 +0000
+++ modules/pdfium/update.sh
@@ -132,9 +132,9 @@ update_readme() {
perl -p -i -e "s/${PREFIX} [0-9A-Fa-f]+ \(.+\)/${PREFIX} ${COMMIT} (${COMMIT_DATE})/" README_MOZILLA
}
-if [ "$#" == 0 ]; then
+if [ "$#" = 0 ]; then
COMMIT_SELECTOR="master"
-elif [ "$#" == 2 -a "$1" == "--commit" ]; then
+elif [ "$#" = 2 -a "$1" = "--commit" ]; then
COMMIT_SELECTOR="$2"
else
print_help

View file

@ -0,0 +1,15 @@
$NetBSD: patch-servo_components_style_build__gecko.rs,v 1.1 2018/06/28 14:04:10 ryoon Exp $
* Fix build with __uint32_t etc. not found errors on NetBSD/amd64 8.99.2
--- servo/components/style/build_gecko.rs.orig 2017-09-14 20:15:56.000000000 +0000
+++ servo/components/style/build_gecko.rs
@@ -546,6 +546,8 @@ mod bindings {
.borrowed_type(ty)
.zero_size_type(ty, &structs_types);
}
+ builder = builder
+ .raw_line(format!("pub use gecko_bindings::structs::root::*;"));
write_binding_file(builder, BINDINGS_FILE, &fixups);
}

View file

@ -0,0 +1,10 @@
$NetBSD: patch-third__party_rust_libloading_.cargo-checksum.json,v 1.1 2018/06/28 14:04:10 ryoon Exp $
Update checksum for build.rs patch.
--- third_party/rust/libloading/.cargo-checksum.json.orig 2018-06-05 19:47:39.000000000 +0000
+++ third_party/rust/libloading/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{".travis.yml":"3c9d7103068d644d68f5d0f9dd6a9ba00eb86bfb4cfc2c2c14c8a853144fcf09","Cargo.toml":"538efc8b4fd54f900e4706d6904b7696dbf071578d16fe76df1db8c82566635b","LICENSE":"b29f8b01452350c20dd1af16ef83b598fea3053578ccc1c7a0ef40e57be2620f","README.mkd":"34dc610b01f8c3e56d95de1972120ca0d53cee787f636a3ce96526ab343878b5","appveyor.yml":"8382c7f1769f6cf78029a221058c4d73f35a48308b5dfc38d875facabec1c139","build.rs":"dd767f79832741a368fd46a846b7d53cdd05337becad6f7addad71e9618c2769","src/changelog.rs":"b1cbfc5b62c13693e06ca9b3196b359661a0c27d4bdc5eb093554ff86ce34a72","src/lib.rs":"665c5eeecdf77afc0dbe7de4232b2d5f5da5e19a5fd851ac433c89d600b801ee","src/os/mod.rs":"51d733e5522dacd6069642ad66aa6d7acf6c82950c934eb040e8dfd112e6d610","src/os/unix/mod.rs":"1cd2b6f51a34e492b7c88d054f25d89b825037bd81e62a2950ca13720e760061","src/os/windows/mod.rs":"2ed3564e9b88a601cd93b13affb286af7beee165b710279d55c953c74b783310","src/test_helpers.rs":"3a55052e8cd5231e97d9282b43398c2f144c57ced2d2df64bde7f482f5c778e7","src/util.rs":"0b0155448a26db4b00b2a6ca129e0e1f6f75870c56c9777d262941818c7581b7","tests/functions.rs":"dbed3ad32d6a31c8c0df5943f686ca328f020c5d49a9111281458971caa40e62","tests/markers.rs":"8e9c1b883404d9190e4f23ed39b3d6cbbccb3a07883f733b04aed4357b9c6aca","tests/nagisa32.dll":"5c69b2bd9c8a6ad04165c221075fc9fade1dd66ca697399ace528a5a62328e36","tests/nagisa64.dll":"e20b95e3036f3289421abd100760874d4f455afd33c3b5b64fec56b191f7d477","tests/statics.rs":"8fd0955d38cdf3d56d1ece03ad159192702dbc049aa1af146f28fb10f1cf2fcc","tests/windows.rs":"7711dfe19062d91356cd127546542b1b6e13aeef76ad3098f32c8a6ae319b66a"},"package":"be99f814beb3e9503a786a592c909692bb6d4fc5a695f6ed7987223acfbd5194"}
\ No newline at end of file
+{"files":{".travis.yml":"3c9d7103068d644d68f5d0f9dd6a9ba00eb86bfb4cfc2c2c14c8a853144fcf09","Cargo.toml":"538efc8b4fd54f900e4706d6904b7696dbf071578d16fe76df1db8c82566635b","LICENSE":"b29f8b01452350c20dd1af16ef83b598fea3053578ccc1c7a0ef40e57be2620f","README.mkd":"34dc610b01f8c3e56d95de1972120ca0d53cee787f636a3ce96526ab343878b5","appveyor.yml":"8382c7f1769f6cf78029a221058c4d73f35a48308b5dfc38d875facabec1c139","build.rs":"d029e3041872d444ebea63f452d06ecbf8e9bd030bf448a63b138de05275ba49","src/changelog.rs":"b1cbfc5b62c13693e06ca9b3196b359661a0c27d4bdc5eb093554ff86ce34a72","src/lib.rs":"665c5eeecdf77afc0dbe7de4232b2d5f5da5e19a5fd851ac433c89d600b801ee","src/os/mod.rs":"51d733e5522dacd6069642ad66aa6d7acf6c82950c934eb040e8dfd112e6d610","src/os/unix/mod.rs":"1cd2b6f51a34e492b7c88d054f25d89b825037bd81e62a2950ca13720e760061","src/os/windows/mod.rs":"2ed3564e9b88a601cd93b13affb286af7beee165b710279d55c953c74b783310","src/test_helpers.rs":"3a55052e8cd5231e97d9282b43398c2f144c57ced2d2df64bde7f482f5c778e7","src/util.rs":"0b0155448a26db4b00b2a6ca129e0e1f6f75870c56c9777d262941818c7581b7","tests/functions.rs":"dbed3ad32d6a31c8c0df5943f686ca328f020c5d49a9111281458971caa40e62","tests/markers.rs":"8e9c1b883404d9190e4f23ed39b3d6cbbccb3a07883f733b04aed4357b9c6aca","tests/nagisa32.dll":"5c69b2bd9c8a6ad04165c221075fc9fade1dd66ca697399ace528a5a62328e36","tests/nagisa64.dll":"e20b95e3036f3289421abd100760874d4f455afd33c3b5b64fec56b191f7d477","tests/statics.rs":"8fd0955d38cdf3d56d1ece03ad159192702dbc049aa1af146f28fb10f1cf2fcc","tests/windows.rs":"7711dfe19062d91356cd127546542b1b6e13aeef76ad3098f32c8a6ae319b66a"},"package":"be99f814beb3e9503a786a592c909692bb6d4fc5a695f6ed7987223acfbd5194"}

View file

@ -0,0 +1,15 @@
$NetBSD: patch-third__party_rust_libloading_build.rs,v 1.1 2018/06/28 14:04:10 ryoon Exp $
Support SunOS.
--- third_party/rust/libloading/build.rs.orig 2018-06-05 19:47:45.000000000 +0000
+++ third_party/rust/libloading/build.rs
@@ -9,7 +9,7 @@ fn main(){
// netbsd claims dl* will be available to any dynamically linked binary, but I havent
// found any libraries that have to be linked to on other platforms.
// What happens if the executable is not linked up dynamically?
- Ok("openbsd") | Ok("bitrig") | Ok("netbsd") | Ok("macos") | Ok("ios") => {}
+ Ok("openbsd") | Ok("bitrig") | Ok("netbsd") | Ok("macos") | Ok("ios") | Ok("solaris") => {}
// dependencies come with winapi
Ok("windows") => {}
tos => {

View file

@ -0,0 +1,27 @@
$NetBSD: patch-toolkit_components_terminator_nsTerminator.cpp,v 1.1 2018/06/28 14:04:10 ryoon Exp $
* Fix segfault on exit under NetBSD
--- toolkit/components/terminator/nsTerminator.cpp.orig 2016-06-15 21:54:53.514370128 +0000
+++ toolkit/components/terminator/nsTerminator.cpp
@@ -36,7 +36,7 @@
#if defined(XP_WIN)
#include <windows.h>
#else
-#include <unistd.h>
+#include <time.h>
#endif
#include "mozilla/ArrayUtils.h"
@@ -147,7 +147,10 @@ RunWatchdog(void* arg)
#if defined(XP_WIN)
Sleep(1000 /* ms */);
#else
- usleep(1000000 /* usec */);
+ struct timespec tickd;
+ tickd.tv_sec = 1;
+ tickd.tv_nsec = 0;
+ nanosleep(&tickd, NULL);
#endif
if (gHeartbeat++ < timeToLive) {

View file

@ -0,0 +1,18 @@
$NetBSD: patch-toolkit_library_moz.build,v 1.1 2018/06/28 14:04:10 ryoon Exp $
* Support system libraries
* Restore OSS support
--- toolkit/library/moz.build.orig 2018-05-03 16:58:41.000000000 +0000
+++ toolkit/library/moz.build
@@ -247,8 +247,8 @@ if CONFIG['MOZ_SYSTEM_LIBVPX']:
if not CONFIG['MOZ_TREE_PIXMAN']:
OS_LIBS += CONFIG['MOZ_PIXMAN_LIBS']
-if CONFIG['MOZ_ALSA']:
- OS_LIBS += CONFIG['MOZ_ALSA_LIBS']
+if CONFIG['MOZ_OSS']:
+ OS_LIBS += CONFIG['MOZ_OSS_LIBS']
if CONFIG['HAVE_CLOCK_MONOTONIC']:
OS_LIBS += CONFIG['REALTIME_LIBS']

View file

@ -0,0 +1,23 @@
$NetBSD: patch-toolkit_moz.configure,v 1.1 2018/06/28 14:04:10 ryoon Exp $
* skia part: support bigendian architectures
--- toolkit/moz.configure.orig 2018-05-03 16:58:41.000000000 +0000
+++ toolkit/moz.configure
@@ -932,11 +932,11 @@ include('nss.configure')
# ==============================================================
option('--disable-skia', help='Disable use of Skia')
-@depends('--disable-skia')
-def skia(value):
- if not value:
- die('--disable-skia is not supported anymore')
- else:
+@depends('--disable-skia', target)
+def skia(value, target):
+ if value.origin == 'default' and target.endianness == 'big':
+ return None
+ if value:
return True
set_config('MOZ_ENABLE_SKIA', skia)

View file

@ -0,0 +1,15 @@
$NetBSD: patch-toolkit_mozapps_installer_packager.mk,v 1.1 2018/06/28 14:04:10 ryoon Exp $
* Symbolic link to lib/firefox/firefox causes 'Couldn't load XPCOM.' error.
--- toolkit/mozapps/installer/packager.mk.orig 2018-01-11 20:17:05.000000000 +0000
+++ toolkit/mozapps/installer/packager.mk
@@ -137,7 +137,7 @@ endif
(cd $(DESTDIR)$(installdir) && tar -xf -)
$(NSINSTALL) -D $(DESTDIR)$(bindir)
$(RM) -f $(DESTDIR)$(bindir)/$(MOZ_APP_NAME)
- ln -s $(installdir)/$(MOZ_APP_NAME) $(DESTDIR)$(bindir)
+ #ln -s $(installdir)/$(MOZ_APP_NAME) $(DESTDIR)$(bindir)
checksum:
mkdir -p `dirname $(CHECKSUM_FILE)`

View file

@ -0,0 +1,16 @@
$NetBSD: patch-toolkit_xre_glxtest.cpp,v 1.1 2018/06/28 14:04:10 ryoon Exp $
Fix libGL filename on NetBSD,
see https://bugzilla.mozilla.org/show_bug.cgi?id=1180498
--- toolkit/xre/glxtest.cpp.orig 2015-07-04 20:26:15.000000000 +0200
+++ toolkit/xre/glxtest.cpp 2015-07-04 20:26:15.000000000 +0200
@@ -124,7 +124,7 @@ void glxtest()
fatal_error("The MOZ_AVOID_OPENGL_ALTOGETHER environment variable is defined");
///// Open libGL and load needed symbols /////
-#ifdef __OpenBSD__
+#if defined(__OpenBSD__) || defined(__NetBSD__)
#define LIBGL_FILENAME "libGL.so"
#else
#define LIBGL_FILENAME "libGL.so.1"

View file

@ -0,0 +1,15 @@
$NetBSD: patch-xpcom_base_nscore.h,v 1.1 2018/06/28 14:04:10 ryoon Exp $
* Support llvm/clang
--- xpcom/base/nscore.h.orig 2014-05-29 23:31:50.000000000 +0000
+++ xpcom/base/nscore.h
@@ -114,7 +114,7 @@
* NS_HIDDEN_(int) NS_FASTCALL func2(char *foo);
*/
-#if defined(__i386__) && defined(__GNUC__)
+#if defined(__i386__) && defined(__GNUC__) && !(defined(__clang__) && __clang_major__ == 3 && __clang_minor__ == 4 && __clang_patchlevel__ == 0)
#define NS_FASTCALL __attribute__ ((regparm (3), stdcall))
#define NS_CONSTRUCTOR_FASTCALL __attribute__ ((regparm (3), stdcall))
#elif defined(XP_WIN) && !defined(_WIN64)

View file

@ -0,0 +1,40 @@
$NetBSD: patch-xpcom_build_BinaryPath.h,v 1.1 2018/06/28 14:04:10 ryoon Exp $
* Fix build under netbsd-7, PR pkg/52956
--- xpcom/build/BinaryPath.h.orig 2018-01-11 20:17:07.000000000 +0000
+++ xpcom/build/BinaryPath.h
@@ -22,7 +22,8 @@
defined(__OpenBSD__)
#include <sys/sysctl.h>
#endif
-#if defined(__OpenBSD__)
+#if defined(__OpenBSD__) || \
+ (defined(__NetBSD__) && !defined(KERN_PROC_PATHNAME))
#include <sys/stat.h>
#endif
#include "mozilla/UniquePtr.h"
@@ -172,7 +173,8 @@ private:
}
#elif defined(__FreeBSD__) || defined(__DragonFly__) || \
- defined(__FreeBSD_kernel__) || defined(__NetBSD__)
+ defined(__FreeBSD_kernel__) || \
+ (defined(__NetBSD__) && defined(KERN_PROC_PATHNAME))
static nsresult Get(char aResult[MAXPATHLEN])
{
int mib[4];
@@ -257,6 +259,13 @@ private:
return NS_ERROR_FAILURE;
}
+#elif (defined(__NetBSD__) && !defined(KERN_PROC_PATHNAME))
+ static nsresult Get(char aResult[MAXPATHLEN])
+ {
+ char path[] = "@PREFIX@/lib/firefox60/firefox60";
+ sprintf(aResult, "%s", path);
+ return NS_OK;
+ }
#else
#error Oops, you need platform-specific code here
#endif

View file

@ -0,0 +1,89 @@
$NetBSD: patch-xpcom_reflect_xptcall_md_unix_xptcinvoke__sparc64__netbsd.cpp,v 1.1 2018/06/28 14:04:10 ryoon Exp $
--- xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc64_netbsd.cpp.orig 2014-10-14 18:49:14.000000000 +0000
+++ xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc64_netbsd.cpp
@@ -0,0 +1,84 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ */
+
+/* Platform specific code to invoke XPCOM methods on native objects */
+
+#include "xptcprivate.h"
+
+#if !defined(__sparc64__) && !defined(_LP64)
+#error "This code is for Sparc64 only"
+#endif
+
+extern "C" PRUint32
+invoke_copy_to_stack(PRUint64* d, PRUint32 paramCount, nsXPTCVariant* s)
+{
+ /*
+ We need to copy the parameters for this function to locals and use them
+ from there since the parameters occupy the same stack space as the stack
+ we're trying to populate.
+ */
+ PRUint64 *l_d = d;
+ nsXPTCVariant *l_s = s;
+ PRUint64 l_paramCount = paramCount;
+ PRUint64 regCount = 0; // return the number of registers to load from the stack
+
+ for(PRUint64 i = 0; i < l_paramCount; i++, l_d++, l_s++)
+ {
+ if (regCount < 5) regCount++;
+
+ if (l_s->IsPtrData())
+ {
+ *l_d = (PRUint64)l_s->ptr;
+ continue;
+ }
+ switch (l_s->type)
+ {
+ case nsXPTType::T_I8 : *((PRInt64*)l_d) = l_s->val.i8; break;
+ case nsXPTType::T_I16 : *((PRInt64*)l_d) = l_s->val.i16; break;
+ case nsXPTType::T_I32 : *((PRInt64*)l_d) = l_s->val.i32; break;
+ case nsXPTType::T_I64 : *((PRInt64*)l_d) = l_s->val.i64; break;
+
+ case nsXPTType::T_U8 : *((PRUint64*)l_d) = l_s->val.u8; break;
+ case nsXPTType::T_U16 : *((PRUint64*)l_d) = l_s->val.u16; break;
+ case nsXPTType::T_U32 : *((PRUint64*)l_d) = l_s->val.u32; break;
+ case nsXPTType::T_U64 : *((PRUint64*)l_d) = l_s->val.u64; break;
+
+ /* in the case of floats, we want to put the bits in to the
+ 64bit space right justified... floats in the paramter array on
+ sparcv9 use odd numbered registers.. %f1, %f3, so we have to skip
+ the space that would be occupied by %f0, %f2, etc.
+ */
+ case nsXPTType::T_FLOAT : *(((float*)l_d) + 1) = l_s->val.f; break;
+ case nsXPTType::T_DOUBLE: *((double*)l_d) = l_s->val.d; break;
+ case nsXPTType::T_BOOL : *((PRInt64*)l_d) = l_s->val.b; break;
+ case nsXPTType::T_CHAR : *((PRUint64*)l_d) = l_s->val.c; break;
+ case nsXPTType::T_WCHAR : *((PRInt64*)l_d) = l_s->val.wc; break;
+
+ default:
+ // all the others are plain pointer types
+ *((void**)l_d) = l_s->val.p;
+ break;
+ }
+ }
+
+ return regCount;
+}

25
www/firefox60/xpi.mk Normal file
View file

@ -0,0 +1,25 @@
# $NetBSD: xpi.mk,v 1.1 2018/06/28 14:04:10 ryoon Exp $
#
# common logic for repackaging mozilla extensions (.xpi files)
# Used by the {firefox,seamonkey,thunderbird}-l10n packages.
USE_TOOLS+= unzip pax
post-extract: extract-xpi
.PHONY: extract-xpi
extract-xpi:
.for f in ${XPI_FILES}
${RUN} ${MKDIR} ${WRKDIR}/${f:S/.xpi//} && cd ${WRKDIR}/${f:S/.xpi//} && ${UNZIP_CMD} -aqo "${WRKDIR}/${f}"
.endfor
do-install: install-xpi
.PHONY: install-xpi
install-xpi:
.for f in ${XPI_FILES}
id=$$(${AWK} '/em:id=/ {sub("^.*em:id=\"", "");sub("\".*$$","");print $$0}' < ${WRKDIR}/${f:S/.xpi//}/install.rdf); \
${MKDIR} ${DESTDIR}${EXTENSIONS_DIR}/$${id} && \
cd ${WRKDIR}/${f:S/.xpi//} && \
pax -rw . ${DESTDIR}${EXTENSIONS_DIR}/$${id}
.endfor