-
-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZBar: add package #5530
ZBar: add package #5530
Conversation
packages/z/zbar/xmake.lua
Outdated
io.gsub("include/config.h.in", "# ?undef (.-)\n", "${define %1}\n") | ||
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua") | ||
|
||
local config = { vers = package:version_str() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to configs
packages/z/zbar/xmake.lua
Outdated
|
||
-- get LIB_VERSION from configure.ac | ||
-- format: AC_SUBST([LIB_VERSION], [3:0:3]) | ||
configure_ac = io.readfile("configure.ac") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local configure_ac
packages/z/zbar/xmake.lua
Outdated
end | ||
end | ||
|
||
import("package.tools.xmake").install(package,config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add spaces ,
packages/z/zbar/xmake.lua
Outdated
end | ||
|
||
if is_plat("macosx") then | ||
add_deps("libiconv", {system = true}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libiconv will find and use system libs first. so you need not add system = true
packages/z/zbar/port/xmake.lua
Outdated
add_requires("libiconv") | ||
|
||
-- add options | ||
option("enable_codebar") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove enable_ prefix
packages/z/zbar/port/xmake.lua
Outdated
set_description("whether to build support for " .. code.description) | ||
|
||
on_check(function (option) | ||
local enabled_codes = option:dep("enable-codes"):value() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see it in tools.xmake.install.
packages/z/zbar/port/xmake.lua
Outdated
add_requires("libiconv") | ||
|
||
-- add options | ||
option("enable-codes") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove enable-
prefix
if is_plat("linux", "bsd") then | ||
add_syslinks("pthread") | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no any add_configs to set xxx codes
options in port/xmake.lua
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, we do need configs in the package description.
By the way, which form is better?
xrepo install -f "qr=true" zbar
xrepo install -f "codes=qr" zbar
For reference, the original configure
shell script uses options like the following:
./configure --disable-video --without-gtk --without-python --enable-shared=yes --enable-static=yes --with-pic --enable-codes=ean,databar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use single codes option/config
add_requires("xxx", configs = {codecs = {"qr", "ean", ...})
packages/z/zbar/port/xmake.lua
Outdated
patch_ver = vers[3] or "" | ||
set_configvar("ZBAR_VERSION_MAJOR", major_ver, {quote = false}) | ||
set_configvar("ZBAR_VERSION_MINOR", minor_ver, {quote = false}) | ||
set_configvar("ZBAR_VERSION_PATCH", patch_ver, {quote = false}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use set_versions, xmake has builtin vars in config.h.in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The config.h.in
file contains content like the following:
/* Program major version (before the '.') as a number */
#undef ZBAR_VERSION_MAJOR
/* Program minor version (after '.') as a number */
#undef ZBAR_VERSION_MINOR
/* Program patch version (after the second '.') as a number */
#undef ZBAR_VERSION_PATCH
I'm not sure how to handle this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I edit config.h.in
to the following?
/* Program major version (before the '.') as a number */
#define ZBAR_VERSION_MAJOR ${VERSION_MAJOR}
/* Program minor version (after '.') as a number */
#define ZBAR_VERSION_MINOR ${VERSION_MINOR}
/* Program patch version (after the second '.') as a number */
#define ZBAR_VERSION_PATCH ${VERSION_ALTER}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right
packages/z/zbar/xmake.lua
Outdated
add_extsources("brew::zbar") | ||
end | ||
|
||
add_configs("symbologies", {description = "Select symbologies to compile", default = {"ean","databar","code128","code93","code39","codabar","i25","qrcode","sqcode"}, type = "table"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add spaces ,
packages/z/zbar/port/xmake.lua
Outdated
|
||
-- add options | ||
option("symbologies") | ||
-- set_default({"ean","databar","code128","code93","code39","codabar","i25","qrcode","sqcode"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment
packages/z/zbar/port/xmake.lua
Outdated
set_version(get_config("vers")) | ||
|
||
set_configvar("PACKAGE_VERSION", get_config("vers")) | ||
set_configvar("PACKAGE_STRING", "zbar " .. get_config("vers")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
packages/z/zbar/port/config.h.in
Outdated
#undef PACKAGE_URL | ||
|
||
/* Define to the version of this package. */ | ||
#undef PACKAGE_VERSION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here
Description
ZBar is an open-source software suite for reading barcodes from various sources, including webcams. Its original development stopped in 2012, and mchehab took the task of keeping it updated with the V4L2 API.
Configuration
ZBar uses autotools and includes various components such as Python bindings, video input, and GUI widgets. For simplicity and portability, it has been ported to xmake, however, only essential configuration options are translated.