Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
math/py-keras: Update 2.4.3 -> 2.9.0
PR: 266311
- Loading branch information
Showing
15 changed files
with
1,407 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,106 @@ | ||
PORTNAME= keras | ||
DISTVERSION= 2.4.3 | ||
DISTVERSION= 2.9.0 | ||
CATEGORIES= math # machine-learning | ||
MASTER_SITES= CHEESESHOP | ||
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} | ||
DISTNAME= Keras-${PORTVERSION} | ||
|
||
MAINTAINER= yuri@FreeBSD.org | ||
COMMENT= Deep learning library for Python | ||
WWW= https://keras.io/ | ||
|
||
USE_GITHUB= yes | ||
GH_ACCOUNT= keras-team | ||
GH_PROJECT= ${PORTNAME} | ||
GH_TAGNAME= r2.9 | ||
|
||
LICENSE= MIT | ||
LICENSE_FILE= ${WRKSRC}/LICENSE | ||
|
||
RUN_DEPENDS= ${PYNUMPY} \ | ||
RUN_DEPENDS= ${PYNUMPY} \ | ||
${PYTHON_PKGNAMEPREFIX}absl-py>=1.0.0:devel/py-absl-py \ | ||
${PYTHON_PKGNAMEPREFIX}h5py>=0:science/py-h5py@${PY_FLAVOR} \ | ||
${PYTHON_PKGNAMEPREFIX}keras-applications>=1.0.6:math/py-keras-applications@${PY_FLAVOR} \ | ||
${PYTHON_PKGNAMEPREFIX}keras-preprocessing>=1.0.5:math/py-keras-preprocessing@${PY_FLAVOR} \ | ||
${PYTHON_PKGNAMEPREFIX}pandas>=1.3.5:math/py-pandas@${PY_FLAVOR} \ | ||
${PYTHON_PKGNAMEPREFIX}pillow>=9.2.0:graphics/py-pillow@${PY_FLAVOR} \ | ||
${PYTHON_PKGNAMEPREFIX}keras-preprocessing>=1.1.0:math/py-keras-preprocessing@${PY_FLAVOR} \ | ||
${PYTHON_PKGNAMEPREFIX}scipy>=0.14:science/py-scipy@${PY_FLAVOR} \ | ||
${PYTHON_PKGNAMEPREFIX}six>=1.9.0:devel/py-six@${PY_FLAVOR} \ | ||
${PYTHON_PKGNAMEPREFIX}theano>=0.8.0:math/py-theano@${PY_FLAVOR} \ | ||
${PYTHON_PKGNAMEPREFIX}yaml>0:devel/py-yaml@${PY_FLAVOR} | ||
${PYTHON_PKGNAMEPREFIX}protobuf>=3.13.0:devel/py-protobuf@${PY_FLAVOR} \ | ||
${PYTHON_PKGNAMEPREFIX}keras-applications>=1.0.8:math/py-keras-applications@${PY_FLAVOR} \ | ||
${PYTHON_PKGNAMEPREFIX}keras-preprocessing>=1.1.1:math/py-keras-preprocessing@${PY_FLAVOR} | ||
|
||
BUILD_DEPENDS= ${RUN_DEPENDS} \ | ||
${PYTHON_PKGNAMEPREFIX}tensorflow>=2.9.0:science/py-tensorflow@${PY_FLAVOR} \ | ||
bazel:devel/bazel \ | ||
bash:shells/bash | ||
|
||
USES= python:3.7+ | ||
USE_PYTHON= autoplist distutils | ||
|
||
NO_ARCH= yes | ||
SUB_FILES= pkg-message | ||
.include "Makefile.MASTER_SITES" | ||
|
||
post-patch: | ||
# don't cache stuff to $HOME/.cache/ | ||
@${MKDIR} ${WRKDIR}/bazel-cache | ||
@${MKDIR} ${WRKDIR}/bazel-dist | ||
|
||
.for file in ${DISTFILES:C/\:(.*)//} | ||
@${ECHO} "Moving ${file} to ${WRKDIR}/bazel-dist" | ||
@${CP} ${DISTDIR}/${DIST_SUBDIR}/${file} ${WRKDIR}/bazel-dist | ||
.endfor | ||
|
||
# place the generate wheel file here | ||
@${MKDIR} ${WRKDIR}/whl | ||
|
||
# These files are from my tensorflow port | ||
# if both make it into the port they can be shared | ||
|
||
# copy the toolchain over | ||
@${CP} -R ${PATCHDIR}/freebsd \ | ||
${WRKSRC}/ | ||
|
||
@${CP} ${PATCHDIR}/bazelrc \ | ||
${WRKSRC}/ | ||
|
||
#setup localbase | ||
@${REINPLACE_CMD} "s#%%LOCALBASE%%#${LOCALBASE}#" \ | ||
${WRKSRC}/freebsd/cc_toolchain_config.bzl \ | ||
${WRKSRC}/.bazelrc \ | ||
${WRKSRC}/bazelrc | ||
|
||
# setup our bazelrc | ||
@${REINPLACE_CMD} "s#%%BAZEL_DIR%%#${WRKDIR}#" ${WRKSRC}/bazelrc | ||
@${REINPLACE_CMD} "s#%%BAZEL_DIST%%#${WRKDIR}#" ${WRKSRC}/bazelrc | ||
@${REINPLACE_CMD} "s#%%PATH%%#${PATH}#" ${WRKSRC}/bazelrc | ||
@${REINPLACE_CMD} "s#%%PYTHON%%#${PYTHON_CMD}#" ${WRKSRC}/.bazelrc | ||
|
||
# bazel is horrible, it will won't propagated enviroment variable throughout the build | ||
# and will ignore variables set by us. This causing a lot of issues, especially with python | ||
# auto generated files will sometimes ignore our py_runtime toolchain and our PYTHON_BIN_PATH | ||
# causing it to still set the shebang line to bin/env python3. Even on the github page the solution | ||
# has been to use a symlink to work around so do that here as a fix | ||
@${MKDIR} ${WRKDIR}/.bin | ||
${LN} -s ${PYTHON_CMD} ${WRKDIR}/.bin/python3 | ||
|
||
@${REINPLACE_CMD} "s#%%PYTHON%%#${PYTHON_CMD}#" \ | ||
${WRKSRC}/keras/tools/pip_package/build_pip_package.sh | ||
|
||
do-build: | ||
@cd ${WRKSRC} && ${SETENV} \ | ||
PYTHON_BIN_PATH=${PYTHON_CMD} \ | ||
PYTHON_LIB_PATH="${PYTHON_SITELIBDIR}" \ | ||
PYTHON_BINARY=${PYTHON_CMD} \ | ||
bazel --bazelrc="${WRKSRC}/bazelrc" \ | ||
build --config=freebsd \ | ||
//keras/tools/pip_package:build_pip_package | ||
|
||
# @${REINPLACE_CMD} "s#python#${PYTHON_CMD}#" \ | ||
# ${WRKSRC}/bazel-bin/keras/tools/pip_package/build_pip_package | ||
|
||
@cd ${WRKSRC} && \ | ||
bazel-bin/keras/tools/pip_package/build_pip_package \ | ||
${WRKDIR}/whl | ||
|
||
|
||
do-install: | ||
@${MKDIR} ${STAGEDIR}/${PYTHON_SITELIBDIR} | ||
|
||
${UNZIP_NATIVE_CMD} -d ${STAGEDIR}/${PYTHON_SITELIBDIR} ${WRKDIR}/whl/${PORTNAME}-${PORTVERSION}-*.whl | ||
|
||
.include <bsd.port.mk> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
DISTFILES+= b1c40e1de81913a3c40e5948f78719c28152486d.zip:rulescc \ | ||
7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip:javarules | ||
|
||
MASTER_SITES+= https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/:rulescc \ | ||
https://github.com/bazelbuild/rules_java/archive/:javarules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
TIMESTAMP = 1605075225 | ||
SHA256 (Keras-2.4.3.tar.gz) = fedd729b52572fb108a98e3d97e1bac10a81d3917d2103cc20ab2a5f03beb973 | ||
SIZE (Keras-2.4.3.tar.gz) = 291047 | ||
TIMESTAMP = 1662706867 | ||
SHA256 (b1c40e1de81913a3c40e5948f78719c28152486d.zip) = d0c573b94a6ef20ef6ff20154a23d0efcb409fb0e1ff0979cec318dfe42f0cdd | ||
SIZE (b1c40e1de81913a3c40e5948f78719c28152486d.zip) = 201360 | ||
SHA256 (7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip) = bc81f1ba47ef5cc68ad32225c3d0e70b8c6f6077663835438da8d5733f917598 | ||
SIZE (7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip) = 9422 | ||
SHA256 (keras-team-keras-2.9.0-r2.9_GH0.tar.gz) = 90bded417306a1fad2d7088009d87972afbac8d6eee29d3f24711df6994ac51a | ||
SIZE (keras-team-keras-2.9.0-r2.9_GH0.tar.gz) = 2142794 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
startup --output_user_root="%%BAZEL_DIR%%/.cache/" | ||
|
||
# make bazel only fetch distfiles from the cache | ||
fetch --repository_cache="%%BAZEL_DIR%%/bazel-cache/" --distdir="%%BAZEL_DIST%%/bazel-dist/" | ||
build --repository_cache="%%BAZEL_DIR%%/bazel-cache/" --distdir="%%BAZEL_DIST%%/bazel-dist/" | ||
|
||
build --define=PREFIX=%%LOCALBASE%% | ||
build --define=LIBDIR=%%LOCALBASE%%/lib | ||
build --define=INCLUDEDIR=%%LOCALBASE%%/include | ||
build --define=PROTOBUF_INCLUDE_PATH=%%LOCALBASE%%/include | ||
|
||
build --extra_toolchains=//freebsd:cc-toolchain-freebsd | ||
|
||
# for python | ||
build --action_env=PATH=%%PATH%% | ||
build --host_action_env=PATH=%%PATH%% | ||
|
||
build --config=freebsd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Copyright 2018 The Bazel Authors. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# This becomes the BUILD file for @local_config_cc// under FreeBSD and OpenBSD. | ||
load(":cc_toolchain_config.bzl", "cc_toolchain_config") | ||
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_toolchain", "cc_toolchain_suite") | ||
load("@bazel_tools//tools/python:toolchain.bzl", "py_runtime_pair") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
cc_library( | ||
name = "malloc", | ||
) | ||
filegroup( | ||
name = "empty", | ||
srcs = [], | ||
) | ||
|
||
# Hardcoded toolchain, legacy behaviour. | ||
cc_toolchain_suite( | ||
name = "freebsd_clang", | ||
toolchains = { | ||
"k8": ":cc-compiler-freebsd", | ||
"freebsd": ":cc-compiler-freebsd", | ||
}, | ||
) | ||
|
||
cc_toolchain( | ||
name = "cc-compiler-freebsd", | ||
all_files = ":empty", | ||
ar_files = ":empty", | ||
as_files = ":empty", | ||
compiler_files = ":empty", | ||
dwp_files = ":empty", | ||
linker_files = ":empty", | ||
objcopy_files = ":empty", | ||
strip_files = ":empty", | ||
supports_param_files = 0, | ||
toolchain_config = ":local_freebsd", | ||
toolchain_identifier = "local_freebsd", | ||
) | ||
cc_toolchain_config( | ||
name = "local_freebsd", | ||
cpu = "k8", | ||
) | ||
|
||
toolchain( | ||
name = "cc-toolchain-freebsd", | ||
exec_compatible_with = [ | ||
"@platforms//cpu:x86_64", | ||
"@platforms//os:freebsd", | ||
], | ||
target_compatible_with = [ | ||
"@platforms//cpu:x86_64", | ||
"@platforms//os:freebsd", | ||
], | ||
toolchain = ":cc-compiler-freebsd", | ||
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", | ||
) | ||
|
||
py_runtime( | ||
name = "freebsd_python", | ||
interpreter_path = "/usr/local/bin/python3.9", | ||
python_version = "PY3", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
py_runtime_pair( | ||
name = "bsd_py_runtime_pair", | ||
py2_runtime = None, | ||
py3_runtime = ":freebsd_python", | ||
) | ||
|
||
toolchain( | ||
name = "freebsd_py_toolchain", | ||
toolchain = ":bsd_py_runtime_pair", | ||
toolchain_type = "@bazel_tools//tools/python:toolchain_type", | ||
) | ||
|
Oops, something went wrong.