Skip to content
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

Add dub.eclass #131

Closed
wants to merge 4 commits into from
Closed

Add dub.eclass #131

wants to merge 4 commits into from

Conversation

the-horo
Copy link
Contributor

No description provided.

local -x DFLAGS="${DCFLAGS} ${DLANG_LDFLAGS} $(dlang_get_wno_error_flag)"

# Run the unittests in the source files.
"${DUB}" test --verbose -c application
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing die?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or was this supposed to be edub?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's missin the die. edub is not applicable as it will call the assumed to be installed dub, not the one which was just built. I don't think dub depending on dub is a good design so no calling edub.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pattern for this is to inhibit dependencies in the eclass if CAT/PN = blah/dub but it can be a bit ugly. Not required at all, just a suggestion.

S="${WORKDIR}/${PN}-${MY_PV}"
LICENSE="MIT BSD"
LICENSE+=" Apache-2.0 Boost-1.0 BSD GPL-3 LGPL-3 MIT openssl public-domain Unlicense"
LICENSE+=" test? ( ISC public-domain )" # test dependencies. These do _not_ map to test? () in SRC_URI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of interest, why don't they map? Some of it is bundled I assume?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dub is very nice in that it will require that all possible dependencies to be satisfied when building something, even if, in that build, fewer things are needed. In this example, serve-d uses silly for tests. If silly is not present during dub build dub will fail. dub build does not use silly, only dub test so the license of silly I've put behind test?. There's probably more of these cases, at least both the openssl dependencies are unused as well though I didn't want to bother any more with this.

Upstream has an issue for this: dlang/dub#1706

RESTRICT="!test? ( test )"

# gdc currently fails due to a bug in mir-cpuid, see: https://github.com/libmir/mir-cpuid/pull/46
DLANG_COMPAT=( dmd-2_{106..109} ldc2-1_{35..39} )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd consider trying to keep inherits all in one place and all eclass vars before inherit where possible. It's a lot easier to follow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No objection.

debug-print "${FUNCNAME}: DFLAGS=${DFLAGS}"

set -- dub --verbose "${@}"
echo "${@}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is edo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bah, how come I only learn of this. I've read the devguide only up to the eclass reference before writing the eclass, such bad timing.

eclass/dub.eclass Show resolved Hide resolved
KEYWORDS="~amd64"
RESTRICT="test"

RDEPEND="${DLANG_DEPS}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The eclass should be setting this for us by default, right? (These variables accumulate when set by eclasses, see PMS)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think that's a better design. I guess I need to check if dlang-single or dlang-r1 has been inherited.

Copy link
Member

@thesamesam thesamesam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good!

ewarn "precaution."
ewarn ""
ewarn "See also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114171"
dlang-filter-dflags "gdc*" "-march=native"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should pass -fno-tree-vectorize instead unconditionally with the bad GCC version, regardless of arch or DCFLAGS. That should avoid the miscompilation.

Or do tests fail with that?

}

src_compile() {
local imports=source versions="DubApplication DubUseCurl"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is OK but consider using arrays where they make sense.

# Tries to connect to github.com and fails due to the network sandbox
rm -rf "${S}/test/git-dependency" || die
# Doesn't work on non amd64/x86
if [[ ${ARCH} == arm64 ]]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use a case statement and delete it on anything but amd64/x86 then.


# See https://issues.dlang.org/show_bug.cgi?id=24406 and
# https://github.com/Pure-D/serve-d/issues/360
# For short, we have to remove -O from DCFLAGS for dmd.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# For short, we have to remove -O from DCFLAGS for dmd.
# In short, we have to remove -O from DCFLAGS for dmd.

# Tries to update dependencies timing out for each one which sums up
# to about 4 minutes of doing nothing. There is no direct way to
# configure the code not to contact https://code.dlang.org
rm -rf tc_dub || die
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guilty of this all the time, but I should note that the use of -f in rm -f ... || die will suppress issues you often want to know about, e.g. the test being renamed.

edo "${dubFetch[@]}" "${name}@${ver}"

# If it's the main package
[[ ${file} == ${PN}-$(ver_rs 3 - 4 .)* ]] \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks a bit gnarly and maybe a comment explaining why it's right wouldn't go amiss, but it might be obvious to someone who works with D a lot, so I don't insist.


EAPI=8

# gdc-13 is disabled due to: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111650
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
# gdc-13 is disabled due to: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111650
# gdc-13 is disabled due to: https://gcc.gnu.org/PR111650

"[email protected]"
"[email protected]"
)
inherit dlang-single dub
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for changing the style wrt var order. It's much easier to read now.

)
inherit dlang-single dub

DESCRIPTION="Sampling disk usage profiler for btrfs "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
DESCRIPTION="Sampling disk usage profiler for btrfs "
DESCRIPTION="Sampling disk usage profiler for btrfs"

LICENSE+=" Boost-1.0 GPL-2 MIT MPL-2.0"
SLOT="0"
KEYWORDS="~amd64"
RESTRICT="test"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment might be nice as to why?

Signed-off-by: Andrei Horodniceanu <[email protected]>
Additionally add missing dependency virtual/pkgconfig to RDEPEND.

Signed-off-by: Andrei Horodniceanu <[email protected]>
Additional changes:
- port to dub.eclass
- run some more tests
- install documentation on how to setup serve-d for various text editors

Signed-off-by: Andrei Horodniceanu <[email protected]>
Signed-off-by: Andrei Horodniceanu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants