Skip to content

sourcepkg: add a complete source package build #8

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

Merged
merged 1 commit into from
Aug 29, 2023
Merged

Conversation

raggi
Copy link
Member

@raggi raggi commented Mar 3, 2023

If you want to construct a package build for a distribution, you typically need a copy of all of the sources. This produces an archive that has a sufficiently common form that packagers can easily consume.

The final tarball make install target installs .h, .so, .a and .pc into $prefix, e.g.

% find /usr/local -name libtailscale\*
/usr/local/lib/libtailscale.so
/usr/local/lib/libtailscale.a
/usr/local/lib/pkgconfig/libtailscale.pc
/usr/local/include/libtailscale.h

and pkg-config is configured:

% pkg-config --static --cflags libtailscale
-I/usr/local/include
% pkg-config --static --libs libtailscale
-L/usr/local/lib -ltailscale
% pkg-config --libs libtailscale
-L/usr/local/lib -ltailscale

@bradfitz
Copy link
Member

bradfitz commented Mar 3, 2023

Typo package

@raggi raggi force-pushed the raggi/sourceball branch from df91e1b to 772f158 Compare March 3, 2023 23:27
@Xe Xe changed the title sourcepkg: add a complete source pakage build sourcepkg: add a complete source package build Mar 3, 2023
@crawshaw
Copy link
Contributor

crawshaw commented Mar 4, 2023

No strong opinions here, something like this makes sense. Is the top-level Makefile necessary or could those targets be in the sourcepkg/Makefile?

@raggi
Copy link
Member Author

raggi commented Mar 4, 2023

I could move the top level makefile, it just gets a bit harder to write (I could also use bash or something to do the work there). The makefile inside sourcepkg is the one that goes in the tar ball, so it could contain the targets but it'd be a bit odd for someone reading it when they just cracked open the tarball.

@crawshaw
Copy link
Contributor

crawshaw commented Mar 5, 2023

We're going to end up with a lot of bespoke build systems (the Java one is already oof) and so I'm wondering if we can keep ~everything in sub-levels for now. Maybe a Makefile.release that gets renamed int he sourcepkg?

@Xe Xe mentioned this pull request Mar 5, 2023
15 tasks
@raggi
Copy link
Member Author

raggi commented Mar 6, 2023

Yeah, makes sense, I'll move it to be contained.

@raggi
Copy link
Member Author

raggi commented Mar 9, 2023

note to self, from crawshaw:

architectures aren't too hard, you can use lipo on a mac to bundle multiple architectures into a single .a

there could be a target in Makefile.src to help users produce this

@raggi raggi force-pushed the raggi/sourceball branch 3 times, most recently from 80f163f to 8d5d0aa Compare August 16, 2023 17:39
@raggi
Copy link
Member Author

raggi commented Aug 16, 2023

note to self, from crawshaw:

architectures aren't too hard, you can use lipo on a mac to bundle multiple architectures into a single .a

there could be a target in Makefile.src to help users produce this

I'll have to defer addressing this, as there's something strange going on with the toolchain:

% GOARCH=amd64 GOOS=darwin go build -a -v -x -trimpath -buildmode=c-shared -o libtailscale.dylib.amd64 .

WORK=/var/folders/bb/dyr_1n6j575g8nq85nmnfbt00000gn/T/go-build1117180346
package github.com/tailscale/libtailscale: build constraints exclude all Go files in /Users/raggi/src/github.com/tailscale/libtailscale/sourcepkg/libtailscale
% grep 'build' *.go
%

@raggi raggi force-pushed the raggi/sourceball branch 7 times, most recently from 1b4702a to 5344780 Compare August 16, 2023 19:38
@raggi raggi requested review from crawshaw and willnorris August 16, 2023 19:44
There is a makefile that will produce a libtailscale.tar.zst. This
archive contains a vendored Go source tree for libtailscale, and a
`configure` and `Makefile` that will produce a .so, a .a, and a .pc file
for building & linking against.

Updates tailscale/tailscale#8912
@raggi raggi force-pushed the raggi/sourceball branch from 5344780 to b4c693a Compare August 29, 2023 18:53
@raggi raggi merged commit 9095651 into main Aug 29, 2023
@raggi raggi deleted the raggi/sourceball branch August 29, 2023 18:56
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.

4 participants