Skip to content

Commit

Permalink
preserve openssl.pc
Browse files Browse the repository at this point in the history
  • Loading branch information
bassosimone committed Oct 12, 2023
1 parent 245842a commit b7b95dd
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 11 deletions.
128 changes: 120 additions & 8 deletions internal/cmd/buildtool/android_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1054,8 +1054,36 @@ func TestAndroidBuildCdepsLibevent(t *testing.T) {
Env: []string{},
Argv: []string{
"rm",
"-rf",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm/lib/pkgconfig",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm/lib/pkgconfig/libevent.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm/lib/pkgconfig/libevent_core.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm/lib/pkgconfig/libevent_extra.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm/lib/pkgconfig/libevent_openssl.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm/lib/pkgconfig/libevent_pthreads.pc",
},
}, {
Env: []string{},
Expand Down Expand Up @@ -1205,8 +1233,36 @@ func TestAndroidBuildCdepsLibevent(t *testing.T) {
Env: []string{},
Argv: []string{
"rm",
"-rf",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm64/lib/pkgconfig",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm64/lib/pkgconfig/libevent.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm64/lib/pkgconfig/libevent_core.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm64/lib/pkgconfig/libevent_extra.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm64/lib/pkgconfig/libevent_openssl.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/arm64/lib/pkgconfig/libevent_pthreads.pc",
},
}, {
Env: []string{},
Expand Down Expand Up @@ -1356,8 +1412,36 @@ func TestAndroidBuildCdepsLibevent(t *testing.T) {
Env: []string{},
Argv: []string{
"rm",
"-rf",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/386/lib/pkgconfig",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/386/lib/pkgconfig/libevent.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/386/lib/pkgconfig/libevent_core.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/386/lib/pkgconfig/libevent_extra.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/386/lib/pkgconfig/libevent_openssl.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/386/lib/pkgconfig/libevent_pthreads.pc",
},
}, {
Env: []string{},
Expand Down Expand Up @@ -1507,8 +1591,36 @@ func TestAndroidBuildCdepsLibevent(t *testing.T) {
Env: []string{},
Argv: []string{
"rm",
"-rf",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/amd64/lib/pkgconfig",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/amd64/lib/pkgconfig/libevent.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/amd64/lib/pkgconfig/libevent_core.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/amd64/lib/pkgconfig/libevent_extra.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/amd64/lib/pkgconfig/libevent_openssl.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/internal/cmd/buildtool/internal/libtor/android/amd64/lib/pkgconfig/libevent_pthreads.pc",
},
}, {
Env: []string{},
Expand Down
12 changes: 11 additions & 1 deletion internal/cmd/buildtool/cdepslibevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,17 @@ func cdepsLibeventBuildMain(globalEnv *cBuildEnv, deps buildtoolmodel.Dependenci
must.Run(log.Log, "make", "V=1", "-j", strconv.Itoa(runtime.NumCPU()))
must.Run(log.Log, "make", "DESTDIR="+globalEnv.DESTDIR, "install")
must.Run(log.Log, "rm", "-rf", filepath.Join(globalEnv.DESTDIR, "bin"))
must.Run(log.Log, "rm", "-rf", filepath.Join(globalEnv.DESTDIR, "lib", "pkgconfig"))

// We used to delete the whole pkgconfig directory but libevent's build needs OpenSSL's
// pkgconfig, so removing the whole directory means rebuilding libevent requires building
// OpenSSL because its pkgconfig is also removed. We discovered this need when working
// on the https://github.com/ooni/probe-cli/pull/1366 MVP. To keep the build idempotent,
// let's be more gentle and just remove libevent's pkgconfig files instead.
must.Run(log.Log, "rm", "-f", filepath.Join(globalEnv.DESTDIR, "lib", "pkgconfig", "libevent.pc"))
must.Run(log.Log, "rm", "-f", filepath.Join(globalEnv.DESTDIR, "lib", "pkgconfig", "libevent_core.pc"))
must.Run(log.Log, "rm", "-f", filepath.Join(globalEnv.DESTDIR, "lib", "pkgconfig", "libevent_extra.pc"))
must.Run(log.Log, "rm", "-f", filepath.Join(globalEnv.DESTDIR, "lib", "pkgconfig", "libevent_openssl.pc"))
must.Run(log.Log, "rm", "-f", filepath.Join(globalEnv.DESTDIR, "lib", "pkgconfig", "libevent_pthreads.pc"))

// we just need libevent.a
must.Run(log.Log, "rm", "-rf", filepath.Join(globalEnv.DESTDIR, "lib", "libevent.la"))
Expand Down
32 changes: 30 additions & 2 deletions internal/cmd/buildtool/linuxcdeps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,36 @@ func TestLinuxCdepsBuildMain(t *testing.T) {
Env: []string{},
Argv: []string{
"rm",
"-rf",
faketopdir + "/" + sysDepDestDir + "/lib/pkgconfig",
"-f",
faketopdir + "/" + sysDepDestDir + "/lib/pkgconfig/libevent.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/" + sysDepDestDir + "/lib/pkgconfig/libevent_core.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/" + sysDepDestDir + "/lib/pkgconfig/libevent_extra.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/" + sysDepDestDir + "/lib/pkgconfig/libevent_openssl.pc",
},
}, {
Env: []string{},
Argv: []string{
"rm",
"-f",
faketopdir + "/" + sysDepDestDir + "/lib/pkgconfig/libevent_pthreads.pc",
},
}, {
Env: []string{},
Expand Down

0 comments on commit b7b95dd

Please sign in to comment.