diff --git a/media-gfx/freecad/Manifest b/media-gfx/freecad/Manifest
new file mode 100644
index 0000000..a1e117c
--- /dev/null
+++ b/media-gfx/freecad/Manifest
@@ -0,0 +1,3 @@
+AUX freecad.sharedmimeinfo 312 SHA256 269e6b38d4a5f4e593e9e1e911ccd0185a1cb7a0250ae2a308cfc482e56615f1 SHA512 bb55cad8387032af0e06ce7f1b4cab4354a34a915b9f550de25e05bf24d4161d9ea152d5692d65df4b362622f76a11d78894deaf7fee60c7a3fc0bfec38fa10c WHIRLPOOL e4185b2d067d5e9b7a0b065b5cc6a92da055f96b610bdee5aecd28f379abe2a31feddccc5ccc6222978d5fbf73a7734a880cfd1f62a8383fa828d90147856081
+EBUILD freecad-9999.ebuild 3472 SHA256 b65914f02bbe3c5e6842acae9c0418b27db0ac653bef9adce51574a6c5dc4332 SHA512 b90b11ed755494c7a1bbf0c0c23d1376a4384e3cf2de09fe981617d1f27f2fc773af480bb83bc0dc8fd9eb4e5a54875af92dd57bac8feb5d8999d1f33086c141 WHIRLPOOL c9c94f7a40f2e7ca0b4c97d7c38cacf697fe809798766a49269fbbe98a9ad06dcf104b94ef493064e070cfdc082c3fbaabf69e6c8d0e758574f23fae650fea84
+MISC metadata.xml 376 SHA256 c2dc08e9c6a05c6ac5940444ee00f05e4300670d4d47d0e15bccaf277455a4e6 SHA512 2b159882b18f33adc78ede30133528a915130d21fcfd111a099861b2ee719b59338cd81af63a289bb5812ce04dee238a6eb4596a95a5abedbc453f631e827f53 WHIRLPOOL 3a10b2f137ce880d2e73878ea2170ae1884ed18c9184962b419144474c73c207fdeab1af20c908265ac0eb275beeb99d2a60c988619fce39eba629d2d1d5a573
diff --git a/media-gfx/freecad/files/freecad.sharedmimeinfo b/media-gfx/freecad/files/freecad.sharedmimeinfo
new file mode 100644
index 0000000..6d5e93e
--- /dev/null
+++ b/media-gfx/freecad/files/freecad.sharedmimeinfo
@@ -0,0 +1,8 @@
+
+
+
+
+ FreeCAD document files
+
+
+
diff --git a/media-gfx/freecad/freecad-9999.ebuild b/media-gfx/freecad/freecad-9999.ebuild
new file mode 100644
index 0000000..9a03b84
--- /dev/null
+++ b/media-gfx/freecad/freecad-9999.ebuild
@@ -0,0 +1,128 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit cmake-utils eutils fdo-mime fortran-2 python-single-r1
+
+DESCRIPTION="QT based Computer Aided Design application"
+HOMEPAGE="http://www.freecadweb.org/"
+
+if [[ ${PV} == *9999 ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/FreeCAD/FreeCAD.git"
+else
+ SRC_URI="https://github.com/FreeCAD/FreeCAD/archive/${PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64 ~x86"
+fi
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+COMMON_DEPEND="
+ ${PYTHON_DEPS}
+ dev-cpp/eigen:3
+ dev-java/xerces
+ dev-libs/boost:=[python,${PYTHON_USEDEP}]
+ dev-libs/xerces-c[icu]
+ dev-python/matplotlib[${PYTHON_USEDEP}]
+ dev-python/pyside:2[gui,svg,${PYTHON_USEDEP}]
+ dev-python/shiboken:2[${PYTHON_USEDEP}]
+ dev-qt/designer:5
+ dev-qt/qtgui:5
+ dev-qt/qtopengl:5
+ dev-qt/qtsvg:5
+ dev-qt/qtwebkit:5
+ media-libs/coin
+ media-libs/freetype
+ >=sci-libs/opencascade-7.1[vtk]
+ sys-libs/zlib
+ virtual/glu"
+RDEPEND="${COMMON_DEPEND}
+ dev-python/numpy[${PYTHON_USEDEP}]
+ dev-qt/assistant:5"
+ #dev-python/pivy[${PYTHON_USEDEP}]
+
+DEPEND="${COMMON_DEPEND}
+ >=dev-lang/swig-2.0.4-r1:0
+ dev-python/pyside-tools:2[${PYTHON_USEDEP}]"
+
+# https://bugs.gentoo.org/show_bug.cgi?id=352435
+# https://www.gentoo.org/foundation/en/minutes/2011/20110220_trustees.meeting_log.txt
+RESTRICT="mirror"
+
+# TODO:
+# DEPEND and RDEPEND:
+# salome-smesh - science overlay
+# zipio++ - not in portage yet
+
+DOCS=( README.md ChangeLog.txt )
+
+pkg_setup() {
+ fortran-2_pkg_setup
+ python-single-r1_pkg_setup
+
+ [[ -z ${CASROOT} ]] && die "empty \$CASROOT, run eselect opencascade set or define otherwise"
+}
+
+src_configure() {
+ export QT_SELECT=5
+
+ #-DOCC_* defined with cMake/FindOpenCasCade.cmake
+ #-DCOIN3D_* defined with cMake/FindCoin3D.cmake
+ #-DSOQT_ not used
+ #-DFREECAD_USE_EXTERNAL_KDL="ON" waiting for Bug 604130 (keyword ~x86)
+ local mycmakeargs=(
+ -DOCC_INCLUDE_DIR="${CASROOT}"/inc
+ -DOCC_LIBRARY_DIR="${CASROOT}"/$(get_libdir)
+ -DCMAKE_INSTALL_DATADIR=share/${P}
+ -DCMAKE_INSTALL_DOCDIR=share/doc/${PF}
+ -DCMAKE_INSTALL_INCLUDEDIR=include/${P}
+ -DFREECAD_USE_EXTERNAL_KDL="OFF"
+ QT=Qt5
+ )
+
+ # TODO to remove embedded dependencies:
+ #
+ # -DFREECAD_USE_EXTERNAL_ZIPIOS="ON" -- this option needs zipios++ but it's not yet in portage so the embedded zipios++
+ # (under src/zipios++) will be used
+ # salomesmesh is in 3rdparty but upstream's find_package function is not complete yet to compile against external version
+ # (external salomesmesh is available in "science" overlay)
+
+ cmake-utils_src_configure
+ einfo "${P} will be built against opencascade version ${CASROOT}"
+}
+
+src_install() {
+ cmake-utils_src_install
+
+ make_desktop_entry FreeCAD "FreeCAD" "" "" "MimeType=application/x-extension-fcstd;"
+
+ # install mimetype for FreeCAD files
+ insinto /usr/share/mime/packages
+ newins "${FILESDIR}"/${PN}.sharedmimeinfo "${PN}.xml"
+
+ # install icons to correct place rather than /usr/share/freecad
+ pushd "${ED%/}"/usr/share/${P} || die
+ local size
+ for size in 16 32 48 64; do
+ newicon -s ${size} freecad-icon-${size}.png freecad.png
+ done
+ doicon -s scalable freecad.svg
+ newicon -s 64 -c mimetypes freecad-doc.png application-x-extension-fcstd.png
+ popd || die
+
+ python_optimize "${ED%/}"/usr/{,share/${P}/}Mod/
+}
+
+pkg_postinst() {
+ fdo-mime_mime_database_update
+}
+
+pkg_postrm() {
+ fdo-mime_mime_database_update
+}
diff --git a/media-gfx/freecad/metadata.xml b/media-gfx/freecad/metadata.xml
new file mode 100644
index 0000000..fd959a3
--- /dev/null
+++ b/media-gfx/freecad/metadata.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ xmw@gentoo.org
+ Michael Weber
+
+
+ free-cad
+ FreeCAD/FreeCAD
+
+
diff --git a/media-libs/avidemux-core/Manifest b/media-libs/avidemux-core/Manifest
new file mode 100644
index 0000000..384d375
--- /dev/null
+++ b/media-libs/avidemux-core/Manifest
@@ -0,0 +1,3 @@
+AUX avidemux-core-2.6.20-x264.patch 1175 SHA256 723d0987e1ff7a504e91a00b75b97763997a61e7fd0bb2fd34dd77a8484a6e24 SHA512 ae01c2cb6267bf9be685398c8eeaf4bf72711ad4537bdfe9f30044c18bd149d26583859f7e887a9b0b09d954453426c4815cc7a22c5837b0b5f0bfdac14edbd4 WHIRLPOOL ad1caebd234bb25008570d3368d1ede664672a17b4f1dcd842ac88541a33c8b99b1512e65f703b844b97e7721a89949d07d65f043d7fa068a0ac73e9edcfbceb
+DIST avidemux_2.6.20.tar.gz 20172362 SHA256 03c6cb7fc9eb74688b4fcd5eb654ed7b9c4ffc717a72cc09b08a2d10cdc7ef9f SHA512 d01d0fc24a3004770bd3923c2debc4fa2752eb71df08cfe423746b9c44a2562ca01d82965ed2563b99572a4bed8034b79487199ce330208b51a3b7f87ccf7103 WHIRLPOOL 2e2dc21bed49eeb0cdfefe75fe51f6a84226e7e8e80b063bc0b3d8711a6b91db710611dc0ec06575be69ec8e24f2f9e5b5eb363b9c095267729e85e162a4ce38
+EBUILD avidemux-core-2.6.20-r1.ebuild 2740 SHA256 7224102bf2afecc7370a76c49ee02681e9d86faac0af27be0152dcabb7f42f7d SHA512 f3f3840af976ca3b8ae3b4c2746d45830dd3eb44e0c841caf562cdc9fd507def66ee155e1d9a00fcd91c5f83b0913a4a0f286d0bdf614c9547365f214f9d54b8 WHIRLPOOL e1ba0f91bcd5d73bcb0612021e18d55e3cf2775577794866720e09acd37c9f483ab9c3da5824ba56a1c672d7ef20ac8540fea11854802333c4e69130aceecc9f
diff --git a/media-libs/avidemux-core/avidemux-core-2.6.20-r1.ebuild b/media-libs/avidemux-core/avidemux-core-2.6.20-r1.ebuild
new file mode 100644
index 0000000..ade37f9
--- /dev/null
+++ b/media-libs/avidemux-core/avidemux-core-2.6.20-r1.ebuild
@@ -0,0 +1,106 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+inherit cmake-utils eutils
+
+DESCRIPTION="Core libraries for a video editor designed for simple cutting, filtering and encoding tasks"
+HOMEPAGE="http://fixounet.free.fr/avidemux"
+
+# Multiple licenses because of all the bundled stuff.
+LICENSE="GPL-1 GPL-2 MIT PSF-2 public-domain"
+SLOT="2.6"
+IUSE="debug nls nvenc sdl system-ffmpeg vaapi vdpau video_cards_fglrx xv"
+
+if [[ ${PV} == *9999* ]] ; then
+ EGIT_REPO_URI="https://github.com/mean00/avidemux2.git"
+ EGIT_CHECKOUT_DIR=${WORKDIR}
+
+ inherit git-r3
+else
+ MY_PN="${PN/-core/}"
+ MY_P="${MY_PN}_${PV}"
+ SRC_URI="mirror://sourceforge/${MY_PN}/${MY_PN}/${PV}/${MY_P}.tar.gz"
+ KEYWORDS="~amd64 ~x86"
+fi
+
+# Trying to use virtual; ffmpeg misses aac,cpudetection USE flags now though, are they needed?
+DEPEND="
+ !=virtual/ffmpeg-9:0[mp3,theora] )
+ xv? ( x11-libs/libXv:0 )
+ vaapi? ( x11-libs/libva:0 )
+ vdpau? ( x11-libs/libvdpau:0 )
+ nvenc? ( media-video/nvidia_video_sdk )
+ video_cards_fglrx? (
+ || ( >=x11-drivers/ati-drivers-14.12-r3
+ x11-libs/xvba-video:0 )
+ )
+"
+RDEPEND="
+ $DEPEND
+ nls? ( virtual/libintl:0 )
+"
+DEPEND="
+ $DEPEND
+ virtual/pkgconfig
+ nls? ( sys-devel/gettext )
+ !system-ffmpeg? ( dev-lang/yasm[nls=] )
+"
+
+S="${WORKDIR}/${MY_P}"
+CMAKE_USE_DIR="${S}/${PN/-/_}"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-x264.patch
+
+ cmake-utils_src_prepare
+
+ if use system-ffmpeg ; then
+ # Preparations to support the system ffmpeg. Currently fails because it depends on files the system ffmpeg doesn't install.
+ local error="Failed to remove ffmpeg."
+
+ rm -rf cmake/admFFmpeg* cmake/ffmpeg* avidemux_core/ffmpeg_package buildCore/ffmpeg || die "${error}"
+ sed -i -e 's/include(admFFmpegUtil)//g' avidemux/commonCmakeApplication.cmake || die "${error}"
+ sed -i -e '/registerFFmpeg/d' avidemux/commonCmakeApplication.cmake || die "${error}"
+ sed -i -e 's/include(admFFmpegBuild)//g' avidemux_core/CMakeLists.txt || die "${error}"
+ fi
+}
+
+src_configure() {
+ # Add lax vector typing for PowerPC.
+ if use ppc || use ppc64 ; then
+ append-cflags -flax-vector-conversions
+ fi
+
+ # See bug 432322.
+ use x86 && replace-flags -O0 -O1
+
+ local mycmakeargs=(
+ -DAVIDEMUX_SOURCE_DIR='${S}'
+ -DGETTEXT="$(usex nls)"
+ -DSDL="$(usex sdl)"
+ -DLIBVA="$(usex vaapi)"
+ -DVDPAU="$(usex vdpau)"
+ -DXVBA="$(usex video_cards_fglrx)"
+ -DXVIDEO="$(usex xv)"
+ -DNVENC="$(usex nvenc)"
+ )
+
+ if use debug ; then
+ mycmakeargs+=( -DVERBOSE=1 -DADM_DEBUG=1 )
+ fi
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ cmake-utils_src_compile -j1
+}
+
+src_install() {
+ cmake-utils_src_install -j1
+}
diff --git a/media-libs/avidemux-core/files/avidemux-core-2.6.20-x264.patch b/media-libs/avidemux-core/files/avidemux-core-2.6.20-x264.patch
new file mode 100644
index 0000000..d42f109
--- /dev/null
+++ b/media-libs/avidemux-core/files/avidemux-core-2.6.20-x264.patch
@@ -0,0 +1,25 @@
+From c5edc6cf7b3768ac1409c6cef69ab5980a86596a Mon Sep 17 00:00:00 2001
+From: eumagga0x2a
+Date: Thu, 20 Jul 2017 23:54:58 +0200
+Subject: [PATCH] [cmake/x264] Fix build with cmake 3.9.0
+
+---
+ cmake/admCheckX264.cmake | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/cmake/admCheckX264.cmake b/cmake/admCheckX264.cmake
+index 10b73336c..4f778af09 100644
+--- a/cmake/admCheckX264.cmake
++++ b/cmake/admCheckX264.cmake
+@@ -20,9 +20,9 @@ MACRO(checkX264)
+ ELSE (x264_version LESS 67)
+ IF (x264_version GREATER 73)
+ FIND_HEADER_AND_LIB(X264 x264.h x264 x264_encoder_open_${x264_version})
++ ELSE (x264_version GREATER 73)
++ FIND_HEADER_AND_LIB(X264 x264.h x264 x264_encoder_open)
+ ENDIF (x264_version GREATER 73)
+- ELSE (x264_version LESS 67)
+- FIND_HEADER_AND_LIB(X264 x264.h x264 x264_encoder_open)
+ ENDIF (x264_version LESS 67)
+ IF(X264_FOUND)
+ SET(USE_X264 True CACHE BOOL "")
diff --git a/sci-libs/opencascade/Manifest b/sci-libs/opencascade/Manifest
new file mode 100644
index 0000000..2adfe72
--- /dev/null
+++ b/sci-libs/opencascade/Manifest
@@ -0,0 +1,4 @@
+AUX opencascade-7.1.0-buildsystem.patch 3181 SHA256 7c77e83733d239101d0c7f3d150b48e217006d881c3a17ea6afe1d7db9478505 SHA512 1eaf59916eae29ac34af31aebda38a19009cf9b1eb310acf786c92d116dbcb7a61328c9e1644c59a9c2317b3d33215cf7928b765b1b802c068d5b797d4e48636 WHIRLPOOL 50f9d48add55fd43fb4137fa9e66a7b070f4f7e55a0fdeb422a1b0408dd4fed192c3d40e64e58684f942c2df8bd170efeff91b59e73c82c989f035e15873ff25
+DIST opencascade-7.1.0.tgz 221861542 SHA256 0e23f038f4d12ed68d402dd8093923ac506db34abcf1c09bd2bffba1587f68d5 SHA512 4b729ccca950e90381ccdd9f407d98af281f02f98212d7fc13be031253f530f75cc1c6e2f2a1a9880ada6626a0c5bd144d991370170745c087313a4bdb2c45b0 WHIRLPOOL f9c74d3f2b1a5bb41fbbdf71e17317f5e3e12dc72fcb846e533472eead53eab2a3b0dd666ba3e5acd5466e9b91a31fa580c054e704cab2bc7409c9cc472ff4da
+EBUILD opencascade-7.1.0.ebuild 4646 SHA256 01e5d55acd21fde60afea77ae16789a52fff294f58ff4b76ef81633f3db13825 SHA512 f7dce3db889f2ad6a907114447de216d71e90a24043ad10af3853f8401396e9eed7c08552413f76ed1fe5e5fc96b173a3a444667725cced0464a76611111261c WHIRLPOOL 52cc23d9b0aaad748c0dc2e18e7815d300c420d527b712f3d46012425176d9738911413d85a2091433953bd826a2db456e90ce5e81d803aa7a2daac58eb5c55c
+MISC metadata.xml 580 SHA256 f8102061d63967206a537e3fac408d212b784c606f40cd260d02811566257fe6 SHA512 5483b31f271b1492f499aec837b18dd4e5abe4e0b4ac8a4e3de17be6bd9467faa0629bd7423c9fad3a6c827eb74ecddaedf61f795a2c05757b69400ad0b68311 WHIRLPOOL 04b93b1e78d244ca3dd658f3ac6b63e519c63d84f9eabe9b9ae905195885e56619f7322e755c9717d02f2636c6dc0bf414348a8a420dd9d8f1d8b97c91134b1b
diff --git a/sci-libs/opencascade/files/opencascade-7.1.0-buildsystem.patch b/sci-libs/opencascade/files/opencascade-7.1.0-buildsystem.patch
new file mode 100644
index 0000000..2f49899
--- /dev/null
+++ b/sci-libs/opencascade/files/opencascade-7.1.0-buildsystem.patch
@@ -0,0 +1,51 @@
+--- CMakeLists.txt 2016-11-25 12:52:00.000000000 +0300
++++ CMakeLists.txt.new 2017-06-05 10:38:15.000000000 +0300
+@@ -755,15 +755,15 @@
+ endif()
+
+ # change custom.bat/sh
+-if (EXISTS "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}")
+- file (READ "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}" CUSTOM_CONTENT)
+-
+- set (CUSTOM_CONTENT "${CUSTOM_CONTENT} ${ADDITIONAL_CUSTOM_CONTENT}")
+-
+- file (WRITE "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}" "${CUSTOM_CONTENT}")
+-else()
++#if (EXISTS "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}")
++# file (READ "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}" CUSTOM_CONTENT)
++#
++# set (CUSTOM_CONTENT "${CUSTOM_CONTENT} ${ADDITIONAL_CUSTOM_CONTENT}")
++#
++# file (WRITE "${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}/custom.${SCRIPT_EXT}" "${CUSTOM_CONTENT}")
++#else()
+ OCCT_CONFIGURE_AND_INSTALL ("adm/templates/custom.${SCRIPT_EXT}.main" "custom.${SCRIPT_EXT}" "custom.${SCRIPT_EXT}" "${INSTALL_DIR_SCRIPT}")
+-endif()
++#endif()
+
+ # write current custom.bat/sh (for install directory)
+ set (SUB_CUSTOM_BUILD_NAME "custom_${COMPILER}_${COMPILER_BITNESS}.install.${SCRIPT_EXT}")
+@@ -891,7 +891,8 @@
+ list (REMOVE_DUPLICATES OCCT_COMPILE_DEFINITIONS)
+
+ # export compile definitions and C/C++ flags for each configuration to OpenCASCADE config files
+-foreach (OCCT_CONFIGURATION ${CMAKE_CONFIGURATION_TYPES})
++#foreach (OCCT_CONFIGURATION ${CMAKE_CONFIGURATION_TYPES})
++set(OCCT_CONFIGURATION ${CMAKE_BUILD_TYPE})
+ set (SET_OpenCASCADE_COMPILE_DEFINITIONS)
+ string (TOUPPER "${OCCT_CONFIGURATION}" OCCT_CONFIGURATION_UPPER)
+ string (TOLOWER "${OCCT_CONFIGURATION}" OCCT_CONFIGURATION_LOWER)
+@@ -903,10 +904,11 @@
+ set (SET_OpenCASCADE_CMAKE_C_FLAGS "${CMAKE_C_FLAGS_${OCCT_CONFIGURATION_UPPER}}")
+ set (SET_OpenCASCADE_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_${OCCT_CONFIGURATION_UPPER}}")
+ configure_file("${CMAKE_SOURCE_DIR}/adm/templates/OpenCASCADECompileDefinitionsAndFlags.cmake.in" "OpenCASCADECompileDefinitionsAndFlags-${OCCT_CONFIGURATION_LOWER}.cmake" @ONLY)
+-endforeach()
++install(FILES "${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-${OCCT_CONFIGURATION_LOWER}.cmake" DESTINATION "${INSTALL_DIR_CMAKE}")
++#endforeach()
+ # install OpenCASCADE config file with compile definitions and C/C++ flags ONLY for current configuration
+-install (CODE "string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWER)")
+-install (CODE "configure_file(\"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" \"${INSTALL_DIR}/${INSTALL_DIR_CMAKE}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" COPYONLY)")
++#install (CODE "string (TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" CMAKE_INSTALL_CONFIG_NAME_LOWER)")
++#install (CODE "configure_file(\"${CMAKE_BINARY_DIR}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" \"${CMAKE_INSTALL_PREFIX}/${INSTALL_DIR_CMAKE}/OpenCASCADECompileDefinitionsAndFlags-\${CMAKE_INSTALL_CONFIG_NAME_LOWER}.cmake\" COPYONLY)")
+
+ foreach (OCCT_MODULE ${OCCT_MODULES})
+ if (BUILD_MODULE_${OCCT_MODULE})
diff --git a/sci-libs/opencascade/metadata.xml b/sci-libs/opencascade/metadata.xml
new file mode 100644
index 0000000..0dc2b1d
--- /dev/null
+++ b/sci-libs/opencascade/metadata.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ xmw@gentoo.org
+ Michael Weber
+
+
+
diff --git a/sci-libs/opencascade/opencascade-7.1.0.ebuild b/sci-libs/opencascade/opencascade-7.1.0.ebuild
new file mode 100644
index 0000000..29be587
--- /dev/null
+++ b/sci-libs/opencascade/opencascade-7.1.0.ebuild
@@ -0,0 +1,153 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit cmake-utils eutils check-reqs multilib java-pkg-opt-2 flag-o-matic
+
+DESCRIPTION="Software development platform for CAD/CAE, 3D surface/solid modeling and data exchange"
+HOMEPAGE="http://www.opencascade.com/"
+SRC_URI="http://www.${PN}.com/sites/default/files/private/occt/OCC_${PV}_release/${P}.tgz"
+
+LICENSE="|| ( Open-CASCADE-LGPL-2.1-Exception-1.0 LGPL-2.1 )"
+SLOT="${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug doc examples freeimage gl2ps java tbb test +vtk"
+
+MY_VTK="vtk-7.1"
+DEPEND="app-eselect/eselect-opencascade
+ dev-lang/tcl:0=
+ dev-lang/tk:0=
+ dev-tcltk/itcl
+ dev-tcltk/itk
+ dev-tcltk/tix
+ media-libs/freetype:2
+ media-libs/ftgl
+ virtual/glu
+ virtual/opengl
+ x11-libs/libXmu
+ doc? ( app-doc/doxygen )
+ freeimage? ( media-libs/freeimage )
+ gl2ps? ( x11-libs/gl2ps )
+ java? ( >=virtual/jdk-0:= )
+ tbb? ( dev-cpp/tbb )
+ vtk? ( =sci-libs/${MY_VTK}*[rendering] )"
+RDEPEND="${DEPEND}"
+
+# https://bugs.gentoo.org/show_bug.cgi?id=352435
+# https://www.gentoo.org/foundation/en/minutes/2011/20110220_trustees.meeting_log.txt
+RESTRICT="bindist"
+
+CHECKREQS_MEMORY="256M"
+CHECKREQS_DISK_BUILD="3584M"
+
+PATCHES=( "${FILESDIR}"/${P}-buildsystem.patch
+ )
+
+pkg_setup() {
+ check-reqs_pkg_setup
+ java-pkg-opt-2_pkg_setup
+}
+
+src_prepare() {
+ cmake-utils_src_prepare
+ java-pkg-opt-2_src_prepare
+my_install_dir=${EROOT}usr/$(get_libdir)/${P}/ros
+ local my_env_install="#!/bin/sh -f
+if [ -z \"\$PATH\" ]; then
+ export PATH=VAR_CASROOT/Linux/bin
+else
+ export PATH=VAR_CASROOT/Linux/bin:\$PATH
+fi
+if [ -z \"\$LD_LIBRARY_PATH\" ]; then
+ export LD_LIBRARY_PATH=VAR_CASROOT/Linux/lib
+else
+ export LD_LIBRARY_PATH=VAR_CASROOT/Linux/lib:\$LD_LIBRARY_PATH
+fi"
+ local my_sys_lib=${EROOT}usr/$(get_libdir)
+ local my_env="CASROOT=VAR_CASROOT
+CSF_MDTVFontDirectory=VAR_CASROOT/src/FontMFT
+CSF_LANGUAGE=us
+MMGT_CLEAR=1
+CSF_EXCEPTION_PROMPT=1
+CSF_SHMessage=VAR_CASROOT/src/SHMessage
+CSF_MDTVTexturesDirectory=VAR_CASROOT/src/Textures
+CSF_XSMessage=VAR_CASROOT/src/XSMessage
+CSF_StandardDefaults=VAR_CASROOT/src/StdResource
+CSF_PluginDefaults=VAR_CASROOT/src/StdResource
+CSF_XCAFDefaults=VAR_CASROOT/src/StdResource
+CSF_StandardLiteDefaults=VAR_CASROOT/src/StdResource
+CSF_GraphicShr=VAR_CASROOT/Linux/lib/libTKOpenGl.so
+CSF_UnitsLexicon=VAR_CASROOT/src/UnitsAPI/Lexi_Expr.dat
+CSF_UnitsDefinition=VAR_CASROOT/src/UnitsAPI/Units.dat
+CSF_IGESDefaults=VAR_CASROOT/src/XSTEPResource
+CSF_STEPDefaults=VAR_CASROOT/src/XSTEPResource
+CSF_XmlOcafResource=VAR_CASROOT/src/XmlOcafResource
+CSF_MIGRATION_TYPES=VAR_CASROOT/src/StdResource/MigrationSheet.txt
+TCLHOME=${EROOT}usr/bin
+TCLLIBPATH=${my_sys_lib}
+ITK_LIBRARY=${my_sys_lib}/itk$(grep ITK_VER /usr/include/itk.h | sed 's/^.*"\(.*\)".*/\1/')
+ITCL_LIBRARY=${my_sys_lib}/itcl$(grep ITCL_VER /usr/include/itcl.h | sed 's/^.*"\(.*\)".*/\1/')
+TIX_LIBRARY=${my_sys_lib}/tix$(grep TIX_VER /usr/include/tix.h | sed 's/^.*"\(.*\)".*/\1/')
+TK_LIBRARY=${my_sys_lib}/tk$(grep TK_VER /usr/include/tk.h | sed 's/^.*"\(.*\)".*/\1/')
+TCL_LIBRARY=${my_sys_lib}/tcl$(grep TCL_VER /usr/include/tcl.h | sed 's/^.*"\(.*\)".*/\1/')"
+
+ ( echo "${my_env_install}"
+ echo "${my_env}" | sed -e "s:^:export :" ) \
+ | sed -e "s:VAR_CASROOT:${S}:g" > env.sh || die
+ source env.sh
+
+ ( echo "PATH=${my_install_dir}/bin"
+ echo "LDPATH=${my_install_dir}/$(get_libdir)"
+ echo "${my_env}" | sed \
+ -e "s:VAR_CASROOT:${my_install_dir}:g" \
+ -e "s:/Linux/lib/:/$(get_libdir)/:g" || die
+ ) > ${S}/50${PN}
+
+}
+
+src_configure() {
+
+ # from dox/dev_guides/building/cmake/cmake.md
+ local mycmakeargs=(
+ -DCMAKE_CONFIGURATION_TYPES="Gentoo"
+ -DBUILD_WITH_DEBUG=$(usex debug)
+ -DCMAKE_INSTALL_PREFIX="${my_install_dir}"
+ -DINSTALL_DIR_DOC="/usr/share/doc/${P}"
+ -DINSTALL_DIR_CMAKE="/usr/$(get_libdir)/cmake/${PN}"
+ -DUSE_D3D=no
+ -DUSE_FREEIMAGE=$(usex freeimage)
+ -DUSE_GL2PS=$(usex gl2ps)
+ -DUSE_TBB=$(usex tbb)
+ -DUSE_VTK=$(usex vtk)
+ -DBUILD_DOC_Overview=$(usex doc)
+ -DINSTALL_DOC_Overview=$(usex doc)
+ -DINSTALL_SAMPLES=$(usex examples)
+ -DINSTALL_TEST_CASES=$(usex test)
+ )
+# -DINSTALL_DIR_WITH_VERSION=yes
+# -DINSTALL_DIR="${my_install_dir}"
+ cmake-utils_src_configure
+}
+
+src_install() {
+ cmake-utils_src_install
+
+ insinto /etc/env.d/${PN}
+ newins ${S}/50${PN} ${PV}
+
+ if ! use examples; then
+ rm -rf "${my_install_dir}"/share/${P}/samples || die
+ fi
+
+}
+
+pkg_postinst() {
+ eselect ${PN} set ${PV}
+ einfo
+ elog "After upgrading OpenCASCADE you may have to rebuild packages depending on it."
+ elog "You get a list by running \"equery depends sci-libs/opencascade\""
+ elog "revdep-rebuild does NOT suffice."
+ einfo
+}