Skip to content

Commit

Permalink
Add libpng 1.6.40 (#1005)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vertexwahn authored Oct 15, 2023
1 parent e781035 commit d191a6d
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/libpng/1.6.40/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module(
name = "libpng",
version = "1.6.40",
compatibility_level = 1,
)

bazel_dep(name = "platforms", version = "0.0.7")
bazel_dep(name = "zlib", version = "1.3")
62 changes: 62 additions & 0 deletions modules/libpng/1.6.40/patches/add_build_file.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
--- BUILD.bazel
+++ BUILD.bazel
@@ -0,0 +1,59 @@
+# Copied from https://github.com/google-deepmind/lab2d/blob/09474439959534b1de3fce3d4a4ed35d565ea230/bazel/png.BUILD
+# with minor modifications available under Apache 2.0 License
+# SPDX-License-Identifier: Apache-2.0
+
+# Description:
+# libpng is the official PNG reference library.
+
+genrule(
+ name = "pnglibconf",
+ srcs = ["scripts/pnglibconf.h.prebuilt"],
+ outs = ["pnglibconf.h"],
+ cmd = "cp $(location scripts/pnglibconf.h.prebuilt) $(location pnglibconf.h)",
+)
+
+cc_library(
+ name = "png",
+ srcs = [
+ "png.c",
+ "pngdebug.h",
+ "pngerror.c",
+ "pngget.c",
+ "pnginfo.h",
+ "pnglibconf.h",
+ "pngmem.c",
+ "pngpread.c",
+ "pngpriv.h",
+ "pngread.c",
+ "pngrio.c",
+ "pngrtran.c",
+ "pngrutil.c",
+ "pngset.c",
+ "pngstruct.h",
+ "pngtrans.c",
+ "pngwio.c",
+ "pngwrite.c",
+ "pngwtran.c",
+ "pngwutil.c",
+ ] + select({
+ "@platforms//cpu:arm64": [
+ "arm/arm_init.c",
+ "arm/filter_neon_intrinsics.c",
+ "arm/palette_neon_intrinsics.c",
+ ],
+ "//conditions:default": [],
+ }),
+ hdrs = [
+ "png.h",
+ "pngconf.h",
+ ],
+ includes = ["."],
+ linkopts = ["-lm"],
+ visibility = ["//visibility:public"],
+ deps = ["@zlib//:zlib"],
+)
+alias(
+ name = "libpng",
+ actual = ":png",
+ visibility = ["//visibility:public"],
+)
11 changes: 11 additions & 0 deletions modules/libpng/1.6.40/patches/module_dot_bazel.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- MODULE.bazel
+++ MODULE.bazel
@@ -0,0 +1,8 @@
+module(
+ name = "libpng",
+ version = "1.6.40",
+ compatibility_level = 1,
+)
+
+bazel_dep(name = "platforms", version = "0.0.7")
+bazel_dep(name = "zlib", version = "1.3")
13 changes: 13 additions & 0 deletions modules/libpng/1.6.40/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
matrix:
platform:
- centos7
- debian10
- ubuntu2004
- macos
- windows
tasks:
verify_targets:
name: Verify build targets
platform: ${{ platform }}
build_targets:
- '@libpng//:libpng'
10 changes: 10 additions & 0 deletions modules/libpng/1.6.40/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"url": "https://download.sourceforge.net/libpng/libpng-1.6.40.tar.gz",
"integrity": "sha256-j3ILNjqghoPJvypWMjb0UxOvLFXVQrVIGuF92NGDu0I=",
"strip_prefix": "libpng-1.6.40",
"patches": {
"add_build_file.patch": "sha256-IKBdDmPuuugv3ZFYMxKbKbJEdKd9c9FPxr5BBjkYnmI=",
"module_dot_bazel.patch": "sha256-I4/ZDMvlGjXSTRyHy9dvW8idDHIInWXZ8e6jDW0mq6o="
},
"patch_strip": 0
}
15 changes: 15 additions & 0 deletions modules/libpng/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"homepage": "http://www.libpng.org/pub/png/libpng.html",
"maintainers": [
{
"email": "[email protected]",
"github": "Vertexwahn",
"name": "Julian Amann"
}
],
"repository": [],
"versions": [
"1.6.40"
],
"yanked_versions": {}
}

0 comments on commit d191a6d

Please sign in to comment.